Merge pull request #1313 from croneter/fix-valueerror
Fix ValueError when deleting a music album
This commit is contained in:
commit
011d20473e
2 changed files with 0 additions and 38 deletions
|
@ -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,
|
||||
|
|
|
@ -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, ))
|
||||
|
|
Loading…
Reference in a new issue