mirror of https://github.com/morpheus65535/bazarr
Fixed upgrade subtitles function that was trying to upgrade deleted episode/movie subtitles. #1759
This commit is contained in:
parent
6fc4f135ba
commit
f81972b291
|
@ -79,6 +79,7 @@ class EpisodesHistory(Resource):
|
|||
TableHistory.score,
|
||||
TableShows.tags,
|
||||
TableHistory.action,
|
||||
TableHistory.video_path,
|
||||
TableHistory.subtitles_path,
|
||||
TableHistory.sonarrEpisodeId,
|
||||
TableHistory.provider,
|
||||
|
@ -101,7 +102,8 @@ class EpisodesHistory(Resource):
|
|||
if {"video_path": str(item['path']), "timestamp": float(item['timestamp']), "score": str(item['score']),
|
||||
"tags": str(item['tags']), "monitored": str(item['monitored']),
|
||||
"seriesType": str(item['seriesType'])} in upgradable_episodes_not_perfect: # noqa: E129
|
||||
if os.path.isfile(path_mappings.path_replace(item['subtitles_path'])):
|
||||
if os.path.exists(path_mappings.path_replace(item['subtitles_path'])) and \
|
||||
os.path.exists(path_mappings.path_replace(item['video_path'])):
|
||||
item.update({"upgradable": True})
|
||||
|
||||
del item['path']
|
||||
|
|
|
@ -79,7 +79,8 @@ class MoviesHistory(Resource):
|
|||
TableHistoryMovie.score,
|
||||
TableHistoryMovie.subs_id,
|
||||
TableHistoryMovie.provider,
|
||||
TableHistoryMovie.subtitles_path)\
|
||||
TableHistoryMovie.subtitles_path,
|
||||
TableHistoryMovie.video_path)\
|
||||
.join(TableMovies, on=(TableHistoryMovie.radarrId == TableMovies.radarrId))\
|
||||
.where(query_condition)\
|
||||
.order_by(TableHistoryMovie.timestamp.desc())\
|
||||
|
@ -96,7 +97,8 @@ class MoviesHistory(Resource):
|
|||
item.update({"upgradable": False})
|
||||
if {"video_path": str(item['path']), "timestamp": float(item['timestamp']), "score": str(item['score']),
|
||||
"tags": str(item['tags']), "monitored": str(item['monitored'])} in upgradable_movies_not_perfect: # noqa: E129
|
||||
if os.path.isfile(path_mappings.path_replace_movie(item['subtitles_path'])):
|
||||
if os.path.exists(path_mappings.path_replace_movie(item['subtitles_path'])) and \
|
||||
os.path.exists(path_mappings.path_replace_movie(item['video_path'])):
|
||||
item.update({"upgradable": True})
|
||||
|
||||
del item['path']
|
||||
|
|
|
@ -73,7 +73,9 @@ def upgrade_subtitles():
|
|||
|
||||
episodes_to_upgrade = []
|
||||
for episode in upgradable_episodes_not_perfect:
|
||||
if os.path.exists(path_mappings.path_replace(episode['subtitles_path'])) and int(episode['score']) < 357:
|
||||
if os.path.exists(path_mappings.path_replace(episode['subtitles_path'])) and \
|
||||
os.path.exists(path_mappings.path_replace(episode['video_path'])) and \
|
||||
int(episode['score']) < 357:
|
||||
episodes_to_upgrade.append(episode)
|
||||
|
||||
count_episode_to_upgrade = len(episodes_to_upgrade)
|
||||
|
@ -114,7 +116,9 @@ def upgrade_subtitles():
|
|||
|
||||
movies_to_upgrade = []
|
||||
for movie in upgradable_movies_not_perfect:
|
||||
if os.path.exists(path_mappings.path_replace_movie(movie['subtitles_path'])) and int(movie['score']) < 117:
|
||||
if os.path.exists(path_mappings.path_replace_movie(movie['subtitles_path'])) and \
|
||||
os.path.exists(path_mappings.path_replace_movie(movie['video_path'])) and \
|
||||
int(movie['score']) < 117:
|
||||
movies_to_upgrade.append(movie)
|
||||
|
||||
count_movie_to_upgrade = len(movies_to_upgrade)
|
||||
|
|
Loading…
Reference in New Issue