From 9fd6f9c58b76af2fcfb7e22d6c60c755b63f9813 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 8 Aug 2022 15:57:42 +0700 Subject: [PATCH] use absolute paths for manual import --- tubearchivist/home/src/index/filesystem.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tubearchivist/home/src/index/filesystem.py b/tubearchivist/home/src/index/filesystem.py index 4d79e88b..f4ec8fed 100644 --- a/tubearchivist/home/src/index/filesystem.py +++ b/tubearchivist/home/src/index/filesystem.py @@ -191,7 +191,8 @@ class ImportFolderScanner: def get_all_files(self): """get all files in /import""" - all_files = ignore_filelist(os.listdir(self.IMPORT_DIR)) + rel_paths = ignore_filelist(os.listdir(self.IMPORT_DIR)) + all_files = [os.path.join(self.IMPORT_DIR, i) for i in rel_paths] all_files.sort() return all_files @@ -301,9 +302,8 @@ class ImportFolderScanner: if current_video["thumb"]: return - media_file = current_video["media"] - media_path = os.path.join(self.CACHE_DIR, "import", media_file) - base_name, ext = os.path.splitext(media_path) + media_path = current_video["media"] + _, ext = os.path.splitext(media_path) new_path = False if ext == ".mkv": @@ -369,8 +369,7 @@ class ImportFolderScanner: if not current_video["thumb"]: return - thumb_file = current_video["thumb"] - thumb_path = os.path.join(self.CACHE_DIR, "import", thumb_file) + thumb_path = current_video["thumb"] base_path, ext = os.path.splitext(thumb_path) if ext == ".jpg": @@ -429,9 +428,7 @@ class ImportFolderScanner: def _convert_video(self, current_video): """convert if needed""" - current_path = os.path.join( - self.CACHE_DIR, "import", current_video["media"] - ) + current_path = current_video["media"] base_path, ext = os.path.splitext(current_path) if ext == ".mp4": return