This commit is contained in:
Lars Noack 2022-12-06 17:55:07 +01:00
parent 37c8d894aa
commit cbb56499bf
5 changed files with 42 additions and 13 deletions

View File

@ -1,21 +1,32 @@
import music_kraken
from music_kraken import (
Song,
Lyrics,
Target,
Source
)
import music_kraken.database.new_database as db
cache = music_kraken.database.new_database.Database("test.db")
cache.reset()
artist = music_kraken.Artist(
name="I'm in a Coffin"
)
song = music_kraken.Song(
song = Song(
title="Vein Deep in the Solution",
release="One Final Action",
artists=[artist]
release_name="One Final Action",
target=Target(file="~/Music/genre/artist/album/song.mp3", path="~/Music/genre/artist/album"),
metadata={
"album": "One Final Action"
},
lyrics=[
Lyrics(text="these are some depressive lyrics", language="en")
],
sources=[
Source(src="youtube", url="https://youtu.be/dfnsdajlhkjhsd")
]
)
cache.push([artist, song])
cache.push([song])
"""
music_kraken.clear_cache()

View File

@ -17,7 +17,7 @@ from .utils.shared import (
NOT_A_GENRE
)
from .lyrics import lyrics
# from .lyrics import lyrics
"""
@ -40,10 +40,13 @@ musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeI
# define the most important values and function for import in the __init__ file
Song = database.Song
Artist = database.Artist
Source = database.Source
Target = database.Target
Lyrics = database.Lyrics
MetadataSearch = metadata.MetadataSearch
MetadataDownload = metadata.MetadataDownload
cache = database.cache
# cache = database.cache
def fetch_metadata(type_: str, id_: str):

View File

@ -10,4 +10,4 @@ Target = objects.Target
Metadata = objects.Metadata
Lyrics = objects.Lyrics
cache = temp_database.TempDatabase()
# cache = temp_database.TempDatabase()

View File

@ -4,7 +4,7 @@ import logging
from typing import List
from pkg_resources import resource_string
from .song import (
from .objects import (
Song,
Lyrics,
Metadata,
@ -74,7 +74,22 @@ class Database:
self.push_one(db_object)
def push_song(self, song: Song):
pass
# ADDING THE DATA FOR THE SONG OBJECT
"""
db_field - object attribute
-------------------------------
id - id
name - title
"""
table = "Song"
query = f"INSERT OR REPLACE INTO {table} (id, name) VALUES (?, ?);"
values = (
song.id,
song.title
)
self.cursor.execute(query, values)
self.connection.commit()
def push_lyrics(self, lyrics: Lyrics):
pass

BIN
test.db Normal file

Binary file not shown.