Fix TypeError upon removing entire section

This commit is contained in:
croneter 2018-11-25 19:53:42 +01:00
parent 67807d3eb7
commit 90e13cb8ee

View file

@ -221,17 +221,20 @@ def delete_sections(old_sections):
plexdb.remove_section(section[0]) plexdb.remove_section(section[0])
elif section[2] == v.KODI_TYPE_MOVIE: elif section[2] == v.KODI_TYPE_MOVIE:
video_library_update = True video_library_update = True
context = itemtypes.Movie(plexdb=plexdb, context = itemtypes.Movie(None,
plexdb=plexdb,
kodidb=kodidb) kodidb=kodidb)
elif section[2] == v.KODI_TYPE_SHOW: elif section[2] == v.KODI_TYPE_SHOW:
video_library_update = True video_library_update = True
context = itemtypes.Show(plexdb=plexdb, context = itemtypes.Show(None,
plexdb=plexdb,
kodidb=kodidb) kodidb=kodidb)
with kodi_db.KodiMusicDB() as kodidb: with kodi_db.KodiMusicDB() as kodidb:
for section in old_sections: for section in old_sections:
if section[2] == v.KODI_TYPE_ARTIST: if section[2] == v.KODI_TYPE_ARTIST:
music_library_update = True music_library_update = True
context = itemtypes.Artist(plexdb=plexdb, context = itemtypes.Artist(None,
plexdb=plexdb,
kodidb=kodidb) kodidb=kodidb)
for plex_id in plexdb.plexid_by_section(section[0]): for plex_id in plexdb.plexid_by_section(section[0]):
context.remove(plex_id) context.remove(plex_id)