Skip to content

Commit

Permalink
Version specific not.finished files, etc
Browse files Browse the repository at this point in the history
`not.finished` files are now version specific, old `not.finished` files will simply not be loaded preventing any issues with feature changes that require new arguments.

Minimum Python version is now enforced properly, it should now be impossible to install (via `pip`) with an unsupported Python version.

Bandcamp-dl version is now located in setup.py only with it being added to a generated `__init__.py` during packaging or install.
  • Loading branch information
Evolution0 committed May 20, 2017
1 parent 4413ad3 commit c8680f2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Empty file removed bandcamp_dl/__init__.py
Empty file.
5 changes: 3 additions & 2 deletions bandcamp_dl/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@

from bandcamp_dl.bandcamp import Bandcamp
from bandcamp_dl.bandcampdownloader import BandcampDownloader
from bandcamp_dl.__init__ import __version__


def main():
arguments = docopt(__doc__, version='bandcamp-dl 0.0.8-1')
arguments = docopt(__doc__, version='bandcamp-dl {}'.format(__version__))

bandcamp = Bandcamp()

basedir = arguments['--base-dir'] or os.getcwd()
session_file = basedir + "/not.finished"
session_file = "{}/{}.not.finished".format(basedir, __version__)

if os.path.isfile(session_file):
with open(session_file, "r") as f:
Expand Down
3 changes: 2 additions & 1 deletion bandcamp_dl/bandcamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
from bs4 import FeatureNotFound

from bandcamp_dl.bandcampjson import BandcampJSON
from bandcamp_dl.__init__ import __version__


class Bandcamp:
def __init__(self):
self.headers = {'User-Agent': 'bandcamp-dl/0.0.8-02 (https://github.com/iheanyi/bandcamp-dl)'}
self.headers = {'User-Agent': 'bandcamp-dl/{} (https://github.com/iheanyi/bandcamp-dl)'.format(__version__)}

def parse(self, url: str, art: bool=True) -> dict or None:
"""Requests the page, cherry picks album info
Expand Down
4 changes: 3 additions & 1 deletion bandcamp_dl/bandcampdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import mock
from bandcamp_dl.utils import requests_patch

from bandcamp_dl.__init__ import __version__


class BandcampDownloader:
def __init__(self, urls=None, template=None, directory=None, overwrite=False, lyrics=None, grouping=None,
Expand All @@ -24,7 +26,7 @@ def __init__(self, urls=None, template=None, directory=None, overwrite=False, ly
:param directory: download location
:param overwrite: if True overwrite existing files
"""
self.headers = {'User-Agent': 'bandcamp-dl/0.0.8-02 (https://github.com/iheanyi/bandcamp-dl)'}
self.headers = {'User-Agent': 'bandcamp-dl/{} (https://github.com/iheanyi/bandcamp-dl)'.format(__version__)}
self.session = requests.Session()

if type(urls) is str:
Expand Down
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
from os import path
import sys

if sys.version_info[0] == 2:
sys.exit('Python 2 is unsupported.')
appversion = "0.0.8-03"
pyversion = int("{}{}".format(sys.version_info[0], sys.version_info[1]))

if not pyversion >= 34:
print('Python 3.4+ is required')
sys.exit(1)

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

with open(here + '/bandcamp_dl/__init__.py', 'w') as initpy:
initpy.write('__version__ = "{}"'.format(appversion))

setup(
name='bandcamp-downloader',
version='0.0.8-02',
version=appversion,
description='bandcamp-dl downloads albums and tracks from Bandcamp for you',
long_description=open('README.rst').read(),
url='https://github.com/iheanyi/bandcamp-dl',
Expand Down

0 comments on commit c8680f2

Please sign in to comment.