From 64984bc1b3aedf7a40fcaaaf3f7d68e1b96e2f67 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 19 May 2023 14:49:49 +0700 Subject: [PATCH] fix chown for mig new folder --- tubearchivist/config/management/commands/ta_migpath.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tubearchivist/config/management/commands/ta_migpath.py b/tubearchivist/config/management/commands/ta_migpath.py index 6137f5b4..4d039a5d 100644 --- a/tubearchivist/config/management/commands/ta_migpath.py +++ b/tubearchivist/config/management/commands/ta_migpath.py @@ -79,7 +79,8 @@ class ChannelMigration: def __init__(self, channel): self.channel = channel - self.videos = AppConfig().config["application"]["videos"] + self.config = AppConfig().config + self.videos = self.config["application"]["videos"] self.bulk_list = [] def migrate(self): @@ -92,9 +93,13 @@ class ChannelMigration: def _create_new_folder(self): """create new channel id folder""" + host_uid = self.config["application"]["HOST_UID"] + host_gid = self.config["application"]["HOST_GID"] new_path = os.path.join(self.videos, self.channel["channel_id"]) if not os.path.exists(new_path): os.mkdir(new_path) + if host_uid and host_gid: + os.chown(new_path, host_uid, host_gid) def get_channel_videos(self): """get all videos of channel"""