diff --git a/.idea/music-downloader.iml b/.idea/music-downloader.iml index 7a7b74c..95b8e80 100644 --- a/.idea/music-downloader.iml +++ b/.idea/music-downloader.iml @@ -4,7 +4,7 @@ - + diff --git a/src/database_structure.sql b/assets/temp_database_structure.sql similarity index 100% rename from src/database_structure.sql rename to assets/temp_database_structure.sql diff --git a/build.sh b/build.sh index 8c2e341..73f0647 100644 --- a/build.sh +++ b/build.sh @@ -1,13 +1,24 @@ # https://packaging.python.org/en/latest/tutorials/packaging-projects/ -echo "building............" +#echo "building............" +#echo "python3 -m pip install --upgrade build" +# python3 -m pip install --upgrade pip python3 -m pip install --upgrade build +#echo "python3 -m build" python3 -m build +# python3 setup.py sdist bdist_wheel +# python3 setup.py install --user +echo "python3 -m pip install dist/music_kraken-1.2.2-py3-none-any.whl --user --force-reinstall" +python3 -m pip install dist/music_kraken-1.2.2.tar.gz --user --force-reinstall + +music-kraken + +open /home/lars/.local/lib/python3.10/site-packages/music_kraken echo "uploading............" -python3 -m pip install --upgrade twine +#python3 -m pip install --upgrade twine #twine upload dist/music_kraken* -twine upload --repository testpypi dist/music_kraken* +# twine upload --repository testpypi dist/music_kraken* exit echo "pushing............" diff --git a/setup.py b/setup.py index 77402f6..bcf9ec0 100644 --- a/setup.py +++ b/setup.py @@ -34,5 +34,9 @@ setup( "beautifulsoup4~=4.11.1", "pycountry~=22.3.5" ], - entry_points={'console_scripts': ['music-kraken = music_kraken:cli']} + entry_points={'console_scripts': ['music-kraken = music_kraken:cli']}, + include_package_data=False, + data_files=[ + ('music_kraken', ['database_structure.sql']) + ] ) diff --git a/src/music_kraken.egg-info/PKG-INFO b/src/music_kraken.egg-info/PKG-INFO index 768f012..9d359d6 100644 --- a/src/music_kraken.egg-info/PKG-INFO +++ b/src/music_kraken.egg-info/PKG-INFO @@ -346,4 +346,4 @@ For the lyrics source the page [https://genius.com/](https://genius.com/) is eas [i2]: https://github.com/HeIIow2/music-downloader/issues/2 -[mb]: musicbrainz.org/ +[mb]: https://musicbrainz.org/ diff --git a/src/music_kraken.egg-info/SOURCES.txt b/src/music_kraken.egg-info/SOURCES.txt index 5e4e04e..638b139 100644 --- a/src/music_kraken.egg-info/SOURCES.txt +++ b/src/music_kraken.egg-info/SOURCES.txt @@ -1,7 +1,9 @@ LICENSE README.md +database_structure.sql pyproject.toml setup.py +assets/temp_database_structure.sql src/music_kraken/__init__.py src/music_kraken/__main__.py src/music_kraken.egg-info/PKG-INFO @@ -19,8 +21,12 @@ src/music_kraken/audio_source/sources/musify.py src/music_kraken/audio_source/sources/source.py src/music_kraken/audio_source/sources/youtube.py src/music_kraken/database/__init__.py +src/music_kraken/database/artist.py src/music_kraken/database/database.py +src/music_kraken/database/metadata.py src/music_kraken/database/song.py +src/music_kraken/database/source.py +src/music_kraken/database/target.py src/music_kraken/database/temp_database.py src/music_kraken/lyrics/__init__.py src/music_kraken/lyrics/genius.py @@ -28,6 +34,7 @@ src/music_kraken/lyrics/lyrics.py src/music_kraken/metadata/__init__.py src/music_kraken/metadata/metadata_fetch.py src/music_kraken/metadata/metadata_search.py +src/music_kraken/static_files/temp_database_structure.sql src/music_kraken/tagging/__init__.py src/music_kraken/tagging/song.py src/music_kraken/target/__init__.py diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index 28d3f1a..50736b1 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -19,6 +19,14 @@ from .utils.shared import ( from .lyrics import lyrics + +# try reading a static file: +print("TEST") +import pkgutil + +data = pkgutil.get_data(__name__, "temp_database_structure.sql") +print(data) + """ At the start I modify the garbage collector to run a bit fewer times. This should increase speed: diff --git a/src/music_kraken/database_structure.sql b/src/music_kraken/database_structure.sql new file mode 100644 index 0000000..293f428 --- /dev/null +++ b/src/music_kraken/database_structure.sql @@ -0,0 +1,66 @@ +DROP TABLE IF EXISTS artist; +CREATE TABLE artist ( + id TEXT PRIMARY KEY NOT NULL, + name TEXT +); + +DROP TABLE IF EXISTS artist_release_group; +CREATE TABLE artist_release_group ( + artist_id TEXT NOT NULL, + release_group_id TEXT NOT NULL +); + +DROP TABLE IF EXISTS artist_track; +CREATE TABLE artist_track ( + artist_id TEXT NOT NULL, + track_id TEXT NOT NULL +); + +DROP TABLE IF EXISTS release_group; +CREATE TABLE release_group ( + id TEXT PRIMARY KEY NOT NULL, + albumartist TEXT, + albumsort INT, + musicbrainz_albumtype TEXT, + compilation TEXT, + album_artist_id TEXT +); + +DROP TABLE IF EXISTS release_; +CREATE TABLE release_ ( + id TEXT PRIMARY KEY NOT NULL, + release_group_id TEXT NOT NULL, + title TEXT, + copyright TEXT, + album_status TEXT, + language TEXT, + year TEXT, + date TEXT, + country TEXT, + barcode TEXT +); + +DROP TABLE IF EXISTS track; +CREATE TABLE track ( + id TEXT PRIMARY KEY NOT NULL, + downloaded BOOLEAN NOT NULL DEFAULT 0, + release_id TEXT NOT NULL, + track TEXT, + length INT, + tracknumber TEXT, + isrc TEXT, + genre TEXT, + lyrics TEXT, + path TEXT, + file TEXT, + url TEXT, + src TEXT +); + +DROP TABLE IF EXISTS source; +CREATE TABLE source ( + track_id TEXT NOT NULL, + src TEXT NOT NULL, + url TEXT NOT NULL, + valid BOOLEAN NOT NULL DEFAULT 1 +); diff --git a/src/music_kraken/static_files/temp_database_structure.sql b/src/music_kraken/static_files/temp_database_structure.sql new file mode 100644 index 0000000..293f428 --- /dev/null +++ b/src/music_kraken/static_files/temp_database_structure.sql @@ -0,0 +1,66 @@ +DROP TABLE IF EXISTS artist; +CREATE TABLE artist ( + id TEXT PRIMARY KEY NOT NULL, + name TEXT +); + +DROP TABLE IF EXISTS artist_release_group; +CREATE TABLE artist_release_group ( + artist_id TEXT NOT NULL, + release_group_id TEXT NOT NULL +); + +DROP TABLE IF EXISTS artist_track; +CREATE TABLE artist_track ( + artist_id TEXT NOT NULL, + track_id TEXT NOT NULL +); + +DROP TABLE IF EXISTS release_group; +CREATE TABLE release_group ( + id TEXT PRIMARY KEY NOT NULL, + albumartist TEXT, + albumsort INT, + musicbrainz_albumtype TEXT, + compilation TEXT, + album_artist_id TEXT +); + +DROP TABLE IF EXISTS release_; +CREATE TABLE release_ ( + id TEXT PRIMARY KEY NOT NULL, + release_group_id TEXT NOT NULL, + title TEXT, + copyright TEXT, + album_status TEXT, + language TEXT, + year TEXT, + date TEXT, + country TEXT, + barcode TEXT +); + +DROP TABLE IF EXISTS track; +CREATE TABLE track ( + id TEXT PRIMARY KEY NOT NULL, + downloaded BOOLEAN NOT NULL DEFAULT 0, + release_id TEXT NOT NULL, + track TEXT, + length INT, + tracknumber TEXT, + isrc TEXT, + genre TEXT, + lyrics TEXT, + path TEXT, + file TEXT, + url TEXT, + src TEXT +); + +DROP TABLE IF EXISTS source; +CREATE TABLE source ( + track_id TEXT NOT NULL, + src TEXT NOT NULL, + url TEXT NOT NULL, + valid BOOLEAN NOT NULL DEFAULT 1 +);