Skip to content
Snippets Groups Projects
Commit ca16dff2 authored by Christoph Stahl's avatar Christoph Stahl
Browse files

Fixed some typing errors

parent 705169a1
Branches
Tags
No related merge requests found
...@@ -63,6 +63,7 @@ mypy_path = "typings" ...@@ -63,6 +63,7 @@ mypy_path = "typings"
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = [ module = [
"yt_dlp", "yt_dlp",
"yt_dlp.utils",
"pymediainfo", "pymediainfo",
"minio", "minio",
"qrcode", "qrcode",
......
"""Module for the entry of the queue.""" """Module for the entry of the queue."""
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
...@@ -22,9 +23,9 @@ class Entry: ...@@ -22,9 +23,9 @@ class Entry:
:param duration: The duration of the song in seconds. :param duration: The duration of the song in seconds.
:type duration: int :type duration: int
:param title: The title of the song. :param title: The title of the song.
:type title: str :type title: Optional[str]
:param artist: The name of the original artist. :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 :param album: The name of the album or compilation, this particular
version is from. version is from.
:type album: str :type album: str
...@@ -51,8 +52,8 @@ class Entry: ...@@ -51,8 +52,8 @@ class Entry:
ident: str ident: str
source: str source: str
duration: int duration: int
title: str title: Optional[str]
artist: str artist: Optional[str]
album: str album: str
performer: str performer: str
failed: bool = False failed: bool = False
......
...@@ -33,6 +33,9 @@ class YouTube: ...@@ -33,6 +33,9 @@ class YouTube:
) # TODO: this may grow fast... but atm it fixed youtubes anti bot measures ) # TODO: this may grow fast... but atm it fixed youtubes anti bot measures
def __init__(self, url: Optional[str] = None): def __init__(self, url: Optional[str] = None):
self._title: Optional[str]
self._author: Optional[str]
if url is not None: if url is not None:
if url in YouTube.__cache__: if url in YouTube.__cache__:
self._infos = YouTube.__cache__[url] self._infos = YouTube.__cache__[url]
...@@ -62,11 +65,17 @@ class YouTube: ...@@ -62,11 +65,17 @@ class YouTube:
@property @property
def title(self) -> str: def title(self) -> str:
return "" if self._title is None else self._title if self._title is None:
return ""
else:
return self._title
@property @property
def author(self) -> str: def author(self) -> str:
return "" if self._author is None else self._author if self._author is None:
return ""
else:
return self._author
@classmethod @classmethod
def from_result(cls, search_result: dict[str, Any]) -> YouTube: def from_result(cls, search_result: dict[str, Any]) -> YouTube:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment