* 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:
parent
1479516689
commit
79996f6838
|
@ -54,12 +54,11 @@ RUN if [ "$INSTALL_DEBUG" ] ; then \
|
||||||
; fi
|
; fi
|
||||||
|
|
||||||
# make folders
|
# make folders
|
||||||
RUN mkdir /cache
|
RUN mkdir /cache /youtube /app
|
||||||
RUN mkdir /youtube
|
|
||||||
RUN mkdir /app
|
|
||||||
|
|
||||||
# copy config files
|
# copy config files
|
||||||
COPY docker_assets/nginx.conf /etc/nginx/sites-available/default
|
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 application into container
|
||||||
COPY ./tubearchivist /app
|
COPY ./tubearchivist /app
|
||||||
|
|
|
@ -398,7 +398,7 @@ class VideoDownloader:
|
||||||
old_file_path = os.path.join(cache_dir, "download", old_file)
|
old_file_path = os.path.join(cache_dir, "download", old_file)
|
||||||
new_file_path = os.path.join(videos, vid_dict["media_url"])
|
new_file_path = os.path.join(videos, vid_dict["media_url"])
|
||||||
# move media file and fix permission
|
# 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:
|
if host_uid and host_gid:
|
||||||
os.chown(new_file_path, host_uid, host_gid)
|
os.chown(new_file_path, host_uid, host_gid)
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ class ManualImport:
|
||||||
if ext == ".mp4":
|
if ext == ".mp4":
|
||||||
new_file = video_file + ext
|
new_file = video_file + ext
|
||||||
dest_path = os.path.join(self.CACHE_DIR, "download", new_file)
|
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:
|
else:
|
||||||
print(f"processing with ffmpeg: {video_file}")
|
print(f"processing with ffmpeg: {video_file}")
|
||||||
new_file = video_file + ".mp4"
|
new_file = video_file + ".mp4"
|
||||||
|
|
|
@ -304,6 +304,6 @@ class ChannelUrlFixer:
|
||||||
new_file_path = os.path.join(
|
new_file_path = os.path.join(
|
||||||
cache_dir, "download", self.youtube_id + ".mp4"
|
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)
|
VideoDownloader().move_to_archive(self.video.json_data)
|
||||||
self.video.update_media_url()
|
self.video.update_media_url()
|
||||||
|
|
Loading…
Reference in New Issue