add extension

This commit is contained in:
Antonio J. Delgado 2024-12-28 20:14:00 +02:00
parent d544ecf12e
commit 15bf7472b6

View file

@ -173,6 +173,8 @@ class GetPeertubeVideos:
thumb_file,
video_file
)
split_filename = video_file.split('.')
file_extension = split_filename[len(split_filename)-1]
result = subprocess.run(
[
'ffmpeg',
@ -181,7 +183,7 @@ class GetPeertubeVideos:
'-map', '1',
'-map', '0',
'-c', 'copy',
'-disposition:0', 'attached_pic', f"{video_file}_with_thumb"
'-disposition:0', 'attached_pic', f"{video_file}_with_thumb.{file_extension}"
],
capture_output=True,
check=False
@ -194,7 +196,7 @@ class GetPeertubeVideos:
result.stderr
)
os.remove(video_file)
os.rename(f"{video_file}_with_thumb", video_file)
os.rename(f"{video_file}_with_thumb.{file_extension}", video_file)
def _write_downloaded_items(self):
with open(self.config['downloaded_database'], 'w', encoding='utf-8') as db_file: