Shell identifier

This commit is contained in:
Ritiek Malhotra
2018-01-13 17:46:07 +05:30
committed by GitHub
parent 9f35471f3a
commit 66e16e4b33

View File

@@ -40,23 +40,23 @@ You can still get them back by using `old` branch though.
### Debian, Ubuntu, Linux & Mac
```
cd
git clone https://github.com/ritiek/spotify-downloader
cd spotify-downloader
pip install -U -r requirements.txt
$ cd
$ git clone https://github.com/ritiek/spotify-downloader
$ cd spotify-downloader
$ pip install -U -r requirements.txt
```
**Important:** if you have installed both Python 2 and 3, the `pip` command
could invoke an installation for Python 2. To see which Python version `pip`
refers to, try `pip -V`. If it turns out `pip` is your Python 2 pip, try
`pip3 install -U -r requirements.txt` instead.
refers to, try `$ pip -V`. If it turns out `pip` is your Python 2 pip, try
`$ pip3 install -U -r requirements.txt` instead.
You'll also need to install FFmpeg for conversion
(use `--avconv` if you'd like to use that instead):
Linux: `sudo apt-get install ffmpeg`
Linux: `$ sudo apt-get install ffmpeg`
Mac: `brew install ffmpeg --with-libmp3lame --with-libass --with-opus --with-fdk-aac`
Mac: `$ brew install ffmpeg --with-libmp3lame --with-libass --with-opus --with-fdk-aac`
If it does not install correctly, you may have to build it from source.
For more info see https://trac.ffmpeg.org/wiki/CompilationGuide.
@@ -74,17 +74,17 @@ Copy `ffmpeg.exe` from `ffmpeg-xxx-winxx-static\bin\ffmpeg.exe` to PATH
(usually C:\Windows\System32\) or just place it in the root directory extracted
from the above step.
- Open `cmd` and type `pip install -U -r requirements.txt` to install dependencies.
- Open `cmd` and type `$ pip install -U -r requirements.txt` to install dependencies.
The same note about `pip` as for Debian, Ubuntu, Linux & Mac applies.
## Instructions for Downloading Songs
**Important:** as like with `pip`, there might be no `python3` command.
**Important:** as like with `pip`, there might be no `$ python3` command.
This is most likely the case when you have only Python 3 but not 2 installed.
In this case try the `python` command instead of `python3`,
but make sure `python -V` gives you a `Python 3.x.x`!
In this case try the `$ python` command instead of `$ python3`,
but make sure `$ python -V` gives you a `Python 3.x.x`!
- For all available options, run `python3 spotdl.py --help`.
- For all available options, run `$ python3 spotdl.py --help`.
```
usage: spotdl.py [-h]
@@ -138,7 +138,7 @@ optional arguments:
For example
- We want to download Fade by Alan Walker,
simply run `python3 spotdl.py --song "alan walker fade"`.
simply run `$ python3 spotdl.py --song "alan walker fade"`.
- The script will automatically look for the best matching song and
download it in the folder `Music/` placed in the root directory of the code base.
@@ -155,7 +155,7 @@ Spotify Link this time that looks like `https://open.spotify.com/track/2lfPecqF
you can copy it from your Spotify desktop or mobile app by right clicking
or long tap on the song and copy HTTP link.
- Run `python3 spotdl.py --song https://open.spotify.com/track/2lfPecqFbH8X4lHSpTxt8l`,
- Run `$ python3 spotdl.py --song https://open.spotify.com/track/2lfPecqFbH8X4lHSpTxt8l`,
it should download Fade by Alan Walker.
- Just like before, it will again convert the song to an mp3 but since we used
@@ -185,7 +185,7 @@ elektromania sky high
https://open.spotify.com/track/0fbspWuEdaaT9vfmbAZr1C
```
- Now pass `--list=list.txt` to the script, i.e `python3 spotdl.py --list=list.txt`
- Now pass `--list=list.txt` to the script, i.e `$ python3 spotdl.py --list=list.txt`
and it will start downloading songs mentioned in `list.txt`.
- You can stop downloading songs by hitting `ctrl+c`, the script will automatically
@@ -202,11 +202,11 @@ Note: This method works for public as well as private playlists.
For example
- `python3 spotdl.py --playlist https://open.spotify.com/user/nocopyrightsounds/playlist/7sZbq8QGyMnhKPcLJvCUFD`
- `$ python3 spotdl.py --playlist https://open.spotify.com/user/nocopyrightsounds/playlist/7sZbq8QGyMnhKPcLJvCUFD`
- The script will load all the tracks from the playlist into `<playlist_name>.txt`
- Then you can simply run `python3 spotdl.py --list=<playlist_name>.txt`
- Then you can simply run `$ python3 spotdl.py --list=<playlist_name>.txt`
to download all the tracks.
#### Download by Album Link
@@ -215,11 +215,11 @@ to download all the tracks.
For example
- `python3 spotdl.py --album https://open.spotify.com/album/499J8bIsEnU7DSrosFDJJg`
- `$ python3 spotdl.py --album https://open.spotify.com/album/499J8bIsEnU7DSrosFDJJg`
- The script will load all the tracks from the album into `<album_name>.txt`
- Then you can simply run `python3 spotdl.py --list=<album_name>.txt`
- Then you can simply run `$ python3 spotdl.py --list=<album_name>.txt`
to download all the tracks.
#### Download by Username
@@ -235,13 +235,13 @@ public playlists (which excludes collaborative and private playlists).
- Once you select the one you want to download, the script will load all the tracks
from the playlist into `<playlist_name>.txt`.
- Run `python3 spotdl.py --list=<playlist_name>.txt` to download all the tracks.
- Run `$ python3 spotdl.py --list=<playlist_name>.txt` to download all the tracks.
#### Specify the Target Directory
If you don't want to download all the songs to the `Music/` folder relative to the
`spotdl.py` script, you can use the `-f`/`--folder` option.
E.g. `python3 spotdl.py -s "adele hello" -f "/home/user/Music/"`.
E.g. `$ python3 spotdl.py -s "adele hello" -f "/home/user/Music/"`.
This works with both relative and absolute paths.
#### Preserve Spaces in File Names
@@ -250,8 +250,9 @@ Beside some other characters, spaces will be replaced by underscores.
There's no option to change this behavior in spotify-downloader itself,
but on Unix-based operating systems you can issue the following bash
command after downloading is done:
find . -type f -name "*.mp3" -exec bash -c 'mv "$0" "${0//_/ }"' {} \;
```
$ find . -type f -name "*.mp3" -exec bash -c 'mv "$0" "${0//_/ }"' {} \;
```
Just make sure your working directory is the one you have the music files in.
@@ -268,17 +269,17 @@ Also note that config options are overridden by command-line arguments.
We also provide the latest docker image on [DockerHub](https://hub.docker.com/r/ritiek/spotify-downloader/).
- Pull (or update) the image with `docker pull ritiek/spotify-downloader`.
- Pull (or update) the image with `$ docker pull ritiek/spotify-downloader`.
- Run it with `docker run --rm -it -v $(pwd):/music ritiek/spotify-downloader <arguments>`.
- Run it with `$ docker run --rm -it -v $(pwd):/music ritiek/spotify-downloader <arguments>`.
- The container will download music and write tracks in your current working directory.
**Example - Downloading a Playlist**
```
docker run --rm -it -v $(pwd):/music ritiek/spotify-downloader -p https://open.spotify.com/user/nocopyrightsounds/playlist/7sZbq8QGyMnhKPcLJvCUFD
docker run --rm -it -v $(pwd):/music ritiek/spotify-downloader -l ncs-releases.txt
$ docker run --rm -it -v $(pwd):/music ritiek/spotify-downloader -p https://open.spotify.com/user/nocopyrightsounds/playlist/7sZbq8QGyMnhKPcLJvCUFD
$ docker run --rm -it -v $(pwd):/music ritiek/spotify-downloader -l ncs-releases.txt
```
### Exit Codes
@@ -297,7 +298,7 @@ Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more info.
## Running Tests
```
python3 -m pytest test
$ python3 -m pytest test
```
Obviously this requires the `pytest` module to be installed.