rssVideos: Handle corrupt metadata better
This commit is contained in:
parent
dee90d9a96
commit
6618fbee9d
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i python3
|
||||
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.configargparse python3Packages.filelock python3Packages.filelock python3Packages.requests python3Packages.yt-dlp ffmpeg
|
||||
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.configargparse python3Packages.filelock python3Packages.requests python3Packages.yt-dlp ffmpeg
|
||||
# Also needs mpv but if I put it there it's not using the configured one
|
||||
|
||||
|
||||
|
@ -189,7 +189,13 @@ class RVElement:
|
|||
def ytdl_infos(self) -> typing.Optional[dict]:
|
||||
try:
|
||||
return self.metafile_read("ytdl")
|
||||
# If the metafile doesn't exist or is corrupted
|
||||
except (FileNotFoundError, TypeError, AttributeError, EOFError):
|
||||
# Delete file otherwise __str__ won't be happy
|
||||
metafile = self.metafile("ytdl")
|
||||
if os.path.isfile(metafile):
|
||||
os.unlink(metafile)
|
||||
|
||||
infos = self._ytdl_infos()
|
||||
self.metafile_write("ytdl", infos)
|
||||
return infos
|
||||
|
|
Loading…
Reference in a new issue