[BUGFIX] Find ext when info.json wrong
youtube info.json sometimes say ext: mkv but download is not mkv. then ffmpeg fail because source file not exist. change ext property to find correct ext if info.json gives wrong ext.
This commit is contained in:
parent
e529674b85
commit
8b98b8602d
1 changed files with 7 additions and 4 deletions
|
|
@ -109,12 +109,15 @@ class Entry(BaseEntry, Scriptable):
|
||||||
@property
|
@property
|
||||||
def ext(self) -> str:
|
def ext(self) -> str:
|
||||||
"""
|
"""
|
||||||
With ffmpeg installed, yt-dlp will sometimes merge the file into an mkv file.
|
With ffmpeg installed, yt-dlp will sometimes merge the file into an mkv file or
|
||||||
This is not reflected in the entry. See if the mkv file exists and return "mkv" if so,
|
info.json states mkv when it is not. This is not reflected in the entry. See
|
||||||
otherwise, return the original extension.
|
if the expected file exists and return it if so, otherwise, search for present ext.
|
||||||
|
Fall back to expected ext but this will fail.
|
||||||
"""
|
"""
|
||||||
ext = self.try_get(v.ext, str) or self._kwargs[v.ext.metadata_key]
|
ext = self.try_get(v.ext, str) or self._kwargs[v.ext.metadata_key]
|
||||||
for possible_ext in [ext, "mkv"]:
|
for possible_ext in [
|
||||||
|
ext,
|
||||||
|
] + list(VIDEO_CODEC_EXTS):
|
||||||
file_name = self.base_filename(ext=possible_ext)
|
file_name = self.base_filename(ext=possible_ext)
|
||||||
file_path = str(Path(self.working_directory()) / file_name)
|
file_path = str(Path(self.working_directory()) / file_name)
|
||||||
if os.path.isfile(file_path):
|
if os.path.isfile(file_path):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue