diff --git a/hm/scripts/rssVideos b/hm/scripts/rssVideos index 9b1401c..6cbefd3 100755 --- a/hm/scripts/rssVideos +++ b/hm/scripts/rssVideos @@ -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