added source to artist
This commit is contained in:
		
							
								
								
									
										13
									
								
								src/goof.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/goof.py
									
									
									
									
									
								
							@@ -7,7 +7,8 @@ from music_kraken import (
 | 
				
			|||||||
    Album,
 | 
					    Album,
 | 
				
			||||||
    Artist,
 | 
					    Artist,
 | 
				
			||||||
    ID3Timestamp,
 | 
					    ID3Timestamp,
 | 
				
			||||||
    source_types
 | 
					    SourcePages,
 | 
				
			||||||
 | 
					    SourceTypes
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from music_kraken.tagging import (
 | 
					from music_kraken.tagging import (
 | 
				
			||||||
@@ -28,8 +29,12 @@ def div(msg: str = ""):
 | 
				
			|||||||
cache = music_kraken.database.new_database.Database("test.db")
 | 
					cache = music_kraken.database.new_database.Database("test.db")
 | 
				
			||||||
cache.reset()
 | 
					cache.reset()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main_artist = Artist(
 | 
					main_artist = Artist(
 | 
				
			||||||
    name="I'm in a coffin"
 | 
					    name="I'm in a coffin",
 | 
				
			||||||
 | 
					    sources=[
 | 
				
			||||||
 | 
					        Source(SourcePages.ENCYCLOPAEDIA_METALLUM, "https://www.metal-archives.com/bands/I%27m_in_a_Coffin/127727")
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
artist_ref = main_artist.reference
 | 
					artist_ref = main_artist.reference
 | 
				
			||||||
@@ -65,8 +70,8 @@ song_input = Song(
 | 
				
			|||||||
        Lyrics(text="test", language="en")
 | 
					        Lyrics(text="test", language="en")
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    sources=[
 | 
					    sources=[
 | 
				
			||||||
        Source(source_types.SONG, src="youtube", url="https://youtu.be/dfnsdajlhkjhsd"),
 | 
					        Source(SourcePages.YOUTUBE, "https://youtu.be/dfnsdajlhkjhsd"),
 | 
				
			||||||
        Source(source_types.SONG, src="musify", url="https://ln.topdf.de/Music-Kraken/")
 | 
					        Source(SourcePages.MUSIFY, "https://ln.topdf.de/Music-Kraken/")
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    album=album_input,
 | 
					    album=album_input,
 | 
				
			||||||
    main_artist_list=[main_artist],
 | 
					    main_artist_list=[main_artist],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,8 @@ musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeI
 | 
				
			|||||||
Song = database.Song
 | 
					Song = database.Song
 | 
				
			||||||
Artist = database.Artist
 | 
					Artist = database.Artist
 | 
				
			||||||
Source = database.Source
 | 
					Source = database.Source
 | 
				
			||||||
source_types = database.source_types
 | 
					SourceTypes = database.SourceTypes
 | 
				
			||||||
 | 
					SourcePages = database.SourcePages
 | 
				
			||||||
Target = database.Target
 | 
					Target = database.Target
 | 
				
			||||||
Lyrics = database.Lyrics
 | 
					Lyrics = database.Lyrics
 | 
				
			||||||
Album = database.Album
 | 
					Album = database.Album
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,8 @@ from . import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ID3Timestamp = objects.ID3Timestamp
 | 
					ID3Timestamp = objects.ID3Timestamp
 | 
				
			||||||
source_types = objects.source_types
 | 
					SourceTypes = objects.SourceTypes
 | 
				
			||||||
 | 
					SourcePages = objects.SourcePages
 | 
				
			||||||
Song = objects.Song
 | 
					Song = objects.Song
 | 
				
			||||||
Source = objects.Source
 | 
					Source = objects.Source
 | 
				
			||||||
Target = objects.Target
 | 
					Target = objects.Target
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,10 +16,10 @@ from .objects import (
 | 
				
			|||||||
    Artist,
 | 
					    Artist,
 | 
				
			||||||
    Album,
 | 
					    Album,
 | 
				
			||||||
    ID3Timestamp,
 | 
					    ID3Timestamp,
 | 
				
			||||||
    source_types
 | 
					    SourceTypes,
 | 
				
			||||||
 | 
					    SourcePages
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
logger = logging.getLogger("database")
 | 
					logger = logging.getLogger("database")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Due to this not being deployed on a Server **HOPEFULLY**
 | 
					# Due to this not being deployed on a Server **HOPEFULLY**
 | 
				
			||||||
@@ -186,7 +186,7 @@ class Database:
 | 
				
			|||||||
        # add sources
 | 
					        # add sources
 | 
				
			||||||
        for source in song.sources:
 | 
					        for source in song.sources:
 | 
				
			||||||
            source.add_song(song)
 | 
					            source.add_song(song)
 | 
				
			||||||
            source.type_enum = source_types.SONG
 | 
					            source.type_enum = SourceTypes.SONG
 | 
				
			||||||
            self.push_source(source=source)
 | 
					            self.push_source(source=source)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # add lyrics
 | 
					        # add lyrics
 | 
				
			||||||
@@ -223,8 +223,6 @@ class Database:
 | 
				
			|||||||
        self.connection.commit()
 | 
					        self.connection.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def push_source(self, source: Source):
 | 
					    def push_source(self, source: Source):
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if source.song_ref_id is None:
 | 
					        if source.song_ref_id is None:
 | 
				
			||||||
            logger.warning("the Source don't refer to a song")
 | 
					            logger.warning("the Source don't refer to a song")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -234,7 +232,7 @@ class Database:
 | 
				
			|||||||
            source.id,
 | 
					            source.id,
 | 
				
			||||||
            source.type_str,
 | 
					            source.type_str,
 | 
				
			||||||
            source.song_ref_id,
 | 
					            source.song_ref_id,
 | 
				
			||||||
            source.site_str,
 | 
					            source.page_str,
 | 
				
			||||||
            source.url
 | 
					            source.url
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -316,6 +314,10 @@ class Database:
 | 
				
			|||||||
        for album in artist.main_albums:
 | 
					        for album in artist.main_albums:
 | 
				
			||||||
            self.push_artist_album(artist_ref=artist.reference, album_ref=album.reference)
 | 
					            self.push_artist_album(artist_ref=artist.reference, album_ref=album.reference)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for source in artist.sources:
 | 
				
			||||||
 | 
					            source.add_song(artist)
 | 
				
			||||||
 | 
					            self.push_source(source)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pull_lyrics(self, song_ref: Reference = None, lyrics_ref: Reference = None) -> List[Lyrics]:
 | 
					    def pull_lyrics(self, song_ref: Reference = None, lyrics_ref: Reference = None) -> List[Lyrics]:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Gets a list of sources. if lyrics_ref is passed in the List will most likely only
 | 
					        Gets a list of sources. if lyrics_ref is passed in the List will most likely only
 | 
				
			||||||
@@ -342,7 +344,7 @@ class Database:
 | 
				
			|||||||
            language=lyrics_row['language']
 | 
					            language=lyrics_row['language']
 | 
				
			||||||
        ) for lyrics_row in lyrics_rows]
 | 
					        ) for lyrics_row in lyrics_rows]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pull_sources(self, type_enum, song_ref: Reference = None, source_ref: Reference = None) -> List[Source]:
 | 
					    def pull_sources(self, artist_ref: Reference = None, song_ref: Reference = None, source_ref: Reference = None) -> List[Source]:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Gets a list of sources. if source_ref is passed in the List will most likely only
 | 
					        Gets a list of sources. if source_ref is passed in the List will most likely only
 | 
				
			||||||
        contain one Element if everything goes accordingly.
 | 
					        contain one Element if everything goes accordingly.
 | 
				
			||||||
@@ -357,19 +359,23 @@ class Database:
 | 
				
			|||||||
        if song_ref is not None:
 | 
					        if song_ref is not None:
 | 
				
			||||||
            where = f"song_id=\"{song_ref.id}\""
 | 
					            where = f"song_id=\"{song_ref.id}\""
 | 
				
			||||||
        elif source_ref is not None:
 | 
					        elif source_ref is not None:
 | 
				
			||||||
            where = f"id=\"{source_ref.id}\""
 | 
					            where = f"id=\"{source_ref.id}\" AND type=\"{SourceTypes.SONG.value}\""
 | 
				
			||||||
 | 
					        elif artist_ref is not None:
 | 
				
			||||||
 | 
					            where = f"song_id=\"{artist_ref.id}\" AND type=\"{SourceTypes.ARTIST.value}\""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        query = SOURCE_QUERY.format(where=where)
 | 
					        query = SOURCE_QUERY.format(where=where)
 | 
				
			||||||
        self.cursor.execute(query)
 | 
					        self.cursor.execute(query)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        source_rows = self.cursor.fetchall()
 | 
					        source_rows = self.cursor.fetchall()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return [Source(
 | 
					        return [
 | 
				
			||||||
            source_types(source_row['type']),
 | 
					            Source(
 | 
				
			||||||
            id_=source_row['id'],
 | 
					                page_enum=SourcePages(source_row['src']),
 | 
				
			||||||
            src=source_row['src'],
 | 
					                type_enum=SourceTypes(source_row['type']),
 | 
				
			||||||
            url=source_row['url']
 | 
					                url=source_row['url'],
 | 
				
			||||||
        ) for source_row in source_rows]
 | 
					                id_=source_row['id']
 | 
				
			||||||
 | 
					            ) for source_row in source_rows
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pull_artist_song(self, song_ref: Reference = None, artist_ref: Reference = None) -> List[tuple]:
 | 
					    def pull_artist_song(self, song_ref: Reference = None, artist_ref: Reference = None) -> List[tuple]:
 | 
				
			||||||
        table = "SongArtist"
 | 
					        table = "SongArtist"
 | 
				
			||||||
@@ -422,7 +428,8 @@ class Database:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        artist_obj = Artist(
 | 
					        artist_obj = Artist(
 | 
				
			||||||
            id_=artist_id,
 | 
					            id_=artist_id,
 | 
				
			||||||
            name=artist_row['artist_name']
 | 
					            name=artist_row['artist_name'],
 | 
				
			||||||
 | 
					            sources=self.pull_sources(artist_ref=Reference(id_=artist_id))
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        if flat:
 | 
					        if flat:
 | 
				
			||||||
            return artist_obj
 | 
					            return artist_obj
 | 
				
			||||||
@@ -491,7 +498,7 @@ class Database:
 | 
				
			|||||||
                file=song_result['file'],
 | 
					                file=song_result['file'],
 | 
				
			||||||
                path=song_result['path']
 | 
					                path=song_result['path']
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            sources=self.pull_sources(type_enum=source_types.SONG, song_ref=Reference(id_=song_id)),
 | 
					            sources=self.pull_sources(song_ref=Reference(id_=song_id)),
 | 
				
			||||||
            lyrics=self.pull_lyrics(song_ref=Reference(id_=song_id)),
 | 
					            lyrics=self.pull_lyrics(song_ref=Reference(id_=song_id)),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,8 @@ from . import (
 | 
				
			|||||||
ID3_MAPPING = metadata.Mapping
 | 
					ID3_MAPPING = metadata.Mapping
 | 
				
			||||||
ID3Timestamp = metadata.ID3Timestamp
 | 
					ID3Timestamp = metadata.ID3Timestamp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
source_types = source.source_types
 | 
					SourceTypes = source.SourceTypes
 | 
				
			||||||
 | 
					SourcePages = source.SourcePages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Song = song.Song
 | 
					Song = song.Song
 | 
				
			||||||
Artist = song.Artist
 | 
					Artist = song.Artist
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,11 @@ from .parents import (
 | 
				
			|||||||
    SongAttribute,
 | 
					    SongAttribute,
 | 
				
			||||||
    ID3Metadata
 | 
					    ID3Metadata
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from .source import Source
 | 
					from .source import (
 | 
				
			||||||
 | 
					    Source,
 | 
				
			||||||
 | 
					    SourceTypes,
 | 
				
			||||||
 | 
					    SourcePages
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
All Objects dependent 
 | 
					All Objects dependent 
 | 
				
			||||||
@@ -118,8 +122,7 @@ class Song(DatabaseObject, ID3Metadata):
 | 
				
			|||||||
        self.tracksort: int | None = tracksort
 | 
					        self.tracksort: int | None = tracksort
 | 
				
			||||||
        self.genre: str = genre
 | 
					        self.genre: str = genre
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        self.sources: List[Source] = []
 | 
					        self._sources: List[Source] = []
 | 
				
			||||||
        if sources is not None:
 | 
					 | 
				
			||||||
        self.sources = sources
 | 
					        self.sources = sources
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.album = album
 | 
					        self.album = album
 | 
				
			||||||
@@ -192,6 +195,15 @@ class Song(DatabaseObject, ID3Metadata):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return metadata
 | 
					        return metadata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def set_sources(self, source_list: List[Source]):
 | 
				
			||||||
 | 
					        if source_list is None:
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self._sources = source_list
 | 
				
			||||||
 | 
					        for source in self._sources:
 | 
				
			||||||
 | 
					            source.type_enum = SourceTypes.SONG
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sources: List[Source] = property(fget=lambda self: self._sources, fset=set_sources)
 | 
				
			||||||
    metadata = property(fget=get_metadata)
 | 
					    metadata = property(fget=get_metadata)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -335,10 +347,10 @@ class Artist(DatabaseObject, ID3Metadata):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.main_albums = main_albums
 | 
					        self.main_albums = main_albums
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.sources = []
 | 
					        self._sources = []
 | 
				
			||||||
        if sources is not None:
 | 
					 | 
				
			||||||
        self.sources = sources
 | 
					        self.sources = sources
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __str__(self):
 | 
					    def __str__(self):
 | 
				
			||||||
        return self.name or ""
 | 
					        return self.name or ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -381,13 +393,28 @@ class Artist(DatabaseObject, ID3Metadata):
 | 
				
			|||||||
        return flat_copy_discography
 | 
					        return flat_copy_discography
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_id3_dict(self) -> dict:
 | 
					    def get_id3_dict(self) -> dict:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        TODO refactor
 | 
				
			||||||
 | 
					        :return:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
        id3_dict = {
 | 
					        id3_dict = {
 | 
				
			||||||
            ID3_MAPPING.ARTIST: [self.name]
 | 
					            ID3_MAPPING.ARTIST: [self.name]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if len(self.sources) <= 0:
 | 
				
			||||||
 | 
					            return id3_dict
 | 
				
			||||||
        id3_dict.update(self.sources[0].get_id3_dict())
 | 
					        id3_dict.update(self.sources[0].get_id3_dict())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return id3_dict
 | 
					        return id3_dict
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def set_sources(self, source_list: List[Source]):
 | 
				
			||||||
 | 
					        if source_list is None:
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self._sources = source_list
 | 
				
			||||||
 | 
					        for source in self._sources:
 | 
				
			||||||
 | 
					            source.type_enum = SourceTypes.ARTIST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sources: List[Source] = property(fget=lambda self: self._sources, fset=set_sources)
 | 
				
			||||||
    discography: List[Album] = property(fget=get_discography)
 | 
					    discography: List[Album] = property(fget=get_discography)
 | 
				
			||||||
    features: Album = property(fget=get_features)
 | 
					    features: Album = property(fget=get_features)
 | 
				
			||||||
    songs: Album = property(fget=get_songs)
 | 
					    songs: Album = property(fget=get_songs)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,13 +7,15 @@ from .parents import (
 | 
				
			|||||||
    ID3Metadata
 | 
					    ID3Metadata
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class source_types(Enum):
 | 
					
 | 
				
			||||||
 | 
					class SourceTypes(Enum):
 | 
				
			||||||
    SONG = "song"
 | 
					    SONG = "song"
 | 
				
			||||||
    ALBUM = "album"
 | 
					    ALBUM = "album"
 | 
				
			||||||
    ARTIST = "artist"
 | 
					    ARTIST = "artist"
 | 
				
			||||||
    LYRICS = "lyrics"
 | 
					    LYRICS = "lyrics"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class sources(Enum):
 | 
					
 | 
				
			||||||
 | 
					class SourcePages(Enum):
 | 
				
			||||||
    YOUTUBE = "youtube"
 | 
					    YOUTUBE = "youtube"
 | 
				
			||||||
    MUSIFY = "musify"
 | 
					    MUSIFY = "musify"
 | 
				
			||||||
    GENIUS = "genius"
 | 
					    GENIUS = "genius"
 | 
				
			||||||
@@ -25,14 +27,13 @@ class sources(Enum):
 | 
				
			|||||||
        homepage_map = {
 | 
					        homepage_map = {
 | 
				
			||||||
            cls.YOUTUBE: "https://www.youtube.com/",
 | 
					            cls.YOUTUBE: "https://www.youtube.com/",
 | 
				
			||||||
            cls.MUSIFY: "https://musify.club/",
 | 
					            cls.MUSIFY: "https://musify.club/",
 | 
				
			||||||
            cls.MUSICBRAINZ:"https://musicbrainz.org/",
 | 
					            cls.MUSICBRAINZ: "https://musicbrainz.org/",
 | 
				
			||||||
            cls.ENCYCLOPAEDIA_METALLUM: "https://www.metal-archives.com/",
 | 
					            cls.ENCYCLOPAEDIA_METALLUM: "https://www.metal-archives.com/",
 | 
				
			||||||
            cls.GENIUS: "https://genius.com/"
 | 
					            cls.GENIUS: "https://genius.com/"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return homepage_map[attribute]
 | 
					        return homepage_map[attribute]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
class Source(DatabaseObject, SongAttribute, ID3Metadata):
 | 
					class Source(DatabaseObject, SongAttribute, ID3Metadata):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    create somehow like that
 | 
					    create somehow like that
 | 
				
			||||||
@@ -42,22 +43,23 @@ class Source(DatabaseObject, SongAttribute, ID3Metadata):
 | 
				
			|||||||
    ```
 | 
					    ```
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, type_enum, id_: str = None, src: str = None, url: str = None) -> None:
 | 
					    def __init__(self, page_enum, url: str, id_: str = None, type_enum=None) -> None:
 | 
				
			||||||
        DatabaseObject.__init__(self, id_=id_)
 | 
					        DatabaseObject.__init__(self, id_=id_)
 | 
				
			||||||
        SongAttribute.__init__(self)
 | 
					        SongAttribute.__init__(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.type_enum = type_enum
 | 
					        self.type_enum = type_enum
 | 
				
			||||||
        self.src = sources(src)
 | 
					        self.page_enum = page_enum
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.url = url
 | 
					        self.url = url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_id3_dict(self) -> dict:
 | 
					    def get_id3_dict(self) -> dict:
 | 
				
			||||||
        if self.type_enum == source_types.SONG:
 | 
					        if self.type_enum == SourceTypes.SONG:
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
                Mapping.FILE_WEBPAGE_URL: [self.url],
 | 
					                Mapping.FILE_WEBPAGE_URL: [self.url],
 | 
				
			||||||
                Mapping.SOURCE_WEBPAGE_URL: [self.homepage]
 | 
					                Mapping.SOURCE_WEBPAGE_URL: [self.homepage]
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.type_enum == source_types.ARTIST:
 | 
					        if self.type_enum == SourceTypes.ARTIST:
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
                Mapping.ARTIST_WEBPAGE_URL: [self.url]
 | 
					                Mapping.ARTIST_WEBPAGE_URL: [self.url]
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -65,8 +67,8 @@ class Source(DatabaseObject, SongAttribute, ID3Metadata):
 | 
				
			|||||||
        return {}
 | 
					        return {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __str__(self):
 | 
					    def __str__(self):
 | 
				
			||||||
        return f"{self.src}: {self.url}"
 | 
					        return f"{self.page_enum}: {self.url}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    site_str = property(fget=lambda self: self.src.value)
 | 
					    page_str = property(fget=lambda self: self.page_enum.value)
 | 
				
			||||||
    type_str = property(fget=lambda self: self.type_enum.value)
 | 
					    type_str = property(fget=lambda self: self.type_enum.value)
 | 
				
			||||||
    homepage = property(fget=lambda self: sources.get_homepage(self.src))
 | 
					    homepage = property(fget=lambda self: SourcePages.get_homepage(self.page_enum))
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								src/test.db
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/test.db
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user