def main(): arguments = docopt(__doc__, version='bandcamp-dl 1.0') bandcamp = Bandcamp() if (arguments['--artist'] and arguments['--album']): url = Bandcamp.generate_album_url(arguments['--artist'], arguments['--album']) else: url = arguments['<url>'] album = bandcamp.parse(url) basedir = arguments['--base-dir'] or os.getcwd() if not album: print "The url {} is not a valid bandcamp page.".format(url) elif arguments['--full-album'] and not album['full']: print "Full album not available. Skipping..." else: bandcamp_downloader = BandcampDownloader(url, arguments['--template'], basedir, arguments['--overwrite']) bandcamp_downloader.start(album)
Iheanyi: Feel free to use this in any way you wish. I made this just for fun. Shout out to darkf for writing a helper function for parsing the JavaScript! """ from docopt import docopt from Bandcamp import Bandcamp from BandcampDownloader import BandcampDownloader import os if __name__ == '__main__': arguments = docopt(__doc__, version='bandcamp-dl 1.0') bandcamp = Bandcamp() if (arguments['--artist'] and arguments['--album']): url = Bandcamp.generate_album_url(arguments['--artist'], arguments['--album']) else: url = arguments['<url>'] album = bandcamp.parse(url) basedir = arguments['--base-dir'] or os.path.dirname(os.path.realpath(__file__)) if not album: print "The url {} is not a valid bandcamp page.".format(url) elif arguments['--full-album'] and not album['full']: print "Full album not availiable. Skipping.." else: bandcamp_downloader = BandcampDownloader(url, arguments['--template'], basedir, arguments['--overwrite']) bandcamp_downloader.start(album)
Shout out to darkf for writing a helper function for parsing the JavaScript! """ from docopt import docopt from Bandcamp import Bandcamp from BandcampDownloader import BandcampDownloader import os if __name__ == '__main__': arguments = docopt(__doc__, version='bandcamp-dl 1.0') bandcamp = Bandcamp() if (arguments['--artist'] and arguments['--album']): url = Bandcamp.generate_album_url(arguments['--artist'], arguments['--album']) else: url = arguments['<url>'] album = bandcamp.parse(url) basedir = arguments['--base-dir'] or os.path.dirname( os.path.realpath(__file__)) if not album: print "The url {} is not a valid bandcamp page.".format(url) elif arguments['--full-album'] and not album['full']: print "Full album not availiable. Skipping.." else: bandcamp_downloader = BandcampDownloader(url, arguments['--template'], basedir, arguments['--overwrite']) bandcamp_downloader.start(album)