From 068c723b740a08dd467eb15a451c01002fc1eead Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 23 Nov 2022 13:25:07 +0100 Subject: [PATCH] started documenting the programming interface --- pyproject.toml | 2 +- src/music_kraken.egg-info/PKG-INFO | 2 +- src/try-programming-interface.py | 61 ++++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1cd375c..bf3db03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "music_kraken" -version = "1.1.3" +version = "1.1.4" authors = [ { name="Hellow2", email="Hellow2@outlook.de" }, ] diff --git a/src/music_kraken.egg-info/PKG-INFO b/src/music_kraken.egg-info/PKG-INFO index e7089db..9d7846f 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: 1.1.3 +Version: 1.1.4 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/try-programming-interface.py b/src/try-programming-interface.py index 1883e6a..5ad528e 100644 --- a/src/try-programming-interface.py +++ b/src/try-programming-interface.py @@ -1,8 +1,61 @@ import music_kraken as mk print(mk.__path__) -mk.cli() +# if you simply wan't to run the buildin minimal cli just do this: +# mk.cli() -# mk.lyrics.fetch_lyrics() -# db = mk.utils.shared.database -# if len(db.get_custom_track([])) == 0: +# SEARCH + +""" +The whole programm takes the data it processes further from the cache, a sqlite database. +So bevore you can do anything, you will need to fill it with the songs you +wan't to download. +For now the base of everything is musicbrainz, so you need to get the +musicbrainz id and the type the id corresponds to (artist/release group/release/track). +To get this you first have to initialize a search object (music_kraken.metadata.metadata_search.Search). +""" + +search_object = mk.metadata.metadata_search.Search() + +""" +Then you need an initial "text search" to get some options you can choose from. For +this you can either specify artists releases and whatever directly with: + - Search.search_from_text(self, artist: str = None, release_group: str = None, recording: str = None) +Or you can search with a text Querry like in the default cli: + - Search.search_from_query(self, query: str) +""" + +multiple_objects = search_object.search_from_text(artist=input("input the name of the artist: ")) + +""" +both possible methods return an instance of MultipleOptions. It can just be +printed or converted to a string. +""" + +print(multiple_objects) + +""" +After the first "text search" you can either search +""" + +""" +All the data can be gotten from the temporary database / cache. +You can get the database object like this: +""" + +cache = mk.database.temp_database.temp_database +print(cache) + +""" +When fetching any song data from the cache, you will get it as Song +object (music_kraken.database.song.Song). There are multiple methods +to get different sets of Songs. The names explain the methods pretty +well: + - get_track_metadata(id: str) + - get_tracks_to_download() + - get_tracks_without_src() + - get_tracks_without_isrc() + - get_tracks_without_filepath() + +the id always is a musicbrainz id and distinct for every track +"""