mirror of
https://github.com/nathom/streamrip.git
synced 2025-06-04 08:59:47 -04:00
Misc typing
This commit is contained in:
parent
48b4da80e5
commit
f81176b3dc
8 changed files with 26 additions and 22 deletions
|
@ -374,7 +374,7 @@ class QobuzClient(Client):
|
|||
self.label = resp["user"]["credential"]["parameters"]["short_label"]
|
||||
|
||||
def _api_get_file_url(
|
||||
self, track_id: Union[str, int], quality: int = 3, sec: str = None
|
||||
self, track_id: Union[str, int], quality: int = 3, sec: Optional[str] = None
|
||||
) -> dict:
|
||||
"""Get the file url given a track id.
|
||||
|
||||
|
|
|
@ -191,3 +191,5 @@ DEEZER_BASE = "https://api.deezer.com"
|
|||
DEEZER_DL = "http://dz.loaderapp.info/deezer"
|
||||
|
||||
SOUNDCLOUD_BASE = "https://api-v2.soundcloud.com"
|
||||
|
||||
MAX_FILES_OPEN = 128
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import os
|
||||
import re
|
||||
from tempfile import gettempdir
|
||||
from typing import Callable, Dict, Iterator, List, Optional
|
||||
from typing import Callable, Dict, Iterable, List, Optional
|
||||
|
||||
import aiofiles
|
||||
import aiohttp
|
||||
|
@ -81,10 +81,10 @@ class DownloadStream:
|
|||
except json.JSONDecodeError:
|
||||
raise NonStreamable("File not found.")
|
||||
|
||||
def __iter__(self) -> Iterator:
|
||||
def __iter__(self) -> Iterable:
|
||||
"""Iterate through chunks of the stream.
|
||||
|
||||
:rtype: Iterator
|
||||
:rtype: Iterable
|
||||
"""
|
||||
if self.source == "deezer" and self.is_encrypted.search(self.url) is not None:
|
||||
assert isinstance(self.id, str), self.id
|
||||
|
@ -151,7 +151,7 @@ class DownloadPool:
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
urls: Iterator,
|
||||
urls: Iterable,
|
||||
tempdir: str = None,
|
||||
chunk_callback: Optional[Callable] = None,
|
||||
):
|
||||
|
|
|
@ -114,3 +114,7 @@ class PartialFailure(Exception):
|
|||
"""
|
||||
self.failed_items = failed_items
|
||||
super().__init__()
|
||||
|
||||
|
||||
class FfmpegError(Exception):
|
||||
"""Raise if ffmpeg returns nonzero exit code."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue