mkv bug from ffmpeg

This commit is contained in:
jbannon 2022-05-31 01:27:24 +00:00
parent 1d5992f93a
commit 12e0c5b84d

View file

@ -1,3 +1,5 @@
import os.path
from pathlib import Path
from typing import Optional from typing import Optional
from ytdl_sub.entries.entry import Entry from ytdl_sub.entries.entry import Entry
@ -9,6 +11,18 @@ class YoutubeVideo(YoutubeVideoVariables, Entry):
Entry object to represent a Youtube video. Reserved for shared Youtube entry logic. Entry object to represent a Youtube video. Reserved for shared Youtube entry logic.
""" """
@property
def ext(self) -> str:
"""
With ffmpeg installed, yt-dlp will sometimes merge the file into an mkv file.
This is not reflected in the entry. See if the mkv file exists and return "mkv" if so,
otherwise, return the original extension.
"""
mkv_file_path = str(Path(self.working_directory()) / f"{self.uid}.mkv")
if os.path.isfile(mkv_file_path):
return "mkv"
return super().ext
class YoutubePlaylistVideo(YoutubeVideo): class YoutubePlaylistVideo(YoutubeVideo):
@property @property