From 281c7d1599118bd19fde6252f64d19b9af4fdc73 Mon Sep 17 00:00:00 2001 From: croneter Date: Wed, 27 Jan 2021 15:45:09 +0100 Subject: [PATCH] Fix ValueError when deleting a music album --- resources/lib/itemtypes/music.py | 6 ------ resources/lib/kodi_db/music.py | 32 -------------------------------- 2 files changed, 38 deletions(-) diff --git a/resources/lib/itemtypes/music.py b/resources/lib/itemtypes/music.py index 7e2721cc..ddd26d2f 100644 --- a/resources/lib/itemtypes/music.py +++ b/resources/lib/itemtypes/music.py @@ -135,7 +135,6 @@ class MusicMixin(object): ''' Remove an album ''' - self.kodidb.delete_album_from_discography(kodi_id) if v.KODIVERSION < 18: self.kodidb.delete_album_from_album_genre(kodi_id) self.kodidb.remove_album(kodi_id) @@ -353,11 +352,6 @@ class Album(MusicMixin, ItemBase): timing.unix_date_to_kodi(self.last_sync), 'album') self.kodidb.add_albumartist(artist_id, kodi_id, api.artist_name()) - if v.KODIVERSION < 18: - self.kodidb.add_discography(artist_id, name, api.year()) - self.kodidb.add_music_genres(kodi_id, - api.genres(), - v.KODI_TYPE_ALBUM) if app.SYNC.artwork: self.kodidb.modify_artwork(artworks, kodi_id, diff --git a/resources/lib/kodi_db/music.py b/resources/lib/kodi_db/music.py index 50993806..ad61a459 100644 --- a/resources/lib/kodi_db/music.py +++ b/resources/lib/kodi_db/music.py @@ -106,26 +106,6 @@ class KodiMusicDB(common.KodiDBBase): self.cursor.execute('DELETE FROM song_artist WHERE idSong = ?', (song_id, )) - @db.catch_operationalerrors - def delete_album_from_discography(self, album_id): - """ - Removes the album with id album_id from the table discography - """ - # Need to get the album name as a string first! - self.cursor.execute('SELECT strAlbum, iYear FROM album WHERE idAlbum = ? LIMIT 1', - (album_id, )) - try: - name, year = self.cursor.fetchone() - except TypeError: - return - self.cursor.execute('SELECT idArtist FROM album_artist WHERE idAlbum = ? LIMIT 1', - (album_id, )) - artist = self.cursor.fetchone() - if not artist: - return - self.cursor.execute('DELETE FROM discography WHERE idArtist = ? AND strAlbum = ? AND strYear = ?', - (artist[0], name, year)) - @db.catch_operationalerrors def delete_song_from_song_genre(self, song_id): """ @@ -352,16 +332,6 @@ class KodiMusicDB(common.KodiDBBase): VALUES (?, ?, ?) ''', (artist_id, kodi_id, artistname)) - @db.catch_operationalerrors - def add_discography(self, artist_id, albumname, year): - self.cursor.execute(''' - INSERT OR REPLACE INTO discography( - idArtist, - strAlbum, - strYear) - VALUES (?, ?, ?) - ''', (artist_id, albumname, year)) - @db.catch_operationalerrors def add_music_genres(self, kodiid, genres, mediatype): """ @@ -656,5 +626,3 @@ class KodiMusicDB(common.KodiDBBase): (kodi_id, )) self.cursor.execute('DELETE FROM song_artist WHERE idArtist = ?', (kodi_id, )) - self.cursor.execute('DELETE FROM discography WHERE idArtist = ?', - (kodi_id, ))