Skip to content

Commit

Permalink
Improved best subtitles logging when score is below minimum score.
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Apr 11, 2024
1 parent 6fc4b41 commit 3c30492
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_libs/subliminal_patch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ def download_best_subtitles(self, subtitles, video, languages, min_score=0, hear
use_hearing_impaired = hearing_impaired in ("prefer", "force HI")

is_episode = isinstance(video, Episode)
max_score = sum(val for key, val in compute_score._scores['episode' if is_episode else 'movie'].items() if key != "hash")

# sort subtitles by score
unsorted_subtitles = []
Expand Down Expand Up @@ -570,7 +571,9 @@ def download_best_subtitles(self, subtitles, video, languages, min_score=0, hear
for subtitle, score, score_without_hash, matches, orig_matches in scored_subtitles:
# check score
if score < min_score:
logger.info('%r: Score %d is below min_score (%d)', subtitle, score, min_score)
min_score_in_percent = round(min_score * 100 / max_score, 2) if min_score > 0 else 0
logger.info('%r: Score %d is below min_score: %d out of %d (or %r%%)',
subtitle, score, min_score, max_score, min_score_in_percent)
break

# stop when all languages are downloaded
Expand Down

0 comments on commit 3c30492

Please sign in to comment.