[BUGFIX] Handle case when yt-dlp returns LazyList (#929)
Fixes https://github.com/jmbannon/ytdl-sub/issues/910 , when yt-dlp sometimes returns a non-serializable LazyList
This commit is contained in:
parent
248e9a15a6
commit
f346b0ef52
1 changed files with 7 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ from typing import Type
|
||||||
from typing import TypeVar
|
from typing import TypeVar
|
||||||
from typing import final
|
from typing import final
|
||||||
|
|
||||||
|
from yt_dlp.utils import LazyList
|
||||||
from yt_dlp.utils import sanitize_filename
|
from yt_dlp.utils import sanitize_filename
|
||||||
|
|
||||||
from ytdl_sub.entries.script.variable_definitions import VARIABLES
|
from ytdl_sub.entries.script.variable_definitions import VARIABLES
|
||||||
|
|
@ -37,6 +38,12 @@ class BaseEntry(ABC):
|
||||||
self._working_directory = working_directory
|
self._working_directory = working_directory
|
||||||
self._kwargs = entry_dict
|
self._kwargs = entry_dict
|
||||||
|
|
||||||
|
# Sometimes yt-dlp can return a LazyList which is not JSON serializable.
|
||||||
|
# Cast it to a native list here. (https://github.com/jmbannon/ytdl-sub/issues/910)
|
||||||
|
for key in self._kwargs.keys():
|
||||||
|
if isinstance(self._kwargs[key], LazyList):
|
||||||
|
self._kwargs[key] = list(self._kwargs[key])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def uid(self) -> str:
|
def uid(self) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue