Fix: Small fixes

This commit is contained in:
flyingrub 2015-01-19 20:23:46 +01:00
parent 862ab534b9
commit ce3091c2ad
3 changed files with 19 additions and 11 deletions

View File

@ -32,8 +32,8 @@ ___
## Help ## Help
### Usage: ### Usage:
``` ```
scdl -l <track_url> [-a | -f | -t | -p][-c][-o <offset>][--hidewarnings][--addtofile] scdl -l <track_url> [-a | -f | -t | -p][-c][-o <offset>][--hidewarnings][--debug | --error][--path <path>][--addtofile][--onlymp3]
scdl me (-s | -a | -f | -t | -p)[-c][-o <offset>][--hidewarnings][--addtofile] scdl me (-s | -a | -f | -t | -p)[-c][-o <offset>][--hidewarnings][--debug | --error][--path <path>][--addtofile][--onlymp3]
scdl -h | --help scdl -h | --help
scdl --version scdl --version
``` ```

View File

@ -4,10 +4,8 @@
Usage: Usage:
scdl -l <track_url> [-a | -f | -t | -p][-c][-o <offset>]\ scdl -l <track_url> [-a | -f | -t | -p][-c][-o <offset>]\
[--hidewarnings][--debug | --error][--path <path>][--addtofile][--onlymp3] [--hidewarnings][--debug | --error][--path <path>][--addtofile][--onlymp3]
scdl me (-s | -a | -f | -t | -p)[-c][-o <offset>]\ scdl me (-s | -a | -f | -t | -p)[-c][-o <offset>]\
[--hidewarnings][--debug | --error][--path <path>][--addtofile][--onlymp3] [--hidewarnings][--debug | --error][--path <path>][--addtofile][--onlymp3]
scdl -h | --help scdl -h | --help
scdl --version scdl --version
@ -27,10 +25,14 @@ Options:
--path [path] Use a custom path for this time --path [path] Use a custom path for this time
--hidewarnings Hide Warnings. (use with precaution) --hidewarnings Hide Warnings. (use with precaution)
--addtofile Add the artist name to the filename if it isn't in the filename already --addtofile Add the artist name to the filename if it isn't in the filename already
--onlymp3 Download only the mp3 file even if the track is Downloadable
--error Only print debug information (Error/Warning)
--debug Print every information and
""" """
import __init__
from docopt import docopt from docopt import docopt
from termcolor import colored
import configparser import configparser
from scdl import __version__
import warnings import warnings
import os import os
@ -58,8 +60,13 @@ client = soundcloud.Client(client_id=scdl_client_id)
def log(str, strverbosity=1): # strverbosity (0 = Error ; 1 = Info ; 2 = Debug) def log(str, strverbosity=1): # strverbosity (0 = Error ; 1 = Info ; 2 = Debug)
global log_verbosity global log_verbosity
if log_verbosity >= strverbosity: # Error if log_verbosity >= strverbosity:
print(str) if strverbosity == 0:
print(colored(str, 'red'))
elif strverbosity == 1:
print(colored(str, 'white'))
elif strverbosity == 2:
print(colored(str, 'yellow'))
def main(): def main():
@ -75,7 +82,7 @@ def main():
get_config() get_config()
# Parse argument # Parse argument
arguments = docopt(__doc__, version=__init__.__version__) arguments = docopt(__doc__, version=__version__)
if arguments["--debug"]: if arguments["--debug"]:
log_verbosity = 2 log_verbosity = 2
@ -201,7 +208,7 @@ def who_am_i():
except: except:
log('Invalid token...', strverbosity=0) log('Invalid token...', strverbosity=0)
sys.exit(0) sys.exit(0)
log('Hello', current_user.username, '!', strverbosity=1) log('Hello' + current_user.username + '!', strverbosity=1)
log('', strverbosity=1) log('', strverbosity=1)
return current_user return current_user
@ -339,7 +346,7 @@ def download_track(track):
log('', strverbosity=1) log('', strverbosity=1)
return return
title = track.title title = track.title
title = title.encode('utf-8', 'ignore') title = title.encode('utf-8', 'ignore').decode('utf-8')
log("Downloading " + title, strverbosity=1) log("Downloading " + title, strverbosity=1)
#filename #filename

View File

@ -18,7 +18,8 @@ setup(
'docopt', 'docopt',
'soundcloud', 'soundcloud',
'wget', 'wget',
'mutagen' 'mutagen',
'termcolor'
], ],
data_files=[ data_files=[
(os.path.join(os.path.expanduser('~'), '.config/scdl'), ['config/scdl.cfg']) (os.path.join(os.path.expanduser('~'), '.config/scdl'), ['config/scdl.cfg'])