From 68031b9cdda1dadc057602674b1a2a9df002c100 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Mon, 23 Jan 2023 14:53:35 +0100 Subject: [PATCH] layed out the page structure --- notes.md | 20 +++---- src/music_kraken/database/objects/__init__.py | 5 +- src/music_kraken/pages/abstract.py | 59 +++++++++++++++++++ 3 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 src/music_kraken/pages/abstract.py diff --git a/notes.md b/notes.md index 9ce15a6..e766439 100644 --- a/notes.md +++ b/notes.md @@ -1,16 +1,3 @@ -# TO DO -- Create a super class for audio_source, from which yet to come classes like Musify or Youtube inherit. -- be able to select multiple things at once (eg "0, 3, 5, 6") and then download this selection with ok -- add the file system as audio source -- add complete search of musify (scraping of artist page etc.) as last resort -- add a check if the songs truly are the same with non changebal attributes (length etc.) -- get additional ISRCs -- add Deezer as additional source -- add a config file where you should be able to set: - - folder structure (genre/artist/release/track.mp3 eg.) - - proxies (maybe a boolean if tor should be enabled) - - toggling of audio sources and sorting priorities of audio sources - # Which "Modules" do I have ## Overview - fetching of metadata @@ -118,3 +105,10 @@ Version 2.4 of the specification prescribes that all text fields (the fields tha A frame Name is composed from 4 capital letters $XXXX$ The first letter of text frames is $TXXX$ + +--- + +# TODO + + - Add pprint to the song objects + - DOCUMENTATION diff --git a/src/music_kraken/database/objects/__init__.py b/src/music_kraken/database/objects/__init__.py index 0478582..2fdc545 100644 --- a/src/music_kraken/database/objects/__init__.py +++ b/src/music_kraken/database/objects/__init__.py @@ -1,9 +1,12 @@ from . import ( song, metadata, - source + source, + parents ) +MusicObject = parents.DatabaseObject + ID3_MAPPING = metadata.Mapping ID3Timestamp = metadata.ID3Timestamp diff --git a/src/music_kraken/pages/abstract.py b/src/music_kraken/pages/abstract.py new file mode 100644 index 0000000..9c7cd20 --- /dev/null +++ b/src/music_kraken/pages/abstract.py @@ -0,0 +1,59 @@ +from typing import ( + List +) + +from ..database import ( + Song, + Source, + Album, + Metadata, + Artist, + Lyrics, + Target, + MusicObject +) + +class Query: + def __init__(self) -> None: + pass + +class Page: + """ + This is an abstract class, laying out the + functionality for every other class fetching something + """ + + @classmethod + def search_by_query(cls, query: str) -> List[MusicObject]: + """ + # The Query + You can define a new parameter with "#", + the letter behind it defines the *type* of parameter, followed by a space + "#a Psychonaut 4 #r Tired, Numb and #t Drop by Drop" + if no # is in the query it gets treated as "unspecified query" + + # Functionality + Returns the best matches from this page for the query, passed in. + + :param query: + :return possible_music_objects: + """ + + raise NotImplementedError() + + @classmethod + def fetch_details(cls, music_object: MusicObject, simple: bool = False) -> MusicObject: + """ + when a music object with laccing data is passed in, it returns + the SAME object **(no copy)** with more detailed data. + If you for example put in an album, it fetches the tracklist + + :param music_object: + :param simple: + if it is true it fetches only the most important information (only one level) + if an Artist is passed in, it fetches only the discography of the artist, and not the + tracklist of every album of the artist. + :return detailed_music_object: + """ + + raise NotImplementedError