mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-29 13:21:22 +00:00
Expect Python to be already in PATH (#114)
* Expect python to already be in PATH * Expect python to be in PATH * Fix special handlling of conversion on windows * Some cleaning * Update docs
This commit is contained in:
14
README.md
14
README.md
@@ -56,21 +56,17 @@ If it does not install correctly, you may have to build it from source. For more
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
Assuming you have Python already installed..
|
Assuming you have Python 3 already installed and in PATH.
|
||||||
|
|
||||||
- Download FFmpeg for Windows from [here](http://ffmpeg.zeranoe.com/builds/). Copy `ffmpeg.exe` from `ffmpeg-xxx-winxx-static\bin\ffmpeg.exe` to `Scripts` folder (in your Python's installation directory: e.g. `C:\Python36\Scripts\ffmpeg.exe`)
|
- Download and extract the [zip file](https://github.com/ritiek/spotify-downloader/archive/master.zip) from master branch.
|
||||||
|
|
||||||
- Download the [zip file](https://github.com/ritiek/spotify-downloader/archive/master.zip) of this repository and copy the folder contained in the archive into your Python's installation folder (e.g. `C:\Python36\spotify-downloader-master`).
|
- Download FFmpeg for Windows from [here](http://ffmpeg.zeranoe.com/builds/). 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 the folder from last step. Shift+right-click on empty area, open `cmd`, navigate to your Python installation directory and type:
|
- Open `cmd` and type `pip install -U -r requirements.txt` to install dependencies.
|
||||||
|
|
||||||
`"Scripts/pip.exe" install -U -r requirements.txt`
|
|
||||||
|
|
||||||
- If you do not want to naviagte to your Python folder from the command-line everytime you want to run the script, you can have your Python 'PATH' environment variables set and then you can run the script from any directory.
|
|
||||||
|
|
||||||
## Instructions for Downloading Songs
|
## Instructions for Downloading Songs
|
||||||
|
|
||||||
- For all available options, run `python spotdl.py --help` (or for Windows run `python.exe spotdl.py --help`).
|
- For all available options, run `python spotdl.py --help`.
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: spotdl.py [-h] (-s SONG | -l LIST | -p PLAYLIST | -u USERNAME) [-m]
|
usage: spotdl.py [-h] (-s SONG | -l LIST | -p PLAYLIST | -u USERNAME) [-m]
|
||||||
|
|||||||
@@ -2,6 +2,16 @@ import subprocess
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
What are the differences and similarities between ffmpeg, libav, and avconv?
|
||||||
|
https://stackoverflow.com/questions/9477115
|
||||||
|
ffmeg encoders high to lower quality
|
||||||
|
libopus > libvorbis >= libfdk_aac > aac > libmp3lame
|
||||||
|
libfdk_aac due to copyrights needs to be compiled by end user
|
||||||
|
on MacOS brew install ffmpeg --with-fdk-aac will do just that. Other OS?
|
||||||
|
https://trac.ffmpeg.org/wiki/Encode/AAC
|
||||||
|
"""
|
||||||
|
|
||||||
def song(input_song, output_song, folder, avconv=False, verbose=False):
|
def song(input_song, output_song, folder, avconv=False, verbose=False):
|
||||||
"""Do the audio format conversion."""
|
"""Do the audio format conversion."""
|
||||||
if not input_song == output_song:
|
if not input_song == output_song:
|
||||||
@@ -17,17 +27,12 @@ def song(input_song, output_song, folder, avconv=False, verbose=False):
|
|||||||
|
|
||||||
def convert_with_avconv(input_song, output_song, folder, verbose):
|
def convert_with_avconv(input_song, output_song, folder, verbose):
|
||||||
"""Convert the audio file using avconv."""
|
"""Convert the audio file using avconv."""
|
||||||
if os.name == 'nt':
|
|
||||||
avconv_path = '..\\Scripts\\avconv.exe'
|
|
||||||
else:
|
|
||||||
avconv_path = 'avconv'
|
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
level = 'debug'
|
level = 'debug'
|
||||||
else:
|
else:
|
||||||
level = '0'
|
level = '0'
|
||||||
|
|
||||||
command = [avconv_path,
|
command = ['avconv',
|
||||||
'-loglevel', level,
|
'-loglevel', level,
|
||||||
'-i', os.path.join(folder, input_song),
|
'-i', os.path.join(folder, input_song),
|
||||||
'-ab', '192k',
|
'-ab', '192k',
|
||||||
@@ -37,27 +42,11 @@ def convert_with_avconv(input_song, output_song, folder, verbose):
|
|||||||
|
|
||||||
|
|
||||||
def convert_with_ffmpeg(input_song, output_song, folder, verbose):
|
def convert_with_ffmpeg(input_song, output_song, folder, verbose):
|
||||||
"""Convert the audio file using FFMpeg.
|
"""Convert the audio file using FFmpeg."""
|
||||||
|
ffmpeg_pre = 'ffmpeg -y '
|
||||||
What are the differences and similarities between ffmpeg, libav, and avconv?
|
|
||||||
https://stackoverflow.com/questions/9477115
|
|
||||||
ffmeg encoders high to lower quality
|
|
||||||
libopus > libvorbis >= libfdk_aac > aac > libmp3lame
|
|
||||||
libfdk_aac due to copyrights needs to be compiled by end user
|
|
||||||
on MacOS brew install ffmpeg --with-fdk-aac will do just that. Other OS?
|
|
||||||
https://trac.ffmpeg.org/wiki/Encode/AAC
|
|
||||||
"""
|
|
||||||
|
|
||||||
if os.name == "nt":
|
|
||||||
ffmpeg_pre = '..\\Scripts\\ffmpeg.exe '
|
|
||||||
else:
|
|
||||||
ffmpeg_pre = 'ffmpeg '
|
|
||||||
|
|
||||||
ffmpeg_pre += '-y '
|
|
||||||
if not verbose:
|
if not verbose:
|
||||||
ffmpeg_pre += '-hide_banner -nostats -v panic '
|
ffmpeg_pre += '-hide_banner -nostats -v panic '
|
||||||
|
|
||||||
ffmpeg_params = ''
|
|
||||||
input_ext = input_song.split('.')[-1]
|
input_ext = input_song.split('.')[-1]
|
||||||
output_ext = output_song.split('.')[-1]
|
output_ext = output_song.split('.')[-1]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user