Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last resort movie identification #1982

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ def initialize(section=None):
configure_utility_locations()
configure_sections(section)
configure_torrent_class()
configure_groups()

__INITIALIZED__ = True

Expand Down
2 changes: 1 addition & 1 deletion core/auto_process/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
else:
extract = int(cfg.get('extract', 0))

imdbid = find_imdbid(dir_name, input_name, omdbapikey)
imdbid, dir_name = find_imdbid(dir_name, input_name, omdbapikey)
if section == 'CouchPotato':
base_url = '{0}{1}:{2}{3}/api/{4}/'.format(protocol, host, port, web_root, apikey)
if section == 'Radarr':
Expand Down
12 changes: 7 additions & 5 deletions core/utils/identification.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
if m:
imdbid = m.group(1)
logger.info('Found imdbID [{0}]'.format(imdbid))
return imdbid
return imdbid, dir_name
if os.path.isdir(dir_name):
for file in os.listdir(text_type(dir_name)):
m = re.search(r'\b(tt\d{7,8})\b', file)
if m:
imdbid = m.group(1)
logger.info('Found imdbID [{0}] via file name'.format(imdbid))
return imdbid
return imdbid, dir_name
if 'NZBPR__DNZB_MOREINFO' in os.environ:
dnzb_more_info = os.environ.get('NZBPR__DNZB_MOREINFO', '')
if dnzb_more_info != '':
Expand All @@ -43,7 +43,7 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
if m:
imdbid = m.group(1)
logger.info('Found imdbID [{0}] from DNZB-MoreInfo'.format(imdbid))
return imdbid
return imdbid, dir_name
logger.info('Searching IMDB for imdbID ...')
try:
guess = guessit.guessit(input_name)
Expand Down Expand Up @@ -87,10 +87,12 @@ def find_imdbid(dir_name, input_name, omdb_api_key):

if imdbid:
logger.info('Found imdbID [{0}]'.format(imdbid))
return imdbid
new_dir_name = '{}.cp({})'.format(dir_name, imdbid)
os.rename(dir_name, new_dir_name)
return imdbid, new_dir_name

logger.warning('Unable to find a imdbID for {0}'.format(input_name))
return imdbid
return imdbid, dir_name


def category_search(input_directory, input_name, input_category, root, categories):
Expand Down
Loading