diff --git a/pyproject.toml b/pyproject.toml index 66230b0..c4d9a12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ mypy_path = "typings" [[tool.mypy.overrides]] module = [ "yt_dlp", + "yt_dlp.utils", "pymediainfo", "minio", "qrcode", diff --git a/syng/entry.py b/syng/entry.py index 88fa017..13b16db 100644 --- a/syng/entry.py +++ b/syng/entry.py @@ -1,4 +1,5 @@ """Module for the entry of the queue.""" + from __future__ import annotations from dataclasses import dataclass @@ -22,9 +23,9 @@ class Entry: :param duration: The duration of the song in seconds. :type duration: int :param title: The title of the song. - :type title: str + :type title: Optional[str] :param artist: The name of the original artist. - :type artist: str + :type artist: Optional[str] :param album: The name of the album or compilation, this particular version is from. :type album: str @@ -51,8 +52,8 @@ class Entry: ident: str source: str duration: int - title: str - artist: str + title: Optional[str] + artist: Optional[str] album: str performer: str failed: bool = False diff --git a/syng/sources/youtube.py b/syng/sources/youtube.py index 549c0f5..24060a4 100644 --- a/syng/sources/youtube.py +++ b/syng/sources/youtube.py @@ -33,6 +33,9 @@ class YouTube: ) # TODO: this may grow fast... but atm it fixed youtubes anti bot measures def __init__(self, url: Optional[str] = None): + self._title: Optional[str] + self._author: Optional[str] + if url is not None: if url in YouTube.__cache__: self._infos = YouTube.__cache__[url] @@ -62,11 +65,17 @@ class YouTube: @property def title(self) -> str: - return "" if self._title is None else self._title + if self._title is None: + return "" + else: + return self._title @property def author(self) -> str: - return "" if self._author is None else self._author + if self._author is None: + return "" + else: + return self._author @classmethod def from_result(cls, search_result: dict[str, Any]) -> YouTube: