Skip to content

Commit

Permalink
Merge branch 'genre-tag-filenames'
Browse files Browse the repository at this point in the history
  • Loading branch information
Evolution0 committed Sep 27, 2017
2 parents abb3230 + 905ff8c commit f5bcb49
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Options
-h --help Show this screen.
-v --version Show version.
-d --debug Verbose logging.
--artist=<artist> The artist's slug (from the URL)
--track=<track> The track's slug (from the URL)
--album=<album> The album's slug (from the URL)
--artist=<artist> The artist's slug (from the URL, --track or --album is required)
--track=<track> The track's slug (from the URL, for use with --artist)
--album=<album> The album's slug (from the URL, for use with --artist)
--template=<template> Output filename template.
[default: %{artist}/%{album}/%{track} - %{title}]
--base-dir=<dir> Base location of which all files are downloaded.
Expand Down
13 changes: 7 additions & 6 deletions bandcamp_dl/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
-h --help Show this screen.
-v --version Show version.
-d --debug Verbose logging.
--artist=<artist> The artist's slug (from the URL)
--track=<track> The track's slug (from the URL)
--album=<album> The album's slug (from the URL)
--artist=<artist> The artist's slug (from the URL, --track or --album is required)
--track=<track> The track's slug (from the URL, for use with --artist)
--album=<album> The album's slug (from the URL, for use with --artist)
--template=<template> Output filename template.
[default: %{artist}/%{album}/%{track} - %{title}]
--base-dir=<dir> Base location of which all files are downloaded.
Expand Down Expand Up @@ -67,11 +67,9 @@ def main():
basedir = arguments['--base-dir'] or os.getcwd()
session_file = "{}/{}.not.finished".format(basedir, __version__)

if os.path.isfile(session_file):
if os.path.isfile(session_file) and arguments['URL'] is None:
with open(session_file, "r") as f:
arguments = ast.literal_eval(f.readline())
elif arguments['URL'] is None and arguments['--artist'] is None:
print(__doc__)
else:
with open(session_file, "w") as f:
f.write("".join(str(arguments).split('\n')))
Expand All @@ -80,6 +78,8 @@ def main():
url = Bandcamp.generate_album_url(arguments['--artist'], arguments['--album'], "album")
elif arguments['--artist'] and arguments['--track']:
url = Bandcamp.generate_album_url(arguments['--artist'], arguments['--track'], "track")
elif arguments['--artist']:
print(__doc__)
else:
url = arguments['URL']

Expand All @@ -105,5 +105,6 @@ def main():
else:
logging.debug(" /!\ Something went horribly wrong /!\ ")


if __name__ == '__main__':
main()
5 changes: 4 additions & 1 deletion bandcamp_dl/bandcamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def get_track_metadata(track: dict or None) -> dict:
}

if 'mp3-128' in track['file']:
track_metadata['url'] = "http:" + track['file']['mp3-128']
if 'https' in track['file']['mp3-128']:
track_metadata['url'] = track['file']['mp3-128']
else:
track_metadata['url'] = "http:" + track['file']['mp3-128']
else:
track_metadata['url'] = None

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from os import path
import sys

appversion = "0.0.8-07"
appversion = "0.0.8-08"

here = path.abspath(path.dirname(__file__))

Expand Down

0 comments on commit f5bcb49

Please sign in to comment.