diff --git a/src/music_kraken/database/objects/source.py b/src/music_kraken/database/objects/source.py index c43ef22..c98b125 100644 --- a/src/music_kraken/database/objects/source.py +++ b/src/music_kraken/database/objects/source.py @@ -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_) 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.url = url diff --git a/src/music_kraken/static_files/new_db.sql b/src/music_kraken/static_files/new_db.sql index 7585a9c..e915e14 100644 --- a/src/music_kraken/static_files/new_db.sql +++ b/src/music_kraken/static_files/new_db.sql @@ -14,6 +14,7 @@ CREATE TABLE Song CREATE TABLE Source ( id BIGINT AUTO_INCREMENT PRIMARY KEY, + type TEXT NOT NULL src TEXT NOT NULL, url TEXT NOT NULL, certainty INT NOT NULL DEFAULT 0, -- certainty=0 -> it is definitely a valid source