use shutil.copyfile for shutil.move calls
This commit is contained in:
parent
ed9237b69d
commit
b406250ae2
|
@ -395,12 +395,12 @@ class VideoDownloader:
|
||||||
for file_str in all_cached:
|
for file_str in all_cached:
|
||||||
if vid_dict["youtube_id"] in file_str:
|
if vid_dict["youtube_id"] in file_str:
|
||||||
old_file = file_str
|
old_file = file_str
|
||||||
old_file_path = os.path.join(cache_dir, "download", old_file)
|
old_path = os.path.join(cache_dir, "download", old_file)
|
||||||
new_file_path = os.path.join(videos, vid_dict["media_url"])
|
new_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, copy_function=shutil.copy)
|
shutil.move(old_path, new_path, copy_function=shutil.copyfile)
|
||||||
if host_uid and host_gid:
|
if host_uid and host_gid:
|
||||||
os.chown(new_file_path, host_uid, host_gid)
|
os.chown(new_path, host_uid, host_gid)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _delete_from_pending(youtube_id):
|
def _delete_from_pending(youtube_id):
|
||||||
|
|
|
@ -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, copy_function=shutil.copy)
|
shutil.move(video_path, dest_path, copy_function=shutil.copyfile)
|
||||||
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"
|
||||||
|
|
|
@ -305,9 +305,9 @@ class ChannelUrlFixer:
|
||||||
"""fix filepath"""
|
"""fix filepath"""
|
||||||
print(f"{self.youtube_id}: fixing channel rename.")
|
print(f"{self.youtube_id}: fixing channel rename.")
|
||||||
cache_dir = self.config["application"]["cache_dir"]
|
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"
|
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)
|
VideoDownloader().move_to_archive(self.video.json_data)
|
||||||
self.video.update_media_url()
|
self.video.update_media_url()
|
||||||
|
|
Loading…
Reference in New Issue