Skip to content

Commit

Permalink
docs update, bump up version (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
SathyaBhat committed Sep 19, 2020
1 parent 7907ab4 commit 08ee52e
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 60 deletions.
15 changes: 15 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Credits and Thanks

spotify_dl wouldn't be what it is without the help and contributions of following people:

- [rhnvrm](https://github.com/rhnvrm) for [adding in youtube-dl](https://github.com/SathyaBhat/spotify-dl/pull/1)
- [mr-karan](https://github.com/mr-karan) for [adding save to directory](https://github.com/SathyaBhat/spotify-dl/pull/6)
- [shantanugoel](https://github.com/shantanugoel) for adding in [User playlist](https://github.com/SathyaBhat/spotify-dl/pull/7), [skip MP3 conversion](https://github.com/SathyaBhat/spotify-dl/pull/34) and [Ability to use custom format string support](https://github.com/SathyaBhat/spotify-dl/pull/34)
- [sildur](https://github.com/sildur) for adding any [user playlist support and other fixes](https://github.com/SathyaBhat/spotify-dl/pulls?q=is%3Apr+author%3Asildur+is%3Aclosed)
- [avinassh](https://github.com/avinassh) for being a [Rockstar](https://github.com/avinassh/rockstar) and not teleporting over to my house to kill me when I innundated him with questions
- [doulwyi](https://github.com/doulwyi) for adding id3 tagging and ability to parse Spotify URI
- [Gowtham](https://github.com/HackToHell) for [create playlist in download](https://github.com/SathyaBhat/spotify-dl/pull/23) directory
- [alvierahman90](https://github.com/alvierahman90) for [config file support](https://github.com/SathyaBhat/spotify-dl/pull/42) and [Spotify playlist URL support](https://github.com/SathyaBhat/spotify-dl/pull/41)
- [Bibhas](https://github.com/iambibhas) for fixing [can only concatenate list (not "str") to list error](https://github.com/SathyaBhat/spotify-dl/issues/44)
- [Nikhil Nagaraju](https://github.com/nikhilnagaraju) for fixing support for playlist url with or without userid #58
- [Luca]https://github.com/lucanello) for adding [YouTube scraping support](https://github.com/SathyaBhat/spotify-dl/pull/75)
59 changes: 59 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#### Getting start

Pre-requisite: You need Python 3.6+

1. Install using pip

pip3 install spotify_dl

2. Login to [Spotify developer console](https://developer.spotify.com/my-applications/#!/applications) and click on "Create an App". Fill in details for name and description
- Click on "Edit Settings"
- Under "Redirect URIs", enter `https://spotifydl.sathyabh.at`
- Click on "Save".

3. Make a note of Client ID and Client Secret. These values need to be then set `SPOTIPY_CLIENT_ID`, `SPOTIPY_CLIENT_SECRET` environment variables respectively. Also `SPOTIPY_REDIRECT_URI` environment variable to `https://spotifydl.sathyabh.at/`

You can set environment variables in Linux like so:

export SPOTIPY_CLIENT_ID=your-spotify-client-id
export SPOTIPY_CLIENT_SECRET=your-spotify-client-secret
export SPOTIPY_REDIRECT_URI=https://spotifydl.sathyabh.at/

Windows users, check for [this question](http://superuser.com/a/284351/4377) for details on how you can set environment variables. If you don't wish to use my URL for the redirect, you are free to use any valid URL. Just ensurethe redirect URL set as the environment variable matches with what you have entered in the developer console & in the environment variable above.

4. Create your YouTube API key & fetch the keys from [Google Developer Console](https://console.developers.google.com/apis/api/youtube/overview). Set the key as `YOUTUBE_DEV_KEY` environment variable as mentioned above. Note that as of version 5 you do not have to set this - it will fallback to scraping the YouTube page.

export YOUTUBE_DEV_KEY=youtube-dev-key

5. Run the script using `spotify_dl`. spotify_dl accepts different parameters, for more details run `spotify_dl -h`.

For most users `spotify_dl -l spotify_playlist_link -o download_directory` should do where

- `spotify_playlist_link` is a link to Spotify's playlist. You can get it from the 3-dot menu.

![image](images/spotify-playlist.png)

If the Spotify playlist link is skipped then it will download songs from your "My Music" collection

- `download_directory` is the location where the songs must be downloaded to. If you give a `.` then it will download to the current directory.

Alternatively, `spotify_dl -p playlist_id -u user_name -o download_directory` will also work

- `playlist_id` is the id of the playlist where songs need to be downloaded. If this is skipped then it will download songs ftom your "My Music" collection
- `user_name` is the user name who created the playlist.
- `download_directory` is the location where the songs must be downloaded to.
6. A first time run will require authentication; you will need to click on the URL prompted to authenticate. Once logged in, paste the URL back in.
7. To retrieve download songs as MP3, you will need to install ffmpeg. If you prefer to skip MP3 conversion, pass `-m` or `--skip_mp3` as a parameter when running the script
- Linux users can get them by installing libav-tools by using apt-get (`sudo apt-get install -y libav-tools`) or a package manager which comes with your distro
- Windows users can download FFMPEG pre-built binaries from [here](http://ffmpeg.zeranoe.com/builds/). Extract the file using [7-zip](http://7-zip.org/) to a foldrer and [add the folder to your PATH environment variable](http://www.wikihow.com/Install-FFmpeg-on-Windows)

### How do I set defaults?

You can set defaults per user by creating a file at `~/.spotify_dl_settings`. Create a key with value for every argument you want a default for. Example:
``` json
{
"output" : "/home/foo/spotify-dl-output"
, "verbose" : "true"
, "skip_mp3" : "t"
}
```
81 changes: 22 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# spotify_dl
## spotify_dl
Downloads songs from any Spotify playlist or from your "My Music" collection.

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
Expand All @@ -12,84 +12,47 @@ Downloads songs from any Spotify playlist or from your "My Music" collection.
[![Awesome Badges](https://img.shields.io/badge/badges-awesome-green.svg)](https://github.com/Naereen/badges)


# Tell me more!
I wanted an easy way to grab the songs present in my library so I can download it & use it offline(Spotify still hasn't launched here. Y U NO COME?). [spotify_to_mp3](https://github.com/frosas/spotify-to-mp3) worked well but it relied on grooveshark, which unfortunately is no more.
### Tell me more!

So I wrote this script which mimics that library, but instead of downloading from grooveshark, it provides you with a file of youtube URLs which you can then plug into [youtube-dl](https://rg3.github.io/youtube-dl/)
I wanted an easy way to grab the songs present in my library so I can download it & use it offline. [spotify_to_mp3](https://github.com/frosas/spotify-to-mp3) worked well but it relied on grooveshark, which unfortunately is no more. So I wrote this script which mimics that library, but instead of downloading from grooveshark, it searches YouTube and downloads the song using [youtube-dl](https://rg3.github.io/youtube-dl/).

### How do I get this thing running?

Pre-requisite: You need Python 3.6+
Install using pip

1. Install using pip
`sudo pip3 install spotify_dl`
(use `pip` if your distro natively provides Python 3)
pip3 install spotify_dl

2. Create your Spotify app & fetch the client id and client secret from [Spotify Developer Console](https://developer.spotify.com/my-applications/#!/applications). These keys then need to be assigned as `SPOTIPY_CLIENT_ID`, `SPOTIPY_CLIENT_SECRET` and `SPOTIPY_REDIRECT_URI` environment variables.
Run the program

You can set environment variables in Linux like so:
spotify_dl -l spotify_playlist_link -o download_directory

export SPOTIPY_CLIENT_ID='your-spotify-client-id'
export SPOTIPY_CLIENT_SECRET='your-spotify-client-secret'
export SPOTIPY_REDIRECT_URI='your-app-redirect-url'
For running in verbose mode, append `-V`

Windows users, check for [this question](http://superuser.com/a/284351/4377) for details on how you can set environment variables.
spotify_dl -V -l spotify_playlist_link -o download_directory

Note the redirect URL can be a valid URL, just ensure it matches with what you have entered in the developer console & in the environment variable above.
For more details and other arguments, issue `-h`

3. Create your YouTube API key & fetch the keys from [Google Developer Console](https://console.developers.google.com/apis/api/youtube/overview). Set the key as `YOUTUBE_DEV_KEY` environment variable as mentioned above.
4. Run the script using `spotify_dl`. spotify_dl accepts different parameters, for more details run `spotify_dl -h`.
spotify_dl -h

For most users `spotify_dl -l spotify_playlist_link -o download_directory` should do where

- `spotify_playlist_link` is a link to Spotify's playlist. You can get it from the 3-dot menu.
See [the getting started guide](/GETTING_STARTED.md) for more details.

![image](images/spotify-playlist.png)

If the Spotify playlist link is skipped then it will download songs from your "My Music" collection
- `download_directory` is the location where the songs must be downloaded to. If you give a `.` then it will download to the current directory.

Alternatively, `spotify_dl -p playlist_id -u user_name -o download_directory` will also work

- `playlist_id` is the id of the playlist where songs need to be downloaded. If this is skipped then it will download songs ftom your "My Music" collection
- `user_name` is the user name who created the playlist.
- `download_directory` is the location where the songs must be downloaded to.
5. A first time run will require authentication; you will need to click on the URL prompted to authenticate. Once logged in, paste the URL back in.
6. To retrieve download songs as MP3, you will need to install ffmpeg. If you prefer to skip MP3 conversion, pass `-m` or `--skip_mp3` as a parameter when running the script
- Linux users can get them by installing libav-tools by using apt-get (`sudo apt-get install -y libav-tools`) or a package manager which comes with your distro
- Windows users can download FFMPEG pre-built binaries from [here](http://ffmpeg.zeranoe.com/builds/). Extract the file using [7-zip](http://7-zip.org/) to a foldrer and [add the folder to your PATH environment variable](http://www.wikihow.com/Install-FFmpeg-on-Windows)

### How do I set defaults?
### Contributing and Local development

You can set defaults per user by creating a file at `~/.spotify_dl_settings`. Create a key with value for every argument you want a default for. Example:
``` json
{
"output" : "/home/foo/spotify-dl-output"
, "verbose" : "true"
, "skip_mp3" : "t"
}
```
Pull requests and any contributions are always welcome. Please open an issue with your proposal before you start with something.

### Running tests
#### Running tests

At the moment, there are barely any tests but PRs always welcome to improve this. Tests are setup and run with pytest, run

make tests

to run the tests with [Make](https://www.gnu.org/software/make/)

### Credits

- [rhnvrm](https://github.com/rhnvrm) for [adding in youtube-dl](https://github.com/SathyaBhat/spotify-dl/pull/1)
- [mr-karan](https://github.com/mr-karan) for [adding save to directory](https://github.com/SathyaBhat/spotify-dl/pull/6)
- [shantanugoel](https://github.com/shantanugoel) for adding in [User playlist](https://github.com/SathyaBhat/spotify-dl/pull/7), [skip MP3 conversion](https://github.com/SathyaBhat/spotify-dl/pull/34) and [Ability to use custom format string support](https://github.com/SathyaBhat/spotify-dl/pull/34)
- [sildur](https://github.com/sildur) for adding any [user playlist support and other fixes](https://github.com/SathyaBhat/spotify-dl/pulls?q=is%3Apr+author%3Asildur+is%3Aclosed)
- [avinassh](https://github.com/avinassh) for being a [Rockstar](https://github.com/avinassh/rockstar) and not teleporting over to my house to kill me when I innundated him with questions
- [doulwyi](https://github.com/doulwyi) for adding id3 tagging and ability to parse Spotify URI
- [Gowtham](https://github.com/HackToHell) for [create playlist in download](https://github.com/SathyaBhat/spotify-dl/pull/23) directory
- [alvierahman90](https://github.com/alvierahman90) for [config file support](https://github.com/SathyaBhat/spotify-dl/pull/42) and [Spotify playlist URL support](https://github.com/SathyaBhat/spotify-dl/pull/41)
- [Bibhas](https://github.com/iambibhas) for fixing [can only concatenate list (not "str") to list error](https://github.com/SathyaBhat/spotify-dl/issues/44)
- [Nikhil Nagaraju](https://github.com/nikhilnagaraju) for fixing support for playlist url with or without userid #58

## Issues, Feedback, Contact details
Feel free to raise any bugs/issues under Github issues. Pull requests are also more than welcome. You can reach me on twitter at [@sathyabhat](https://twitter.com/sathyabhat) or drop an email [sathya@sathyasays.com](mailto:sathya@sathyasays.com)
### Thanks and Credits

Take a look at [CONTRIBUTORS](/CONTRIBUTORS.md) for a list of all people who have helped and contributed to the project.

### Issues, Feedback, Contact details

Feel free to raise any bugs/issues under Github issues. Pull requests are also more than welcome.
2 changes: 1 addition & 1 deletion spotify_dl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
YOUTUBE_API_VERSION = "v3"
VIDEO = 'youtube#video'
YOUTUBE_VIDEO_URL = 'https://www.youtube.com/watch?v='
VERSION = '4.0.0'
VERSION = '5.0.0'
SAVE_PATH = '~/.spotifydl'

0 comments on commit 08ee52e

Please sign in to comment.