Checks and alternative values added for singles
parent
ce27187c87
commit
fcd7526d5c
|
@ -28,10 +28,17 @@ class Bandcamp:
|
||||||
self.tracks = self.tralbum_data_json['trackinfo']
|
self.tracks = self.tralbum_data_json['trackinfo']
|
||||||
|
|
||||||
album_release = self.tralbum_data_json['album_release_date']
|
album_release = self.tralbum_data_json['album_release_date']
|
||||||
|
if album_release is None:
|
||||||
|
album_release = self.tralbum_data_json['current']['release_date']
|
||||||
|
|
||||||
|
try:
|
||||||
|
album_title = self.embed_data_json['album_title']
|
||||||
|
except KeyError:
|
||||||
|
album_title = self.tralbum_data_json['trackinfo'][0]['title']
|
||||||
|
|
||||||
album = {
|
album = {
|
||||||
"tracks": [],
|
"tracks": [],
|
||||||
"title": self.embed_data_json['album_title'],
|
"title": album_title,
|
||||||
"artist": self.embed_data_json['artist'],
|
"artist": self.embed_data_json['artist'],
|
||||||
"full": False,
|
"full": False,
|
||||||
"art": "",
|
"art": "",
|
||||||
|
|
|
@ -51,7 +51,7 @@ from .bandcampdownloader import BandcampDownloader
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
arguments = docopt(__doc__, version='bandcamp-dl 0.0.7-05')
|
arguments = docopt(__doc__, version='bandcamp-dl 0.0.7-06')
|
||||||
bandcamp = Bandcamp()
|
bandcamp = Bandcamp()
|
||||||
|
|
||||||
basedir = arguments['--base-dir'] or os.getcwd()
|
basedir = arguments['--base-dir'] or os.getcwd()
|
||||||
|
|
|
@ -24,7 +24,7 @@ class BandcampDownloader:
|
||||||
:param directory: download location
|
:param directory: download location
|
||||||
:param overwrite: if True overwrite existing files
|
:param overwrite: if True overwrite existing files
|
||||||
"""
|
"""
|
||||||
self.headers = {'user_agent': 'bandcamp-dl/0.0.7-05 (https://github.com/iheanyi/bandcamp-dl)'}
|
self.headers = {'user_agent': 'bandcamp-dl/0.0.7-06 (https://github.com/iheanyi/bandcamp-dl)'}
|
||||||
self.session = requests.Session()
|
self.session = requests.Session()
|
||||||
|
|
||||||
if type(urls) is str:
|
if type(urls) is str:
|
||||||
|
@ -60,7 +60,10 @@ class BandcampDownloader:
|
||||||
path = self.template
|
path = self.template
|
||||||
path = path.replace("%{artist}", slugify(track['artist']))
|
path = path.replace("%{artist}", slugify(track['artist']))
|
||||||
path = path.replace("%{album}", slugify(track['album']))
|
path = path.replace("%{album}", slugify(track['album']))
|
||||||
path = path.replace("%{track}", str(track['track']).zfill(2))
|
if track['track'] == "None":
|
||||||
|
path = path.replace("%{track}", "Single")
|
||||||
|
else:
|
||||||
|
path = path.replace("%{track}", str(track['track']).zfill(2))
|
||||||
path = path.replace("%{title}", slugify(track['title']))
|
path = path.replace("%{title}", slugify(track['title']))
|
||||||
path = u"{0}/{1}.{2}".format(self.directory, path, "mp3")
|
path = u"{0}/{1}.{2}".format(self.directory, path, "mp3")
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -6,7 +6,7 @@ here = path.abspath(path.dirname(__file__))
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='bandcamp-downloader',
|
name='bandcamp-downloader',
|
||||||
version='0.0.7-05',
|
version='0.0.7-06',
|
||||||
description='bandcamp-dl downloads albums and tracks from Bandcamp for you',
|
description='bandcamp-dl downloads albums and tracks from Bandcamp for you',
|
||||||
long_description=open('README.rst').read(),
|
long_description=open('README.rst').read(),
|
||||||
url='https://github.com/iheanyi/bandcamp-dl',
|
url='https://github.com/iheanyi/bandcamp-dl',
|
||||||
|
|
Loading…
Reference in New Issue