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

@@ -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