Documentation for Track¤
TrackBase defines the interface of the Track class, which is subclassing it.
artist: Artist property readonly ¤
Return the track's artist.
Returns:
| Type | Description |
|---|---|
Artist | Artist: an instance of |
genre: Optional[str] property readonly ¤
Return the track's main genre.
Returns:
| Type | Description |
|---|---|
Optional[str] | Optional[str]: the track's main genre |
genres: List[str] property readonly ¤
Return the track's genres.
Returns:
| Type | Description |
|---|---|
List[str] | List[str]: a list containing the track's genres |
url: ~AnyStr property readonly ¤
Return the track's Spotify URL.
Returns:
| Type | Description |
|---|---|
~AnyStr | AnyStr: the URL in string format |
from_url(cls, url) classmethod ¤
Return a Track given its corresponding Spotify URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url | ~AnyStr | the Spotify URL of the track | required |
Returns:
| Type | Description |
|---|---|
Track | Track: the corresponding track |
Track implements the track downloading logic.
id3_tags: Dict[str, Any] property readonly ¤
Recover the track's ID3 tags.
Returns:
| Type | Description |
|---|---|
Dict[str, Any] | Dict[str, Any]: a dictionary containing the track's |
stream: Stream property readonly ¤
Return the audio stream corresponding to the the top search result.
Returns:
| Type | Description |
|---|---|
Stream | Stream: an audio stream of the track |
as_mp3(self, mp3_path, skip_existing=False, progress_logger=None) ¤
Download the track in .mp3 format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mp3_path | Path | where should the resulting file be stored | required |
skip_existing | Optional[bool] | whether or not to overwrite an existing file. Defaults to False. | False |
progress_logger | Optional[logging.Logger] | a logger reporting on the download progress. Defaults to None. | None |
Returns:
| Type | Description |
|---|---|
Path | Path: the download location of the |
as_mp4(self, mp4_path, skip_existing=False) ¤
Download the track in .mp4 format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mp4_path | Path | where should the resulting file be stored | required |
skip_existing | Optional[bool] | whether or not to overwrite an existing file. Defaults to False. | False |
Exceptions:
| Type | Description |
|---|---|
NotFound | if no audio stream corresponding to the track at hand is found |
Returns:
| Type | Description |
|---|---|
Path | Path: the download location of the |
download(self, mp3_path, skip_existing=False, progress_logger=None) ¤
Download the track in .mp3 format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mp3_path | Path | where should the resulting file be stored | required |
skip_existing | Optional[bool] | whether or not to overwrite an existing file. Defaults to False. | False |
progress_logger | Optional[logging.Logger] | a logger reporting on the download progress. Defaults to None. | None |
Returns:
| Type | Description |
|---|---|
Path | Path: the download location of the |
streams(self, limit=1) ¤
Yield the track's corresponding YouTube search results audio streams.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit | Optional[int] | the desired number of search result items. Defaults to 1. | 1 |
Yields
Iterator[Stream]: yields each one of the search result audio streams