Skip to content

Commit

Permalink
wip: Use title for extracting info
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkroot committed Jan 12, 2023
1 parent 7c73311 commit e9a42c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions trakt_scrobbler/file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ def get_media_info(file_path: str):
return guess


@lru_cache(maxsize=None)
def get_media_info_from_title(title: str):
guess = use_guessit(title)
logger.debug(f"Title Guess: {guess}")
return cleanup_guess(guess)


def cleanup_guess(guess):
if not guess:
return None
Expand Down
4 changes: 3 additions & 1 deletion trakt_scrobbler/player_monitors/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import confuse
import requests
from trakt_scrobbler import config, logger
from trakt_scrobbler.file_info import get_media_info
from trakt_scrobbler.file_info import get_media_info, get_media_info_from_title
from trakt_scrobbler.notifier import notify
from trakt_scrobbler.utils import AutoloadError, ResumableTimer

Expand Down Expand Up @@ -161,6 +161,8 @@ def parse_status(status):

if 'filepath' in status:
media_info = get_media_info(status['filepath'])
if 'title' in status:
title_info = get_media_info_from_title(status['title'])
else:
media_info = status['media_info']

Expand Down

0 comments on commit e9a42c6

Please sign in to comment.