From 76777e93500a0fc0b9b320bcf3360c53e4d3c87f Mon Sep 17 00:00:00 2001 From: cdhigh Date: Mon, 16 Dec 2024 20:07:52 -0300 Subject: [PATCH] fix: translator not working if custom rss not enable --- application/back_end/db_models.py | 6 ++++++ application/work/worker.py | 3 +-- main.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/application/back_end/db_models.py b/application/back_end/db_models.py index 51af8b1f..eb71d911 100644 --- a/application/back_end/db_models.py +++ b/application/back_end/db_models.py @@ -209,6 +209,12 @@ def type_and_id(cls, id_): else: return '', id_ + #根据本实例信息创建一个BookedRecipe实例,但不保存到数据库 + def cloneToBookedRecipe(self): + return BookedRecipe(recipe_id=self.recipe_id, separated=self.custom.get('separated', False), + user=self.user, title=self.title, description=self.description, needs_subscription=self.needs_subscription, + translator=self.translator, tts=self.tts, summarizer=self.summarizer) + #已经被订阅的Recipe信息,包括自定义RSS/上传的recipe/内置builtin_recipe class BookedRecipe(MyBaseModel): recipe_id = CharField() #这个ID不是Recipe数据库ID,而是 builtin:xxx, upload:xxx, custom:xxx diff --git a/application/work/worker.py b/application/work/worker.py index 590160f7..fc7632ad 100644 --- a/application/work/worker.py +++ b/application/work/worker.py @@ -174,8 +174,7 @@ def GetAllRecipeSrc(user, idList): #针对没有启用自定义RSS推送的情况,创建一个临时BookedRecipe对象但不保存到数据库 recipe = Recipe.get_by_id_or_none(dbId) if (recipeType != 'builtin') else None if not bked and recipe: - bked = BookedRecipe(recipe_id=id_, separated=recipe.custom.get('separated', False), - user=user.name, title=recipe.title, description=recipe.description) + bked = recipe.cloneToBookedRecipe() bkeds.append({'recipeId': id_, 'recipeType': recipeType, 'dbId': dbId, 'bked': bked, 'recipe': recipe}) diff --git a/main.py b/main.py index 35a12296..159d1afc 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ # Visit for the latest version # Author: cdhigh -__Version__ = '3.2.2' +__Version__ = '3.2.3' import os, sys, builtins, logging from application.lib import clogging