fix: added maps to getKoditvshows method

This commit is contained in:
Marcel van der Veldt 2015-03-20 13:27:02 +01:00
parent 58ad5c1fe3
commit a20ccc1cc8

View file

@ -79,17 +79,16 @@ class ReadKodiDB():
def getKodiTvShowsIds(self,returnMB3Ids = False): def getKodiTvShowsIds(self,returnMB3Ids = False):
# returns a list of tvshowIds or MB3 Id's from all tvshows currently in the Kodi library # returns a list of tvshowIds or MB3 Id's from all tvshows currently in the Kodi library
allKodiTvShows = self.getKodiTvShows(False) allKodiTvShows = self.getKodiTvShows(False)
allKodiTvShowsIds = list()
if allKodiTvShows != None: if allKodiTvShows == None:
for kodishow in allKodiTvShows: return list()
if returnMB3Ids:
filepath = kodishow["file"] if(returnMB3Ids):
filepath = filepath.replace(tvLibrary + os.sep, "") allKodiTvShowsIds = list(allKodiTvShows.keys())
filepath = filepath.replace(".strm", "") return allKodiTvShowsIds
filepath = filepath.split(os.sep)[0]
id = filepath
else: else:
allKodiTvShowsIds = list()
for kodishow in allKodiTvShows.values():
id = str(kodishow["tvshowid"]) id = str(kodishow["tvshowid"])
allKodiTvShowsIds.append(id) allKodiTvShowsIds.append(id)
@ -110,7 +109,18 @@ class ReadKodiDB():
if(result.has_key('tvshows')): if(result.has_key('tvshows')):
tvshows = result['tvshows'] tvshows = result['tvshows']
return tvshows kodiShowMap = None
if(tvshows != None and len(tvshows) > 0):
kodiShowMap = {}
for kodishow in tvshows:
filepath = kodishow["file"]
filepath = filepath.replace(tvLibrary + os.sep, "")
filepath = filepath.replace(".strm", "")
filepath = filepath.split(os.sep)[0]
key = filepath #extract the id from the file path
kodiShowMap[key] = kodishow
return kodiShowMap
def getKodiTVShow(self, id): def getKodiTVShow(self, id):
xbmc.sleep(sleepVal) xbmc.sleep(sleepVal)