Fixed some typing errors

This commit is contained in:
Christoph Stahl 2024-07-09 21:25:52 +02:00
parent 705169a1f7
commit ca16dff23b
3 changed files with 17 additions and 6 deletions

View file

@ -63,6 +63,7 @@ mypy_path = "typings"
[[tool.mypy.overrides]]
module = [
"yt_dlp",
"yt_dlp.utils",
"pymediainfo",
"minio",
"qrcode",

View file

@ -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

View file

@ -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: