Merge pull request #1308 from croneter/fix-valueerror
Fix ValueError when deleting a music album
This commit is contained in:
commit
a6defcc05a
2 changed files with 0 additions and 23 deletions
|
@ -132,7 +132,6 @@ class MusicMixin(object):
|
||||||
'''
|
'''
|
||||||
Remove an album
|
Remove an album
|
||||||
'''
|
'''
|
||||||
self.kodidb.delete_album_from_discography(kodi_id)
|
|
||||||
self.kodidb.remove_album(kodi_id)
|
self.kodidb.remove_album(kodi_id)
|
||||||
self.kodidb.delete_artwork(kodi_id, v.KODI_TYPE_ALBUM)
|
self.kodidb.delete_artwork(kodi_id, v.KODI_TYPE_ALBUM)
|
||||||
|
|
||||||
|
|
|
@ -104,26 +104,6 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
self.cursor.execute('DELETE FROM song_artist WHERE idSong = ?',
|
self.cursor.execute('DELETE FROM song_artist WHERE idSong = ?',
|
||||||
(song_id, ))
|
(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 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
|
@db.catch_operationalerrors
|
||||||
def delete_song_from_song_genre(self, song_id):
|
def delete_song_from_song_genre(self, song_id):
|
||||||
"""
|
"""
|
||||||
|
@ -498,5 +478,3 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
self.cursor.execute('DELETE FROM song_artist WHERE idArtist = ?',
|
self.cursor.execute('DELETE FROM song_artist WHERE idArtist = ?',
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
self.cursor.execute('DELETE FROM discography WHERE idArtist = ?',
|
|
||||||
(kodi_id, ))
|
|
||||||
|
|
Loading…
Reference in a new issue