From 3c88c19eb1b924fa88cfc36c6ed038ca7ee7c2c6 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 18 Oct 2023 10:13:04 +0700 Subject: [PATCH] add umask to channel folder, fix if folder already exists, #10 --- README.md | 2 -- app/src/series.py | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6198c1b..aec7e05 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,6 @@ Some ideas for why that is: - JF doesn't have the permissions to see the folder created by the extension. - You didn't mount the volumes as expected and JF is looking in the wrong place. -You might have to cleanup any leftover year folders in the channel if you have reached a `TimeoutError` before you can run it again. - ## Migration problems Due to the filesystem change between Tube Archivist v0.3.6 to v0.4.0, this will reset your YouTube videos in Jellyfin and will add them as new again. Unfortunately there is no migration path. diff --git a/app/src/series.py b/app/src/series.py index 3843b1a..0e9a7f2 100644 --- a/app/src/series.py +++ b/app/src/series.py @@ -192,7 +192,13 @@ class Show: os.path.split(jf_ep["Path"].replace("\\", "/"))[0] )[-1] season_folder = os.path.join(base, channel_folder, expected_season) - os.makedirs(season_folder) + if not os.path.exists(season_folder): + original_umask = os.umask(0) + try: + os.mkdir(season_folder, mode=0o777) + finally: + os.umask(original_umask) + self._wait_for_season(expected_season) return season_folder