From f14633f3c4fa00b17e249303be012ff2c7f0e8a2 Mon Sep 17 00:00:00 2001 From: Peter M <3rror.svk@gmail.com> Date: Mon, 12 Jun 2017 16:28:52 +0200 Subject: [PATCH] Add information about environment variables in Windows (#69) --- README.md | 4 ++++ spotdl.py | 26 ++++++++++---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e6efaaa..07be5f8 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,10 @@ Shift+right-click on empty area and open cmd and type: `"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. + - python install folder: like (C:\Program Files\Python36) + - python scripts folder: like (C:\Program Files\Python36\Scripts) + ## Instructions for Downloading Songs - For all available options, run `python spotdl.py --help` (or for windows run `python.exe spotdl.py --help`). diff --git a/spotdl.py b/spotdl.py index 5ac585b..a3e09c0 100644 --- a/spotdl.py +++ b/spotdl.py @@ -168,23 +168,17 @@ def downloadSong(content): def convertWithAvconv(music_file): if os.name == 'nt': - os.system( - 'Scripts\\avconv.exe -loglevel 0 -i "' + - 'Music/' + - music_file + - '.m4a" -ab 192k "' + - 'Music/' + - music_file + - '.mp3"') + avconv_path = 'Scripts\\avconv.exe' else: - os.system( - 'avconv -loglevel 0 -i "' + - 'Music/' + - music_file + - '.m4a" -ab 192k "' + - 'Music/' + - music_file + - '.mp3"') + avconv_path = 'avconv' + os.system( + avconv_path + ' -loglevel 0 -i "' + + 'Music/' + + music_file + + '.m4a" -ab 192k "' + + 'Music/' + + music_file + + '.mp3"') os.remove('Music/' + music_file + '.m4a')