This commit is contained in:
Lars Noack 2023-01-16 16:19:48 +01:00
parent 46f01032f5
commit be44d35fab
2 changed files with 5 additions and 2 deletions

View File

@ -42,11 +42,13 @@ class Source(DatabaseObject, SongAttribute, ID3Metadata):
``` ```
""" """
def __init__(self,type_str: str, id_: str = None, src: str = None, url: str = None) -> None: def __init__(self, id_: str = None, src: str = None, url: str = None, type_str: str = None) -> None:
DatabaseObject.__init__(self, id_=id_) DatabaseObject.__init__(self, id_=id_)
SongAttribute.__init__(self) SongAttribute.__init__(self)
self.type_enum = source_types(type_str) self.type_enum = None
if type_str is not None:
self.type_enum = source_types(type_str)
self.src = sources(src) self.src = sources(src)
self.url = url self.url = url

View File

@ -14,6 +14,7 @@ CREATE TABLE Song
CREATE TABLE Source CREATE TABLE Source
( (
id BIGINT AUTO_INCREMENT PRIMARY KEY, id BIGINT AUTO_INCREMENT PRIMARY KEY,
type TEXT NOT NULL
src TEXT NOT NULL, src TEXT NOT NULL,
url TEXT NOT NULL, url TEXT NOT NULL,
certainty INT NOT NULL DEFAULT 0, -- certainty=0 -> it is definitely a valid source certainty INT NOT NULL DEFAULT 0, -- certainty=0 -> it is definitely a valid source