diff --git a/build.sh b/build.sh index a651065..300363b 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,15 @@ +# https://packaging.python.org/en/latest/tutorials/packaging-projects/ +echo "building............" +python3 -m pip install --upgrade build +python3 -m build + +echo "uploading............" +python3 -m pip install --upgrade twine +# twine upload dist/music_kraken* +twine upload --repository testpypi dist/music_kraken* + +exit + echo "pushing............" git add . git commit -am "new build and upload" @@ -8,13 +20,3 @@ mkdir -p dist/build_files mkdir -p dist/compiled pyinstaller --onefile src/music_kraken_cli.py --specpath dist/build_files --workpath dist/build_files --distpath dist/compiled - -# https://packaging.python.org/en/latest/tutorials/packaging-projects/ -echo "building............" -python3 -m pip install --upgrade build -python3 -m build - -echo "uploading............" -python3 -m pip install --upgrade twine -twine upload dist/music_kraken* -# twine upload --repository testpypi dist/* diff --git a/dist/music_kraken-0.0.5-py3-none-any.whl b/dist/music_kraken-0.0.5-py3-none-any.whl deleted file mode 100644 index e2632f9..0000000 Binary files a/dist/music_kraken-0.0.5-py3-none-any.whl and /dev/null differ diff --git a/dist/music_kraken-0.0.5.tar.gz b/dist/music_kraken-0.0.5.tar.gz deleted file mode 100644 index d0ab49c..0000000 Binary files a/dist/music_kraken-0.0.5.tar.gz and /dev/null differ diff --git a/dist/music_kraken-0.0.6-py3-none-any.whl b/dist/music_kraken-0.0.6-py3-none-any.whl deleted file mode 100644 index d79f9b2..0000000 Binary files a/dist/music_kraken-0.0.6-py3-none-any.whl and /dev/null differ diff --git a/dist/music_kraken-0.0.6.tar.gz b/dist/music_kraken-0.0.6.tar.gz deleted file mode 100644 index 1fd9fb9..0000000 Binary files a/dist/music_kraken-0.0.6.tar.gz and /dev/null differ diff --git a/pyproject.toml b/pyproject.toml index 4fc72c1..8eda2f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "music_kraken" -version = "0.0.8" +version = "1.0.0" authors = [ { name="Hellow2", email="Hellow2@outlook.de" }, ] diff --git a/setup.py b/setup.py index 8d96e6a..e960b4b 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,11 @@ -from distutils.core import setup +try: + from setuptools import setup, Command, find_packages + setuptools_available = True +except ImportError: + from distutils.core import setup, Command, find_packages + setuptools_available = False + +# packages=['music_kraken'], setup( name='music-kraken', @@ -8,7 +15,17 @@ setup( author='Hellow2', author_email='Hellow2@outlook.de', url='https://github.com/HeIIow2/music-downloader', - packages=['music_kraken'], + packages=find_packages(where="src"), package_dir={'': 'src'}, - install_requires=["requests~=2.28.1", "mutagen~=1.46.0", "musicbrainzngs~=0.7.1", "jellyfish~=0.9.0", "pydub~=0.25.1", "youtube_dl", "beautifulsoup4~=4.11.1", "pycountry~=22.3.5"] + install_requires=[ + "requests~=2.28.1", + "mutagen~=1.46.0", + "musicbrainzngs~=0.7.1", + "jellyfish~=0.9.0", + "pydub~=0.25.1", + "youtube_dl", + "beautifulsoup4~=4.11.1", + "pycountry~=22.3.5" + ], + entry_points={'console_scripts': ['music-kraken = music_kraken:cli']} ) diff --git a/src/music_kraken.egg-info/PKG-INFO b/src/music_kraken.egg-info/PKG-INFO index 3adc3b3..af99a35 100644 --- a/src/music_kraken.egg-info/PKG-INFO +++ b/src/music_kraken.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: music-kraken -Version: 0.0.8 +Version: 0.0.13 Summary: An extensive music downloader crawling the internet. It gets its metadata from a couple metadata provider, and it scrapes the audiofiles. Home-page: https://github.com/HeIIow2/music-downloader Author: Hellow2 diff --git a/src/music_kraken.egg-info/SOURCES.txt b/src/music_kraken.egg-info/SOURCES.txt index ed469b1..37d32f3 100644 --- a/src/music_kraken.egg-info/SOURCES.txt +++ b/src/music_kraken.egg-info/SOURCES.txt @@ -10,5 +10,25 @@ src/music_kraken/url_to_path.py src/music_kraken.egg-info/PKG-INFO src/music_kraken.egg-info/SOURCES.txt src/music_kraken.egg-info/dependency_links.txt +src/music_kraken.egg-info/entry_points.txt src/music_kraken.egg-info/requires.txt -src/music_kraken.egg-info/top_level.txt \ No newline at end of file +src/music_kraken.egg-info/top_level.txt +src/music_kraken/audio/__init__.py +src/music_kraken/audio/song.py +src/music_kraken/lyrics/__init__.py +src/music_kraken/lyrics/genius.py +src/music_kraken/lyrics/lyrics.py +src/music_kraken/metadata/__init__.py +src/music_kraken/metadata/database.py +src/music_kraken/metadata/download.py +src/music_kraken/metadata/object_handeling.py +src/music_kraken/metadata/search.py +src/music_kraken/scraping/__init__.py +src/music_kraken/scraping/file_system.py +src/music_kraken/scraping/musify.py +src/music_kraken/scraping/phonetic_compares.py +src/music_kraken/scraping/youtube_music.py +src/music_kraken/utils/__init__.py +src/music_kraken/utils/object_handeling.py +src/music_kraken/utils/phonetic_compares.py +src/music_kraken/utils/shared.py \ No newline at end of file diff --git a/src/music_kraken.egg-info/entry_points.txt b/src/music_kraken.egg-info/entry_points.txt new file mode 100644 index 0000000..d4e1b60 --- /dev/null +++ b/src/music_kraken.egg-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +music-kraken = music_kraken:cli diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index e69de29..fdec7ce 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -0,0 +1,106 @@ +from .utils.shared import * + +from .metadata.download import MetadataDownloader +from .metadata import download +from .metadata import search as s +from . import download_links +from . import url_to_path +from . import download + +# NEEDS REFACTORING +from .lyrics.lyrics import fetch_lyrics + +import logging +import os + +# configure logger default +logging.basicConfig( + level=logging.INFO, + format="%(asctime)s [%(levelname)s] %(message)s", + handlers=[ + logging.FileHandler(os.path.join(temp_dir, LOG_FILE)), + logging.StreamHandler() + ] +) + + +def get_existing_genre(): + valid_directories = [] + for elem in os.listdir(MUSIC_DIR): + if elem not in NOT_A_GENRE: + valid_directories.append(elem) + + return valid_directories + + +def search_for_metadata(): + search = s.Search() + + while True: + input_ = input( + "q to quit, .. for previous options, int for this element, str to search for query, ok to download\n") + input_.strip() + if input_.lower() == "ok": + break + if input_.lower() == "q": + break + if input_.lower() == "..": + print() + print(search.get_previous_options()) + continue + if input_.isdigit(): + print() + print(search.choose(int(input_))) + continue + print() + print(search.search_from_query(input_)) + + print(search.current_option) + return search.current_option + + +def get_genre(): + existing_genres = get_existing_genre() + print("printing available genres:") + for i, genre_option in enumerate(existing_genres): + print(f"{i}: {genre_option}") + + genre = input("Input the ID for an existing genre or text for a new one: ") + + if genre.isdigit(): + genre_id = int(genre) + if genre_id >= len(existing_genres): + logging.warning("An invalid genre id has been given") + return get_genre() + return existing_genres[genre_id] + + return genre + + +def cli(start_at: int = 0, only_lyrics: bool = False): + if start_at <= 2 and not only_lyrics: + genre = get_genre() + logging.info(f"{genre} has been set as genre.") + + if start_at <= 0: + search = search_for_metadata() + # search = metadata.search.Option("release", "f8d4b24d-2c46-4e9c-8078-0c0f337c84dd", "Beautyfall") + logging.info("Starting Downloading of metadata") + metadata_downloader = MetadataDownloader() + metadata_downloader.download({'type': search.type, 'id': search.id}) + + if start_at <= 1 and not only_lyrics: + logging.info("creating Paths") + url_to_path.UrlPath(genre=genre) + + if start_at <= 2 and not only_lyrics: + logging.info("Fetching Download Links") + download_links.Download() + + if start_at <= 3 and not only_lyrics: + logging.info("starting to download the mp3's") + download.Download() + + if start_at <= 4: + logging.info("starting to fetch the lyrics") + fetch_lyrics() \ No newline at end of file diff --git a/src/music_kraken/__main__.py b/src/music_kraken/__main__.py index 53425d9..14c1772 100644 --- a/src/music_kraken/__main__.py +++ b/src/music_kraken/__main__.py @@ -1,110 +1,5 @@ -from .utils.shared import * - -from .metadata.download import MetadataDownloader -from .metadata import download -from .metadata import search as s -from . import download_links -from . import url_to_path -from . import download - -# NEEDS REFACTORING -from .lyrics.lyrics import fetch_lyrics - -import logging -import os - -# configure logger default -logging.basicConfig( - level=logging.INFO, - format="%(asctime)s [%(levelname)s] %(message)s", - handlers=[ - logging.FileHandler(os.path.join(temp_dir, LOG_FILE)), - logging.StreamHandler() - ] -) - - -def get_existing_genre(): - valid_directories = [] - for elem in os.listdir(MUSIC_DIR): - if elem not in NOT_A_GENRE: - valid_directories.append(elem) - - return valid_directories - - -def search_for_metadata(): - search = s.Search() - - while True: - input_ = input( - "q to quit, .. for previous options, int for this element, str to search for query, ok to download\n") - input_.strip() - if input_.lower() == "ok": - break - if input_.lower() == "q": - break - if input_.lower() == "..": - print() - print(search.get_previous_options()) - continue - if input_.isdigit(): - print() - print(search.choose(int(input_))) - continue - print() - print(search.search_from_query(input_)) - - print(search.current_option) - return search.current_option - - -def get_genre(): - existing_genres = get_existing_genre() - print("printing available genres:") - for i, genre_option in enumerate(existing_genres): - print(f"{i}: {genre_option}") - - genre = input("Input the ID for an existing genre or text for a new one: ") - - if genre.isdigit(): - genre_id = int(genre) - if genre_id >= len(existing_genres): - logging.warning("An invalid genre id has been given") - return get_genre() - return existing_genres[genre_id] - - return genre - - -def cli(start_at: int = 0, only_lyrics: bool = False): - if start_at <= 2 and not only_lyrics: - genre = get_genre() - logging.info(f"{genre} has been set as genre.") - - if start_at <= 0: - search = search_for_metadata() - # search = metadata.search.Option("release", "f8d4b24d-2c46-4e9c-8078-0c0f337c84dd", "Beautyfall") - logging.info("Starting Downloading of metadata") - metadata_downloader = MetadataDownloader() - metadata_downloader.download({'type': search.type, 'id': search.id}) - - if start_at <= 1 and not only_lyrics: - logging.info("creating Paths") - url_to_path.UrlPath(genre=genre) - - if start_at <= 2 and not only_lyrics: - logging.info("Fetching Download Links") - download_links.Download() - - if start_at <= 3 and not only_lyrics: - logging.info("starting to download the mp3's") - download.Download() - - if start_at <= 4: - logging.info("starting to fetch the lyrics") - fetch_lyrics() +import music_kraken if __name__ == "__main__": - cli(start_at=0, only_lyrics=False) + music_kraken.cli(start_at=0, only_lyrics=False) diff --git a/src/music_kraken_cli.py b/src/music_kraken_cli.py index e075326..965a570 100644 --- a/src/music_kraken_cli.py +++ b/src/music_kraken_cli.py @@ -1,4 +1,4 @@ -from music_kraken.__main__ import cli +from music_kraken import cli if __name__ == "__main__": cli()