diff --git a/src/nefarious/api/views.py b/src/nefarious/api/views.py index 8656bf11..3802e6ff 100644 --- a/src/nefarious/api/views.py +++ b/src/nefarious/api/views.py @@ -244,7 +244,10 @@ def post(self, request): ) watch_media.save() download_dir = os.path.join( - transmission_session.download_dir, nefarious_settings.transmission_movie_download_dir.lstrip('/')) + transmission_session.download_dir, + settings.UNPROCESSED_PATH, + nefarious_settings.transmission_movie_download_dir.lstrip('/'), + ) result['watch_movie'] = WatchMovieSerializer(watch_media).data else: tmdb_request = tmdb.TV(tmdb_media['id']) @@ -302,7 +305,10 @@ def post(self, request): result['watch_tv_season_request'] = WatchTVSeasonRequestSerializer(watch_tv_season_request).data download_dir = os.path.join( - transmission_session.download_dir, nefarious_settings.transmission_tv_download_dir.lstrip('/')) + transmission_session.download_dir, + settings.UNPROCESSED_PATH, + nefarious_settings.transmission_tv_download_dir.lstrip('/'), + ) torrent = transmission_client.add_torrent( torrent_url, diff --git a/src/nefarious/video_detection.py b/src/nefarious/video_detection.py index 99ebccb0..03fd7559 100644 --- a/src/nefarious/video_detection.py +++ b/src/nefarious/video_detection.py @@ -22,6 +22,7 @@ class VideoDetect: read_interval: int def __init__(self, video_path: str): + logger_background.debug(f'VideoDetect: Initializing video capture {video_path}') # video capture self.video_path = video_path self.video_capture = cv2.VideoCapture(self.video_path) @@ -46,28 +47,37 @@ def has_valid_video_in_path(cls, path: str): else: # individual file files_to_verify = [path] + logger_background.info(f'[VIDEO_DETECTION] files to verify: {", ".join(files_to_verify)}') + for file_path in files_to_verify: file_extension_match = ParserBase.file_extension_regex.search(file_path) # skip sample videos if ParserBase.sample_file_regex.search(file_path): + logger_background.info(f'[VIDEO_DETECTION] skipping "sample" file for {file_path}') continue # skip files that don't have extensions if not file_extension_match: + logger_background.info(f'[VIDEO_DETECTION] skipping non-file-extension-match for {file_path}') continue file_extension = file_extension_match.group() # skip files that don't look like videos if file_extension not in video_extensions(): + logger_background.info(f'[VIDEO_DETECTION] skipping bad video_extension for {file_path}') continue detection = cls(file_path) detection.process_similarity() if not detection.is_too_similar(): return True + else: + logger_background.info(f'[VIDEO_DETECTION] too similar for {file_path}') + logger_background.warning(f'[VIDEO_DETECTION] no valid files found in {path}') return False def is_correct_length(self, expected_duration: float): return abs(self.duration - expected_duration) / expected_duration < self.MAX_VIDEO_DURATION_DIFFERENCE_RATIO def is_too_similar(self): + logger_background.info(f'[VIDEO_DETECTION] video_similarity_std {self.video_similarity_std=}, {self.MIN_VIDEO_SIMILARITY_STD=}, {self.video_path=}') return self.video_similarity_std <= self.MIN_VIDEO_SIMILARITY_STD def process_similarity(self):