Fix permission/mount issues from #268 (#270)

* make nginx run as root within the container (#268)

* move file to videos path with fallback to regular copy with no metadata copying (#268)

* use `copy_function=shutil.copy` everywhere with `shutil.move`
This commit is contained in:
p0358 2022-07-16 16:54:39 +02:00 committed by GitHub
parent 1479516689
commit 79996f6838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 6 deletions

View File

@ -54,12 +54,11 @@ RUN if [ "$INSTALL_DEBUG" ] ; then \
; fi
# make folders
RUN mkdir /cache
RUN mkdir /youtube
RUN mkdir /app
RUN mkdir /cache /youtube /app
# copy config files
COPY docker_assets/nginx.conf /etc/nginx/sites-available/default
RUN sed -i 's/^user www\-data\;$/user root\;/' /etc/nginx/nginx.conf
# copy application into container
COPY ./tubearchivist /app

View File

@ -398,7 +398,7 @@ class VideoDownloader:
old_file_path = os.path.join(cache_dir, "download", old_file)
new_file_path = os.path.join(videos, vid_dict["media_url"])
# move media file and fix permission
shutil.move(old_file_path, new_file_path)
shutil.move(old_file_path, new_file_path, copy_function=shutil.copy)
if host_uid and host_gid:
os.chown(new_file_path, host_uid, host_gid)

View File

@ -266,7 +266,7 @@ class ManualImport:
if ext == ".mp4":
new_file = video_file + ext
dest_path = os.path.join(self.CACHE_DIR, "download", new_file)
shutil.move(video_path, dest_path)
shutil.move(video_path, dest_path, copy_function=shutil.copy)
else:
print(f"processing with ffmpeg: {video_file}")
new_file = video_file + ".mp4"

View File

@ -304,6 +304,6 @@ class ChannelUrlFixer:
new_file_path = os.path.join(
cache_dir, "download", self.youtube_id + ".mp4"
)
shutil.move(video_path_is, new_file_path)
shutil.move(video_path_is, new_file_path, copy_function=shutil.copy)
VideoDownloader().move_to_archive(self.video.json_data)
self.video.update_media_url()