From 177f72b532a0472610cea059603ed573df0ade8e Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 2 Feb 2018 15:19:12 +0100 Subject: [PATCH] Prepare for releases --- .gitignore | 110 +++++++++++++++++++++++++++++++++++++++++++++-- CHANGES.md | 13 ++++++ README.md | 36 ++++++++++------ requirements.txt | 10 ----- setup.py | 53 +++++++++++++++++++++++ spotdl.py | 9 +++- 6 files changed, 202 insertions(+), 29 deletions(-) create mode 100644 CHANGES.md delete mode 100755 requirements.txt create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 39259af..a933daf 100755 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,111 @@ config.yml Music/ *.txt -.coverage - -*.pyc -__pycache__/ .cache/ +README.rst +upload.sh + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +.static_storage/ +.media/ +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv .python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..4dfaf32 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,13 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## 1.0.0-alpha.1 - 2018-02-02 +### Added +- Initial release, prepare for 1.0.0 + +[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0-alpha.1...HEAD diff --git a/README.md b/README.md index 3235d0f..644f4e4 100755 --- a/README.md +++ b/README.md @@ -38,26 +38,31 @@ If you need to use Python 2 though, check out the (old) `python2` branch. since they were not of much use and created unnecessary clutter. You can still get them back by using `old` branch though. -### Debian, Ubuntu, Linux & Mac +### Debian-like GNU/Linux & macOS ``` -$ cd -$ git clone https://github.com/ritiek/spotify-downloader -$ cd spotify-downloader -$ pip install -U -r requirements.txt +$ pip install spotify-downloader ``` **Important:** if you have installed both Python 2 and 3, the `pip` command could invoke an installation for Python 2. To see which Python version `pip` refers to, try `$ pip -V`. If it turns out `pip` is your Python 2 pip, try -`$ pip3 install -U -r requirements.txt` instead. +`$ pip3 install spotify-downloader` instead. You'll also need to install FFmpeg for conversion (use `--avconv` if you'd like to use that instead): -Linux: `$ sudo apt-get install ffmpeg` +GNU/Linux: -Mac: `$ brew install ffmpeg --with-libmp3lame --with-libass --with-opus --with-fdk-aac` +``` +$ sudo apt-get install ffmpeg +``` + +macOS: + +``` +$ brew install ffmpeg --with-libmp3lame --with-libass --with-opus --with-fdk-aac +``` If it does not install correctly, you may have to build it from source. For more info see https://trac.ffmpeg.org/wiki/CompilationGuide. @@ -65,18 +70,21 @@ For more info see https://trac.ffmpeg.org/wiki/CompilationGuide. ### Windows Assuming you have Python 3 -([preferably v3.6 or above to stay away from Unicode errors](https://stackoverflow.com/questions/30539882/whats-the-deal-with-python-3-4-unicode-different-languages-and-windows)) already installed and in PATH. - -- Download and extract the [zip file](https://github.com/ritiek/spotify-downloader/archive/master.zip) -from master branch. +([preferably v3.6 or above to stay away from Unicode errors](https://stackoverflow.com/questions/30539882/whats-the-deal-with-python-3-4-unicode-different-languages-and-windows)) and pip already installed and in PATH. - Download FFmpeg for Windows from [here](http://ffmpeg.zeranoe.com/builds/). Copy `ffmpeg.exe` from `ffmpeg-xxx-winxx-static\bin\ffmpeg.exe` to PATH (usually C:\Windows\System32\) or just place it in the root directory extracted from the above step. -- Open `cmd` and type `$ pip install -U -r requirements.txt` to install dependencies. -The same note about `pip` as for Debian, Ubuntu, Linux & Mac applies. +- Open `cmd` and type `pip install spotify-downloader`. +The same note about `pip` as for GNU/Linux and macOS applies. + +### From GitHub releases + +- Download and extract the [latest](https://github.com/ritiek/spotify-downloader/releases/latest) or a [specific](https://github.com/ritiek/spotify-downloader/releases/latest) release archive file. + +- `cd` into the directory and `python3 setup.py install` ## Instructions for Downloading Songs diff --git a/requirements.txt b/requirements.txt deleted file mode 100755 index 3927114..0000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -pathlib >= 1.0.1 -youtube_dl >= 2017.5.1 -pafy >= 0.5.3.1 -spotipy >= 2.4.4 -mutagen >= 1.37 -unicode-slugify >= 0.1.3 -titlecase >= 0.10.0 -logzero >= 1.3.1 -lyricwikia >= 0.1.8 -PyYAML >= 3.12 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a603573 --- /dev/null +++ b/setup.py @@ -0,0 +1,53 @@ +from setuptools import setup +from spotdl import __version__ + +# Created from README.md using pandoc +with open('README.rst', 'r') as f: + long_description = f.read() + +setup( + name='spotify-downloader', + py_modules=['spotdl'], + # Tests are included automatically: + # https://docs.python.org/3.6/distutils/sourcedist.html#specifying-the-files-to-distribute + packages=['core'], + version=__version__, + install_requires=[ + 'pathlib >= 1.0.1', + 'youtube_dl >= 2017.5.1', + 'pafy >= 0.5.3.1', + 'spotipy >= 2.4.4', + 'mutagen >= 1.37', + 'unicode-slugify >= 0.1.3', + 'titlecase >= 0.10.0', + 'logzero >= 1.3.1', + 'lyricwikia >= 0.1.8', + 'PyYAML >= 3.12' + ], + description='Download songs from YouTube using Spotify song URLs or playlists with albumart and meta-tags.', + long_description=long_description, + author='Ritiek Malhotra and the spotify-downloader contributors', + license='MIT', + url='https://github.com/ritiek/spotify-downloader', + download_url='https://pypi.org/project/spotify-downloader/', + keywords=['spotify', 'downloader', 'download', 'music', 'youtube', 'mp3', 'album', 'metadata'], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: End Users/Desktop', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3 :: Only', + 'Topic :: Multimedia', + 'Topic :: Multimedia :: Sound/Audio', + 'Topic :: Utilities' + ], + entry_points={ + 'console_scripts': [ + 'spotdl = spotdl:cli', + ], + } +) diff --git a/spotdl.py b/spotdl.py index f175680..8d7528a 100755 --- a/spotdl.py +++ b/spotdl.py @@ -16,6 +16,8 @@ import time import platform import pprint +__version__ = '1.0.0b1' + def check_exists(music_file, raw_song, meta_tags): """ Check if the input song already exists in the given folder. """ @@ -167,12 +169,13 @@ def download_single(raw_song, number=None): return True -if __name__ == '__main__': +def main(): const.args = handle.get_arguments() internals.filter_path(const.args.folder) const.log = const.logzero.setup_logger(formatter=const.formatter, level=const.args.log_level) + global log log = const.log log.debug('Python version: {}'.format(sys.version)) log.debug('Platform: {}'.format(platform.platform())) @@ -197,3 +200,7 @@ if __name__ == '__main__': except KeyboardInterrupt as e: log.exception(e) sys.exit(3) + + +if __name__ == '__main__': + main()