From 25ae9bde607df65c628ed8e04b07d0d5c69bfb0d Mon Sep 17 00:00:00 2001 From: Froghut Date: Wed, 23 Aug 2023 18:09:27 +0200 Subject: [PATCH 1/3] allow paths to be windows paths --- app/src/series.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/series.py b/app/src/series.py index 1491053..c0a5605 100644 --- a/app/src/series.py +++ b/app/src/series.py @@ -101,7 +101,7 @@ class Show: def _get_ta_channel(self) -> TAChannel | None: """get ta channel metadata""" - channel_id: str = self.show["Path"].split("/")[-1] + channel_id: str = self.show["Path"].replace("\\","/").split("/")[-1] ta_channel: TAChannel | None = TubeArchivist().get_channel(channel_id) return ta_channel @@ -155,7 +155,7 @@ class Show: print(f"[show][{showname}] indexing {len(new_episodes)} videos") seasons_created: list[str] = [] for jf_ep in new_episodes: - youtube_id: str = os.path.basename(jf_ep["Path"]).split(".")[0] + youtube_id: str = os.path.basename(jf_ep["Path"].replace("\\","/")).split(".")[0] episode_handler = Episode(youtube_id, jf_ep["Id"]) ta_video: TAVideo = episode_handler.get_ta_video() season_folder: str | None = self.create_season(ta_video, jf_ep) From 8026ba349df8c1ca2e7eb3c80e8cedee7139e152 Mon Sep 17 00:00:00 2001 From: Froghut Date: Wed, 23 Aug 2023 18:13:31 +0200 Subject: [PATCH 2/3] more work on making windows paths work --- app/src/series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/series.py b/app/src/series.py index c0a5605..be8add0 100644 --- a/app/src/series.py +++ b/app/src/series.py @@ -186,7 +186,7 @@ class Show: return None base: str = get_config()["ta_video_path"] - channel_folder = os.path.split(os.path.split(jf_ep["Path"])[0])[-1] + channel_folder = os.path.split(os.path.split(jf_ep["Path"].replace("\\","/"))[0])[-1] season_folder = os.path.join(base, channel_folder, expected_season) os.makedirs(season_folder) self._wait_for_season(expected_season) From 51e761388053282e966a9c0749aa02cbac09815d Mon Sep 17 00:00:00 2001 From: Froghut Date: Fri, 25 Aug 2023 09:51:16 +0200 Subject: [PATCH 3/3] make linter happy ;) --- app/src/series.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/series.py b/app/src/series.py index be8add0..3843b1a 100644 --- a/app/src/series.py +++ b/app/src/series.py @@ -101,7 +101,7 @@ class Show: def _get_ta_channel(self) -> TAChannel | None: """get ta channel metadata""" - channel_id: str = self.show["Path"].replace("\\","/").split("/")[-1] + channel_id: str = self.show["Path"].replace("\\", "/").split("/")[-1] ta_channel: TAChannel | None = TubeArchivist().get_channel(channel_id) return ta_channel @@ -155,7 +155,9 @@ class Show: print(f"[show][{showname}] indexing {len(new_episodes)} videos") seasons_created: list[str] = [] for jf_ep in new_episodes: - youtube_id: str = os.path.basename(jf_ep["Path"].replace("\\","/")).split(".")[0] + youtube_id: str = os.path.basename( + jf_ep["Path"].replace("\\", "/") + ).split(".")[0] episode_handler = Episode(youtube_id, jf_ep["Id"]) ta_video: TAVideo = episode_handler.get_ta_video() season_folder: str | None = self.create_season(ta_video, jf_ep) @@ -186,7 +188,9 @@ class Show: return None base: str = get_config()["ta_video_path"] - channel_folder = os.path.split(os.path.split(jf_ep["Path"].replace("\\","/"))[0])[-1] + channel_folder = os.path.split( + os.path.split(jf_ep["Path"].replace("\\", "/"))[0] + )[-1] season_folder = os.path.join(base, channel_folder, expected_season) os.makedirs(season_folder) self._wait_for_season(expected_season)