diff --git a/.travis.yml b/.travis.yml index 863c6e8..cd69e41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ addons: - libav-tools install: - pip install -e . - - tinydownload 22684734659253158385 -o ~/bin/ffmpeg + - tinydownload 07426048687547254773 -o ~/bin/ffmpeg - chmod 755 ~/bin/ffmpeg - xdg-user-dirs-update script: python -m pytest test --cov=. diff --git a/Dockerfile b/Dockerfile index b3d06e5..2f648a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,14 @@ FROM python:3.6-alpine RUN apk add --no-cache \ ffmpeg -ADD requirements.txt /spotify-downloader/ -RUN pip install -r /spotify-downloader/requirements.txt -RUN rm /spotify-downloader/requirements.txt +ADD spotdl/ /spotify-downloader/spotdl +ADD setup.py /spotify-downloader/setup.py +ADD README.md /spotify-downloader/README.md -ADD spotdl.py /spotify-downloader/ -ADD core/ /spotify-downloader/core +WORKDIR /spotify-downloader +RUN pip install . RUN mkdir /music WORKDIR /music -ENTRYPOINT ["python3", "/spotify-downloader/spotdl.py", "-f", "/music"] +ENTRYPOINT ["spotdl", "-f", "/music"] diff --git a/core/__init__.py b/core/__init__.py deleted file mode 100755 index 8b13789..0000000 --- a/core/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/requirements.txt b/requirements.txt deleted file mode 100755 index feea406..0000000 --- a/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -pathlib >= 1.0.1 -youtube_dl >= 2017.5.1 -pafy >= 0.5.3.1 -spotipy >= 2.4.4 -mutagen >= 1.37 -beautifulsoup4 >= 4.6.0 -unicode-slugify >= 0.1.3 -titlecase >= 0.10.0 -logzero >= 1.3.1 -lyricwikia >= 0.1.8 -PyYAML >= 3.12 -appdirs >= 1.4.3 diff --git a/setup.py b/setup.py index 4c3da8c..8b31723 100644 --- a/setup.py +++ b/setup.py @@ -6,15 +6,7 @@ from setuptools import setup with open('README.md', 'r') as f: long_description = f.read() - -# This does not work as the dependencies imported are most -# likely just about to be installed :/ -# from spotdl import __version__ - -_version_re = re.compile(r'__version__\s+=\s+(.*)') - -with open('spotdl.py', 'r') as f: - version = str(ast.literal_eval(_version_re.search(f.read()).group(1))) +import spotdl setup( # 'spotify-downloader' was already taken :/ @@ -22,11 +14,11 @@ setup( 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, + packages=['spotdl'], + version=spotdl.__version__, install_requires=[ 'pathlib >= 1.0.1', - 'youtube_dl >= 2017.5.1', + 'youtube_dl >= 2017.9.8', 'pafy >= 0.5.3.1', 'spotipy >= 2.4.4', 'mutagen >= 1.37', @@ -64,7 +56,7 @@ setup( ], entry_points={ 'console_scripts': [ - 'spotdl = spotdl:main', + 'spotdl = spotdl.spotdl:main', ], } ) diff --git a/spotdl/__init__.py b/spotdl/__init__.py new file mode 100755 index 0000000..1f356cc --- /dev/null +++ b/spotdl/__init__.py @@ -0,0 +1 @@ +__version__ = '1.0.0' diff --git a/core/const.py b/spotdl/const.py similarity index 100% rename from core/const.py rename to spotdl/const.py diff --git a/core/convert.py b/spotdl/convert.py similarity index 99% rename from core/convert.py rename to spotdl/convert.py index 1e1c887..fcc25ab 100644 --- a/core/convert.py +++ b/spotdl/convert.py @@ -1,6 +1,6 @@ import subprocess import os -from core.const import log +from spotdl.const import log """What are the differences and similarities between ffmpeg, libav, and avconv? diff --git a/core/handle.py b/spotdl/handle.py similarity index 99% rename from core/handle.py rename to spotdl/handle.py index c1bed30..7e6f8b5 100644 --- a/core/handle.py +++ b/spotdl/handle.py @@ -1,5 +1,5 @@ import appdirs -from core import internals, const +from spotdl import internals, const log = const.log diff --git a/core/internals.py b/spotdl/internals.py similarity index 99% rename from core/internals.py rename to spotdl/internals.py index ed033cd..0a3092d 100755 --- a/core/internals.py +++ b/spotdl/internals.py @@ -1,7 +1,7 @@ import os import sys -from core import const +from spotdl import const log = const.log diff --git a/core/metadata.py b/spotdl/metadata.py similarity index 99% rename from core/metadata.py rename to spotdl/metadata.py index 21a40d7..edc7325 100755 --- a/core/metadata.py +++ b/spotdl/metadata.py @@ -2,7 +2,7 @@ from mutagen.easyid3 import EasyID3 from mutagen.id3 import ID3, TORY, TYER, TPUB, APIC, USLT, COMM from mutagen.mp4 import MP4, MP4Cover from mutagen.flac import Picture, FLAC -from core.const import log, TAG_PRESET, M4A_TAG_PRESET +from spotdl.const import log, TAG_PRESET, M4A_TAG_PRESET import urllib.request diff --git a/spotdl.py b/spotdl/spotdl.py similarity index 97% rename from spotdl.py rename to spotdl/spotdl.py index 2d0dcc5..20e06de 100755 --- a/spotdl.py +++ b/spotdl/spotdl.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 -*- -from core import const -from core import handle -from core import metadata -from core import convert -from core import internals -from core import spotify_tools -from core import youtube_tools +from spotdl import const +from spotdl import handle +from spotdl import metadata +from spotdl import convert +from spotdl import internals +from spotdl import spotify_tools +from spotdl import youtube_tools from slugify import slugify import spotipy import urllib.request @@ -16,8 +16,6 @@ import time import platform import pprint -__version__ = '0.9.3' - def check_exists(music_file, raw_song, meta_tags): """ Check if the input song already exists in the given folder. """ diff --git a/core/spotify_tools.py b/spotdl/spotify_tools.py similarity index 99% rename from core/spotify_tools.py rename to spotdl/spotify_tools.py index 4b5446d..1cf28a2 100644 --- a/core/spotify_tools.py +++ b/spotdl/spotify_tools.py @@ -2,8 +2,8 @@ import spotipy import spotipy.oauth2 as oauth2 import lyricwikia -from core import internals -from core.const import log +from spotdl import internals +from spotdl.const import log from slugify import slugify from titlecase import titlecase diff --git a/core/youtube_tools.py b/spotdl/youtube_tools.py similarity index 99% rename from core/youtube_tools.py rename to spotdl/youtube_tools.py index a4e75af..d0d8f88 100644 --- a/core/youtube_tools.py +++ b/spotdl/youtube_tools.py @@ -2,8 +2,8 @@ from bs4 import BeautifulSoup import urllib import pafy -from core import internals -from core import const +from spotdl import internals +from spotdl import const import os import pprint diff --git a/test/loader.py b/test/loader.py index 05bb0b7..c00f7ce 100644 --- a/test/loader.py +++ b/test/loader.py @@ -1,6 +1,6 @@ -from core import const -from core import handle -import spotdl +from spotdl import const +from spotdl import handle +from spotdl import spotdl import pytest diff --git a/test/test_dry_run.py b/test/test_dry_run.py index 7e61141..31c9d0a 100644 --- a/test/test_dry_run.py +++ b/test/test_dry_run.py @@ -1,6 +1,6 @@ -from core import const +from spotdl import const -import spotdl +from spotdl import spotdl import loader import os diff --git a/test/test_handle.py b/test/test_handle.py index 23d9437..6230a71 100644 --- a/test/test_handle.py +++ b/test/test_handle.py @@ -1,7 +1,7 @@ import yaml -from core import handle -from core import const +from spotdl import handle +from spotdl import const import pytest import os diff --git a/test/test_internals.py b/test/test_internals.py index 9fabdda..89e6380 100644 --- a/test/test_internals.py +++ b/test/test_internals.py @@ -1,4 +1,4 @@ -from core import internals +from spotdl import internals import sys import os diff --git a/test/test_list.py b/test/test_list.py index fc6bc8b..19e7bb5 100644 --- a/test/test_list.py +++ b/test/test_list.py @@ -1,7 +1,7 @@ -from core import spotify_tools -from core import const +from spotdl import spotify_tools +from spotdl import const -import spotdl +from spotdl import spotdl import builtins import os diff --git a/test/test_with_metadata.py b/test/test_with_metadata.py index b04cbc1..86e914a 100644 --- a/test/test_with_metadata.py +++ b/test/test_with_metadata.py @@ -1,12 +1,12 @@ -from core import const -from core import internals -from core import spotify_tools -from core import youtube_tools -from core import convert -from core import metadata +from spotdl import const +from spotdl import internals +from spotdl import spotify_tools +from spotdl import youtube_tools +from spotdl import convert +from spotdl import metadata -import spotdl +from spotdl import spotdl import loader import os diff --git a/test/test_without_metadata.py b/test/test_without_metadata.py index 0c73dc3..5628ebf 100644 --- a/test/test_without_metadata.py +++ b/test/test_without_metadata.py @@ -1,9 +1,9 @@ -from core import const -from core import internals -from core import spotify_tools -from core import youtube_tools +from spotdl import const +from spotdl import internals +from spotdl import spotify_tools +from spotdl import youtube_tools -import spotdl +from spotdl import spotdl import loader import os