Skip to content

Commit

Permalink
fix: translator not working if custom rss not enable
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Dec 16, 2024
1 parent 203ea9d commit 76777e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions application/back_end/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions application/work/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Visit <https://github.com/cdhigh/KindleEar> for the latest version
# Author: cdhigh <https://github.com/cdhigh>

__Version__ = '3.2.2'
__Version__ = '3.2.3'

import os, sys, builtins, logging
from application.lib import clogging
Expand Down

0 comments on commit 76777e9

Please sign in to comment.