shutil.move fix take 2, #build

Changed:
- use shutil.copyfile for copy_function
- fixed typo
This commit is contained in:
simon 2022-07-17 07:48:54 +07:00
commit 146f17bf74
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
4 changed files with 8 additions and 8 deletions

View File

@ -395,12 +395,12 @@ class VideoDownloader:
for file_str in all_cached:
if vid_dict["youtube_id"] in file_str:
old_file = file_str
old_file_path = os.path.join(cache_dir, "download", old_file)
new_file_path = os.path.join(videos, vid_dict["media_url"])
old_path = os.path.join(cache_dir, "download", old_file)
new_path = os.path.join(videos, vid_dict["media_url"])
# move media file and fix permission
shutil.move(old_file_path, new_file_path, copy_function=shutil.copy)
shutil.move(old_path, new_path, copy_function=shutil.copyfile)
if host_uid and host_gid:
os.chown(new_file_path, host_uid, host_gid)
os.chown(new_path, host_uid, host_gid)
@staticmethod
def _delete_from_pending(youtube_id):

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, copy_function=shutil.copy)
shutil.move(video_path, dest_path, copy_function=shutil.copyfile)
else:
print(f"processing with ffmpeg: {video_file}")
new_file = video_file + ".mp4"

View File

@ -305,9 +305,9 @@ class ChannelUrlFixer:
"""fix filepath"""
print(f"{self.youtube_id}: fixing channel rename.")
cache_dir = self.config["application"]["cache_dir"]
new_file_path = os.path.join(
new_path = os.path.join(
cache_dir, "download", self.youtube_id + ".mp4"
)
shutil.move(video_path_is, new_file_path, copy_function=shutil.copy)
shutil.move(video_path_is, new_path, copy_function=shutil.copyfile)
VideoDownloader().move_to_archive(self.video.json_data)
self.video.update_media_url()

View File

@ -60,7 +60,7 @@
</div>
{% endif %}
<div class="description-box">
<h2>Costomize {{ channel_info.channel_name }}</h2>
<h2>Customize {{ channel_info.channel_name }}</h2>
</div>
<div id="overwrite-form" class="info-box">
<div class="info-box-item">