2022-11-21 11:25:40 +00:00
|
|
|
import music_kraken as mk
|
|
|
|
print(mk.__path__)
|
|
|
|
|
2022-11-23 12:25:07 +00:00
|
|
|
# if you simply wan't to run the buildin minimal cli just do this:
|
|
|
|
# mk.cli()
|
2022-11-22 13:25:01 +00:00
|
|
|
|
2022-11-23 12:25:07 +00:00
|
|
|
# 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
|
|
|
|
"""
|