added to README and hopefully fixed the authorization bug.

This commit is contained in:
Kepoor Hampond 2017-06-09 16:33:48 -07:00
parent 40ae6b3561
commit 10334d8e19
4 changed files with 13 additions and 15 deletions

View file

@ -13,7 +13,7 @@
> A music downloader that understands your metadata needs.
A tool to download your music with metadata. It uses [Spotify](https://www.spotify.com/) for finding metadata and [Youtube](https://www.youtube.com/) for the actual audio source.
A tool to download your music with metadata. It uses [Spotify](https://www.spotify.com/) for finding metadata and [Youtube](https://www.youtube.com/) for the actual audio source. You will need to have some Spotify tokens, the instructions to set them up are [here](https://github.com/kepoorhampond/irs#spotify-tokens).
Works with Python 2 and 3.
@ -74,9 +74,11 @@ Other than `ffmpeg` though, all other dependencies are automatically installed w
$ sudo pip install irs
```
## Spotify Playlists
**You will need to have some Spotify tokens, the instructions to set them up are [here](https://github.com/kepoorhampond/irs#spotify-tokens).**
To download spotify playlists, you'll want to head to their Dev Apps page, [here](https://developer.spotify.com/my-applications/). After doing that you'll want to create a new app. Name it whatever you want and then once you've done that, find the `Client ID` and `Client Secret` keys. You'll want to take those keys and paste them into your system's environment variables as `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`, correspondingly. Viola! You can now download playlists!
## Spotify Tokens
To download metadata through spotify, you'll want to head to their Dev Apps page, [here](https://developer.spotify.com/my-applications/). After doing that you'll want to create a new app. Name it whatever you want and then once you've done that, find the `Client ID` and `Client Secret` keys. You'll want to take those keys and paste them into your system's environment variables as `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`, correspondingly. Viola! You can now download metadata with IRS!
## Metadata

View file

@ -56,9 +56,9 @@ class Metadata:
mp3.save()
def find_album_and_track(song, artist):
tracks = spotipy.Spotify().search(q=song, type="track"
)["tracks"]["items"]
def find_album_and_track(song, artist, spotify=spotipy.Spotify()):
tracks = spotify.search(q=song, type="track")["tracks"]["items"]
for track in tracks:
if om.blank_include(track["name"], song):
if om.blank_include(track["artists"][0]["name"], artist):

View file

@ -324,7 +324,7 @@ with init, or in method arguments.")
return locations
def parse_song_data(self, song, artist):
album, track = find_album_and_track(song, artist)
album, track = find_album_and_track(song, artist, self.spotify)
if album is False:
return {}

View file

@ -1,9 +1,5 @@
# from irs.ripper import Ripper
from irs.ripper import Ripper
# print ("[*] Testing `song.py`")
print("Currently spotify has made it required for you to have a token to \
search through songs, so I'm skipping testing this file for Travic CI.")
# Ripper().song("Da Frame 2R", "Arctic Monkeys")
# print ("[+] Passed!")
print ("[*] Testing `song.py`")
Ripper().song("Da Frame 2R", "Arctic Monkeys")
print ("[+] Passed!")