diff --git a/docs/USAGE.md b/docs/USAGE.md index b8972ef4..676ac8bf 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -54,7 +54,7 @@ Sometimes you want more control about which torrent is chosen for download. ## Blacklist & Retry a torrent -Sometimes a movie or tv show you download may be too low quality, wrong match, wrong sub-titles, or just completely fake. +Sometimes a movie or tv show you download may be too low quality, wrong match, wrong subtitles, or just completely fake. You can tell nefarious to blacklist & delete that torrent and search again to find the next best option. - click the **Status** tab on a movie or tv show diff --git a/src/nefarious/settings.py b/src/nefarious/settings.py index 1687ad2e..6c954b6d 100644 --- a/src/nefarious/settings.py +++ b/src/nefarious/settings.py @@ -171,7 +171,7 @@ UNPROCESSED_PATH = '.nefarious-unprocessed-downloads' -# container download path (or will be host in development) +# container download path (or will be the host in development) INTERNAL_DOWNLOAD_PATH = os.environ.get('INTERNAL_DOWNLOAD_PATH', '/tmp') # this is really just an indication to know if the nefarious container was volume mounted with access to the download path. diff --git a/src/nefarious/tasks.py b/src/nefarious/tasks.py index 3adcff71..870fe98c 100644 --- a/src/nefarious/tasks.py +++ b/src/nefarious/tasks.py @@ -170,13 +170,19 @@ def completed_media_task(): logger_background.info('Media completed: {}'.format(media)) - # run video detection, if enabled, on the relevant video files for movies, staging_path - if nefarious_settings.enable_video_detection and isinstance(media, WatchMovie): + # get the sub path (e.g. "movies/", "tv/') so we can move the data from staging + sub_path = str( + nefarious_settings.transmission_movie_download_dir if isinstance(media, WatchMovie) + else nefarious_settings.transmission_tv_download_dir + ).lstrip('/') + + # run video detection, if enabled, on movies and tv seasons + if nefarious_settings.enable_video_detection and isinstance(media, (WatchMovie, WatchTVSeason, WatchTVEpisode)): logger_background.info("[VIDEO_DETECTION] verifying '{}'".format(media)) staging_path = os.path.join( - settings.INTERNAL_DOWNLOAD_PATH, - settings.UNPROCESSED_PATH, - nefarious_settings.transmission_movie_download_dir.lstrip('/'), + str(settings.INTERNAL_DOWNLOAD_PATH), + str(settings.UNPROCESSED_PATH), + sub_path, torrent.name, ) try: @@ -184,23 +190,17 @@ def completed_media_task(): logger_background.info("[VIDEO_DETECTION] '{}' has valid video files".format(media)) else: logger_background.error("[VIDEO_DETECTION] blacklisting '{}' because no valid video was found in {}".format(media, staging_path)) - notification.send_message('blacklisting movie {} because no valid videos found ({}: {})'.format(media, torrent.name, media.transmission_torrent_hash)) + notification.send_message('blacklisting media {} because no valid videos found ({}: {})'.format(media, torrent.name, media.transmission_torrent_hash)) blacklist_media_and_retry(media) continue except Exception as e: logger_background.exception(e) logger_background.error('error during video detection for {} with path {}'.format(media, staging_path)) - # get the sub path (ie. "movies/", "tv/') so we can move the data from staging - sub_path = ( - nefarious_settings.transmission_movie_download_dir if isinstance(media, WatchMovie) - else nefarious_settings.transmission_tv_download_dir - ).lstrip('/') - # get the path and updated name for the data new_path, new_name = get_media_new_path_and_name(media, torrent.name, len(torrent.files()) == 1) relative_path = os.path.join( - sub_path, # i.e "movies" or "tv" + sub_path, # e.g. "movies" or "tv" new_path or '', ) diff --git a/src/nefarious/video_detection.py b/src/nefarious/video_detection.py index 03fd7559..3594f07a 100644 --- a/src/nefarious/video_detection.py +++ b/src/nefarious/video_detection.py @@ -35,7 +35,7 @@ def __init__(self, video_path: str): @classmethod def has_valid_video_in_path(cls, path: str): - # TODO - this doesn't handle bundles (rar/zip/tar etc) since it won't find any "media" files + # NOTE this doesn't handle bundles (rar/zip/tar etc.) since it won't find any "media" files files_to_verify = []