remade changes to updated main

This commit is contained in:
el-gringo-alto 2021-10-28 11:30:50 -04:00
parent 40cb0d901f
commit 17329d8cf6
2 changed files with 50 additions and 33 deletions

View File

@ -1,14 +1,17 @@
![Stars](https://img.shields.io/github/stars/Footsiefat/zspotify.svg) ![Stars](https://img.shields.io/github/stars/Footsiefat/zspotify.svg)
![Forks](https://img.shields.io/github/forks/Footsiefat/zspotify.svg) ![Forks](https://img.shields.io/github/forks/Footsiefat/zspotify.svg)
![Size](https://img.shields.io/github/repo-size/Footsiefat/zspotify) ![Size](https://img.shields.io/github/repo-size/Footsiefat/zspotify)
# ZSpotify # ZSpotify
### A Spotify downloader needing only a python interpreter and ffmpeg. ### A Spotify downloader needing only a python interpreter and ffmpeg.
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/12180913/138040605-c9d46e45-3830-4a4b-a7ac-c56bb0d76335.png"> <img src="https://user-images.githubusercontent.com/12180913/138040605-c9d46e45-3830-4a4b-a7ac-c56bb0d76335.png">
</p> </p>
[Discord Server](https://discord.gg/skVNQKtyFq) - [Matrix Server](https://matrix.to/#/#zspotify:matrix.org) - [Gitea Mirror](https://git.robinsmediateam.dev/Footsiefat/zspotify) - [Main Site](https://footsiefat.github.io/) [Discord Server](https://discord.gg/skVNQKtyFq) - [Matrix Server](https://matrix.to/#/#zspotify:matrix.org) - [Gitea Mirror](https://git.robinsmediateam.dev/Footsiefat/zspotify) - [Main Site](https://footsiefat.github.io/)
``` ```
Requirements: Requirements:
@ -27,6 +30,9 @@ Python packages:
\*ffmpeg can be installed via apt for Debian-based distros or by downloading the binaries from [ffmpeg.org](https://ffmpeg.org) and placing them in your %PATH% in Windows. Mac users can install it with [Homebrew](https://brew.sh) by running `brew install ffmpeg`. \*ffmpeg can be installed via apt for Debian-based distros or by downloading the binaries from [ffmpeg.org](https://ffmpeg.org) and placing them in your %PATH% in Windows. Mac users can install it with [Homebrew](https://brew.sh) by running `brew install ffmpeg`.
\*\*Git can be installed via apt for Debian-based distros or by downloading the binaries from [git-scm.com](https://git-scm.com/download/win) for Windows. \*\*Git can be installed via apt for Debian-based distros or by downloading the binaries from [git-scm.com](https://git-scm.com/download/win) for Windows.
### Command line usage:
``` ```
Basic command line usage: Basic command line usage:
python zspotify <track/album/playlist/episode/artist url> Downloads the track, album, playlist or podcast episode specified as a command line argument. If an artist url is given, all albums by specified artist will be downloaded. python zspotify <track/album/playlist/episode/artist url> Downloads the track, album, playlist or podcast episode specified as a command line argument. If an artist url is given, all albums by specified artist will be downloaded.
@ -54,7 +60,9 @@ Options that can be configured in zs_config.json:
### Docker Usage ### Docker Usage
``` ```
Build the docker image from the Dockerfile: Pull the official docker image (automatically updates):
docker pull cooper7692/zspotify-docker
Or build the docker image yourself from the Dockerfile:
docker build -t zspotify . docker build -t zspotify .
Create and run a container from the image: Create and run a container from the image:
docker run --rm -v "$PWD/ZSpotify Music:/ZSpotify Music" -v "$PWD/ZSpotify Podcasts:/ZSpotify Podcasts" -it zspotify docker run --rm -v "$PWD/ZSpotify Music:/ZSpotify Music" -v "$PWD/ZSpotify Podcasts:/ZSpotify Podcasts" -it zspotify
@ -67,17 +75,23 @@ Create and run a container from the image:
**There have been 2-3 reports from users who received account bans from Spotify for using this tool**. **There have been 2-3 reports from users who received account bans from Spotify for using this tool**.
We recommend using ZSpotify with a burner account. We recommend using ZSpotify with a burner account.
Alternatively, there is a configuration option labled ```DOWNLOAD_REAL_TIME```, this limits the download speed to the duration of the song being downloaded thus not appearing suspicious to Spotify. Alternatively, there is a configuration option labled ```DOWNLOAD_REAL_TIME```, this limits the download speed to the duration of the song being downloaded thus not appearing suspicious to Spotify.
This option is much slower and is only recommended for premium users who wish to download songs in 320kbps without buying premium on a burner account. This option is much slower and is only recommended for premium users who wish to download songs in 320kbps without buying premium on a burner account.
**Use ZSpotify at your own risk**, the developers of ZSpotify are not responsible if your account gets banned. **Use ZSpotify at your own risk**, the developers of ZSpotify are not responsible if your account gets banned.
### What do I do if I see "Your session has been terminated"? ### What do I do if I see "Your session has been terminated"?
If you see this, don't worry! Just try logging back in. If you see the incorrect username or password error, reset your password and you should be able to log back in and continue using Spotify. If you see this, don't worry! Just try logging back in. If you see the incorrect username or password error, reset your password and you should be able to log back in and continue using Spotify.
### Contributing ### Contributing
Please refer to [CONTRIBUTING](CONTRIBUTING.md) Please refer to [CONTRIBUTING](CONTRIBUTING.md)
### Changelog ### Changelog
Please refer to [CHANGELOG](CHANGELOG.md) Please refer to [CHANGELOG](CHANGELOG.md)
### Common Errors
Please refer to [COMMON_ERRORS](COMMON_ERRORS.md)

View File

@ -30,7 +30,8 @@ def client(args) -> None:
ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH
if args.url: if args.url:
track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(args.url) track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(
args.url)
if track_id is not None: if track_id is not None:
download_track(track_id) download_track(track_id)
@ -57,7 +58,8 @@ def client(args) -> None:
if args.liked_songs: if args.liked_songs:
for song in get_saved_tracks(): for song in get_saved_tracks():
if not song[TRACK][NAME]: if not song[TRACK][NAME]:
print('### SKIPPING: SONG DOES NOT EXIST ON SPOTIFY ANYMORE ###') print(
'### SKIPPING: SONG DOES NOT EXIST ON SPOTIFY ANYMORE ###')
else: else:
download_track(song[TRACK][ID], 'Liked Songs/') download_track(song[TRACK][ID], 'Liked Songs/')
print('\n') print('\n')
@ -67,7 +69,8 @@ def client(args) -> None:
while len(search_text) == 0: while len(search_text) == 0:
search_text = input('Enter search or URL: ') search_text = input('Enter search or URL: ')
track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(search_text) track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(
search_text)
if track_id is not None: if track_id is not None:
download_track(track_id) download_track(track_id)
@ -117,7 +120,6 @@ def search(search_term):
raise ValueError('Invalid limit passed. Max is 50.\n') raise ValueError('Invalid limit passed. Max is 50.\n')
params['limit'] = splits[index+1] params['limit'] = splits[index+1]
if split == '-t' or split == '-type': if split == '-t' or split == '-type':
allowed_types = ['track', 'playlist', 'album', 'artist'] allowed_types = ['track', 'playlist', 'album', 'artist']
@ -151,6 +153,7 @@ def search(search_term):
counter = 1 counter = 1
dics = [] dics = []
total_tracks = 0
if TRACK in params['type'].split(','): if TRACK in params['type'].split(','):
tracks = resp[TRACKS][ITEMS] tracks = resp[TRACKS][ITEMS]
if len(tracks) > 0: if len(tracks) > 0:
@ -165,20 +168,20 @@ def search(search_term):
track_data.append([counter, f'{track[NAME]} {explicit}', track_data.append([counter, f'{track[NAME]} {explicit}',
','.join([artist[NAME] for artist in track[ARTISTS]])]) ','.join([artist[NAME] for artist in track[ARTISTS]])])
dics.append({ dics.append({
ID : track[ID], ID: track[ID],
NAME : track[NAME], NAME: track[NAME],
'type' : TRACK, 'type': TRACK,
}) })
counter += 1 counter += 1
total_tracks = counter - 1 total_tracks = counter - 1
print(tabulate(track_data, headers=['S.NO', 'Name', 'Artists'], tablefmt='pretty')) print(tabulate(track_data, headers=[
'S.NO', 'Name', 'Artists'], tablefmt='pretty'))
print('\n') print('\n')
del tracks del tracks
del track_data del track_data
else:
total_tracks = 0
total_albums = 0
if ALBUM in params['type'].split(','): if ALBUM in params['type'].split(','):
albums = resp[ALBUMS][ITEMS] albums = resp[ALBUMS][ITEMS]
if len(albums) > 0: if len(albums) > 0:
@ -188,20 +191,20 @@ def search(search_term):
album_data.append([counter, album[NAME], album_data.append([counter, album[NAME],
','.join([artist[NAME] for artist in album[ARTISTS]])]) ','.join([artist[NAME] for artist in album[ARTISTS]])])
dics.append({ dics.append({
ID : album[ID], ID: album[ID],
NAME : album[NAME], NAME: album[NAME],
'type' : ALBUM, 'type': ALBUM,
}) })
counter += 1 counter += 1
total_albums = counter - total_tracks - 1 total_albums = counter - total_tracks - 1
print(tabulate(album_data, headers=['S.NO', 'Album', 'Artists'], tablefmt='pretty')) print(tabulate(album_data, headers=[
'S.NO', 'Album', 'Artists'], tablefmt='pretty'))
print('\n') print('\n')
del albums del albums
del album_data del album_data
else:
total_albums = 0
total_artists = 0
if ARTIST in params['type'].split(','): if ARTIST in params['type'].split(','):
artists = resp[ARTISTS][ITEMS] artists = resp[ARTISTS][ITEMS]
if len(artists) > 0: if len(artists) > 0:
@ -210,39 +213,39 @@ def search(search_term):
for artist in artists: for artist in artists:
artist_data.append([counter, artist[NAME]]) artist_data.append([counter, artist[NAME]])
dics.append({ dics.append({
ID : artist[ID], ID: artist[ID],
NAME : artist[NAME], NAME: artist[NAME],
'type' : ARTIST, 'type': ARTIST,
}) })
counter += 1 counter += 1
total_artists = counter - total_tracks - total_albums - 1 total_artists = counter - total_tracks - total_albums - 1
print(tabulate(artist_data, headers=['S.NO', 'Name'], tablefmt='pretty')) print(tabulate(artist_data, headers=[
'S.NO', 'Name'], tablefmt='pretty'))
print('\n') print('\n')
del artists del artists
del artist_data del artist_data
else:
total_artists = 0
total_playlists = 0
if PLAYLIST in params['type'].split(','): if PLAYLIST in params['type'].split(','):
playlists = resp[PLAYLISTS][ITEMS] playlists = resp[PLAYLISTS][ITEMS]
if len(playlists) > 0: if len(playlists) > 0:
print('### PLAYLISTS ###') print('### PLAYLISTS ###')
playlist_data = [] playlist_data = []
for playlist in playlists: for playlist in playlists:
playlist_data.append([counter, playlist[NAME], playlist[OWNER][DISPLAY_NAME]]) playlist_data.append(
[counter, playlist[NAME], playlist[OWNER][DISPLAY_NAME]])
dics.append({ dics.append({
ID : playlist[ID], ID: playlist[ID],
NAME : playlist[NAME], NAME: playlist[NAME],
'type' : PLAYLIST, 'type': PLAYLIST,
}) })
counter += 1 counter += 1
total_playlists = counter - total_artists - total_tracks - total_albums - 1 total_playlists = counter - total_artists - total_tracks - total_albums - 1
print(tabulate(playlist_data, headers=['S.NO', 'Name', 'Owner'], tablefmt='pretty')) print(tabulate(playlist_data, headers=[
'S.NO', 'Name', 'Owner'], tablefmt='pretty'))
print('\n') print('\n')
del playlists del playlists
del playlist_data del playlist_data
else:
total_playlists = 0
if total_tracks + total_albums + total_artists + total_playlists == 0: if total_tracks + total_albums + total_artists + total_playlists == 0:
print('NO RESULTS FOUND - EXITING...') print('NO RESULTS FOUND - EXITING...')