Skip to content

Commit

Permalink
file_info: Cast year and episode number to int
Browse files Browse the repository at this point in the history
If the values are extracted from include_regexes, they might be strs.

Fixes #292
  • Loading branch information
iamkroot committed Apr 3, 2024
1 parent ab04591 commit f432c10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions trakt_scrobbler/file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,13 @@ def cleanup_guess(guess):
notify(msg)
return None
guess['season'] = int(season)
# if it came from regex, this might be a string
guess['episode'] = int(guess['episode'])
req_keys += ['season', 'episode']

if 'year' in guess:
# ensure it is an int
guess['year'] = int(guess['year'])
req_keys += ['year']

return {key: guess[key] for key in req_keys}

0 comments on commit f432c10

Please sign in to comment.