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):
# returns a list of tvshowIds or MB3 Id's from all tvshows currently in the Kodi library
allKodiTvShows = self.getKodiTvShows(False)
allKodiTvShowsIds = list()
if allKodiTvShows != None:
for kodishow in allKodiTvShows:
if returnMB3Ids:
filepath = kodishow["file"]
filepath = filepath.replace(tvLibrary + os.sep, "")
filepath = filepath.replace(".strm", "")
filepath = filepath.split(os.sep)[0]
id = filepath
if allKodiTvShows == None:
return list()
if(returnMB3Ids):
allKodiTvShowsIds = list(allKodiTvShows.keys())
return allKodiTvShowsIds
else:
allKodiTvShowsIds = list()
for kodishow in allKodiTvShows.values():
id = str(kodishow["tvshowid"])
allKodiTvShowsIds.append(id)
@ -110,7 +109,18 @@ class ReadKodiDB():
if(result.has_key('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):
xbmc.sleep(sleepVal)