mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2024-11-29 19:24:34 +01:00
Fix typing hints
This commit is contained in:
parent
a3e27d4f2a
commit
a0bb3c3843
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
from librespot.audio.decoders import VorbisOnlyAudioQuality
|
from librespot.audio.decoders import VorbisOnlyAudioQuality
|
||||||
from librespot.metadata import EpisodeId
|
from librespot.metadata import EpisodeId
|
||||||
@ -14,7 +14,7 @@ EPISODE_INFO_URL = 'https://api.spotify.com/v1/episodes'
|
|||||||
SHOWS_URL = 'https://api.spotify.com/v1/shows'
|
SHOWS_URL = 'https://api.spotify.com/v1/shows'
|
||||||
|
|
||||||
|
|
||||||
def get_episode_info(episode_id_str) -> tuple[Optional[str], Optional[str]]:
|
def get_episode_info(episode_id_str) -> Tuple[Optional[str], Optional[str]]:
|
||||||
info = ZSpotify.invoke_url(f'{EPISODE_INFO_URL}/{episode_id_str}')
|
info = ZSpotify.invoke_url(f'{EPISODE_INFO_URL}/{episode_id_str}')
|
||||||
if ERROR in info:
|
if ERROR in info:
|
||||||
return None, None
|
return None, None
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any, Tuple, List
|
||||||
|
|
||||||
from librespot.audio.decoders import AudioQuality
|
from librespot.audio.decoders import AudioQuality
|
||||||
from librespot.metadata import TrackId
|
from librespot.metadata import TrackId
|
||||||
@ -31,7 +31,7 @@ def get_saved_tracks() -> list:
|
|||||||
return songs
|
return songs
|
||||||
|
|
||||||
|
|
||||||
def get_song_info(song_id) -> tuple[list[str], str, str, Any, Any, Any, Any, Any, Any]:
|
def get_song_info(song_id) -> Tuple[List[str], str, str, Any, Any, Any, Any, Any, Any]:
|
||||||
""" Retrieves metadata for downloaded songs """
|
""" Retrieves metadata for downloaded songs """
|
||||||
info = ZSpotify.invoke_url(f'{TRACKS_URL}?ids={song_id}&market=from_token')
|
info = ZSpotify.invoke_url(f'{TRACKS_URL}?ids={song_id}&market=from_token')
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import platform
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
import music_tag
|
import music_tag
|
||||||
import requests
|
import requests
|
||||||
@ -27,7 +28,7 @@ def wait(seconds: int = 3) -> None:
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def split_input(selection) -> list[str]:
|
def split_input(selection) -> List[str]:
|
||||||
""" Returns a list of inputted strings """
|
""" Returns a list of inputted strings """
|
||||||
inputs = []
|
inputs = []
|
||||||
if '-' in selection:
|
if '-' in selection:
|
||||||
@ -91,7 +92,7 @@ def set_music_thumbnail(filename, image_url) -> None:
|
|||||||
tags.save()
|
tags.save()
|
||||||
|
|
||||||
|
|
||||||
def regex_input_for_urls(search_input) -> tuple[str, str, str, str, str, str]:
|
def regex_input_for_urls(search_input) -> Tuple[str, str, str, str, str, str]:
|
||||||
""" Since many kinds of search may be passed at the command line, process them all here. """
|
""" Since many kinds of search may be passed at the command line, process them all here. """
|
||||||
track_uri_search = re.search(
|
track_uri_search = re.search(
|
||||||
r'^spotify:track:(?P<TrackID>[0-9a-zA-Z]{22})$', search_input)
|
r'^spotify:track:(?P<TrackID>[0-9a-zA-Z]{22})$', search_input)
|
||||||
|
Loading…
Reference in New Issue
Block a user