def getViewing(self): oGui = cGui() DB = cDb() # oInputParameterHandler = cInputParameterHandler() row = DB.get_viewing() if not row: oGui.setEndOfDirectory() return for data in row: try: title = data['title'].encode('utf-8') except: title = data['title'] try: try: siteurl = data['siteurl'].encode('utf-8') except: siteurl = data['siteurl'] if isMatrix(): siteurl = UnquotePlus(siteurl.decode('utf-8')) title = str(title, 'utf-8') else: siteurl = UnquotePlus(siteurl) sTitleWatched = data['title_id'] site = data['site'] function = data['fav'] cat = data['cat'] sSeason = data['season'] sTmdbId = data['tmdb_id'] # if 'tmdb_id' in data else None oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteurl) oOutputParameterHandler.addParameter('sMovieTitle', title) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) oOutputParameterHandler.addParameter('sTitleWatched', sTitleWatched) oOutputParameterHandler.addParameter('sSeason', sSeason) oOutputParameterHandler.addParameter('sCat', cat) oOutputParameterHandler.addParameter('isViewing', True) # pourcentage de lecture meta = {} meta['title'] = sTitleWatched resumetime, totaltime = DB.get_resume(meta) oOutputParameterHandler.addParameter('ResumeTime', resumetime) oOutputParameterHandler.addParameter('TotalTime', totaltime) if cat == '1': oListItem = oGui.addMovie(site, function, title, 'films.png', '', title, oOutputParameterHandler) elif cat == '5': oListItem = oGui.addMisc(site, function, title, 'films.png', '', title, oOutputParameterHandler) elif cat == '4': oListItem = oGui.addSeason(site, function, title, 'series.png', '', title, oOutputParameterHandler) else: oListItem = oGui.addTV(site, function, title, 'series.png', '', title, oOutputParameterHandler) oOutputParameterHandler.addParameter('sTitleWatched', sTitleWatched) oOutputParameterHandler.addParameter('sCat', cat) oListItem.addMenu(SITE_IDENTIFIER, 'delViewing', self.ADDON.VSlang(30412), oOutputParameterHandler) except Exception as e: pass # Vider toute la catégorie n'est pas accessible lors de l'utilisation en Widget if not xbmc.getCondVisibility('Window.IsActive(home)'): oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'delViewing', self.ADDON.VSlang(30211), 'trash.png', oOutputParameterHandler) oGui.setEndOfDirectory() return
def getFav(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() row = cDb().get_bookmark() if (oInputParameterHandler.exist('sCat')): sCat = oInputParameterHandler.getValue('sCat') # Série, Animes, Saison et Episodes sont visibles dans les marques-page "Séries" catList = ('2', '3', '4', '8') if sCat in catList: sCat = 2 cGui.CONTENT = 'tvshows' else: catList = ('1', '7') # films, saga cGui.CONTENT = 'movies' if sCat in catList: sCat = 1 else: catList = sCat cGui.CONTENT = 'videos' gen = (x for x in row if x['cat'] in catList) else: oGui.setEndOfDirectory() return for data in gen: try: title = data['title'].encode('utf-8') except: title = data['title'] try: thumbnail = data['icon'].encode('utf-8') except: thumbnail = data['icon'] try: try: siteurl = data['siteurl'].encode('utf-8') except: siteurl = data['siteurl'] if isMatrix(): siteurl = UnquotePlus(siteurl.decode('utf-8')) title = str(title, 'utf-8') else: siteurl = UnquotePlus(siteurl) site = data['site'] function = data['fav'] cat = data['cat'] fanart = data['fanart'] if thumbnail == '': thumbnail = 'False' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteurl) oOutputParameterHandler.addParameter('sMovieTitle', title) oOutputParameterHandler.addParameter('searchtext', title) oOutputParameterHandler.addParameter('sThumbnail', thumbnail) # Dans ajouter source c'est bien sThumb donc... oOutputParameterHandler.addParameter('sThumb', thumbnail) if (function == 'play'): oHoster = cHosterGui().checkHoster(siteurl) oOutputParameterHandler.addParameter( 'sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter( 'sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sMediaUrl', siteurl) oGuiElement = cGuiElement() oGuiElement.setSiteName(site) oGuiElement.setFunction(function) oGuiElement.setTitle(title) oGuiElement.setFileName(title) oGuiElement.setIcon("mark.png") if (cat == '1'): # Films oGuiElement.setMeta(1) oGuiElement.setCat(1) elif (cat == '2'): # Séries oGuiElement.setMeta(2) oGuiElement.setCat(2) elif (cat == '3'): # Anime oGuiElement.setMeta(4) oGuiElement.setCat(3) elif (cat == '4'): # Saisons oGuiElement.setMeta(5) oGuiElement.setCat(4) elif (cat == '5'): # Divers oGuiElement.setMeta(0) oGuiElement.setCat(5) elif (cat == '6'): # TV (Officiel) oGuiElement.setMeta(0) oGuiElement.setCat(6) elif (cat == '7'): # Saga oGuiElement.setMeta(3) oGuiElement.setCat(7) elif (cat == '8'): # Episodes oGuiElement.setMeta(6) oGuiElement.setCat(8) else: oGuiElement.setMeta(0) oGuiElement.setCat(cat) oGuiElement.setThumbnail(thumbnail) oGuiElement.setFanart(fanart) oGuiElement.addItemProperties('isBookmark', True) oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'delBookmark', self.ADDON.VSlang(30412)) if (function == 'play'): oGui.addHost(oGuiElement, oOutputParameterHandler) else: oGui.addFolder(oGuiElement, oOutputParameterHandler) except: oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'DoNothing', '[COLOR red]ERROR[/COLOR]', 'films.png', oOutputParameterHandler) # La suppression n'est pas accessible lors de l'utilisation en Widget if not xbmc.getCondVisibility('Window.IsActive(home)'): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', sCat) oGui.addDir(SITE_IDENTIFIER, 'delBookmark', self.ADDON.VSlang(30211), 'trash.png', oOutputParameterHandler) oGui.setEndOfDirectory() return
def getFav(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() row = cDb().get_bookmark() if (oInputParameterHandler.exist('sCat')): sCat = oInputParameterHandler.getValue('sCat') gen = (x for x in row if x[5] in sCat) else: sCat = '5' gen = (x for x in row if x[5] not in ('1', '2', '6')) for data in gen: try: title = data[1].encode('utf-8') except: title = data[1] try: thumbnail = data[6].encode('utf-8') except: thumbnail = data[6] try: try: siteurl = data[2].encode('utf-8') except: siteurl = data[2] if xbmc.getInfoLabel('system.buildversion')[0:2] >= '19': siteurl = UnquotePlus(siteurl.decode('utf-8')) title = str(title, 'utf-8') else: siteurl = UnquotePlus(siteurl) site = data[3] function = data[4] cat = data[5] fanart = data[7] if thumbnail == '': thumbnail = 'False' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteurl) oOutputParameterHandler.addParameter('sMovieTitle', title) oOutputParameterHandler.addParameter('searchtext', title) oOutputParameterHandler.addParameter('sThumbnail', thumbnail) # Dans ajouter source c'est bien sThumb donc... oOutputParameterHandler.addParameter('sThumb', thumbnail) if (function == 'play'): oHoster = cHosterGui().checkHoster(siteurl) oOutputParameterHandler.addParameter( 'sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter( 'sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sMediaUrl', siteurl) oGuiElement = cGuiElement() oGuiElement.setSiteName(site) oGuiElement.setFunction(function) oGuiElement.setTitle(title) oGuiElement.setFileName(title) oGuiElement.setIcon("mark.png") if (cat == '1'): cGui.CONTENT = 'movies' oGuiElement.setMeta(1) oGuiElement.setCat(1) elif (cat == '2'): cGui.CONTENT = 'tvshows' oGuiElement.setMeta(2) oGuiElement.setCat(2) else: oGuiElement.setMeta(0) oGuiElement.setCat(cat) oGuiElement.setThumbnail(thumbnail) oGuiElement.setFanart(fanart) oGuiElement.addItemProperties('isBookmark', True) oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'delBookmark', self.ADDON.VSlang(30412)) if (function == 'play'): oGui.addHost(oGuiElement, oOutputParameterHandler) else: oGui.addFolder(oGuiElement, oOutputParameterHandler) except: oGui.addDir(SITE_IDENTIFIER, 'DoNothing', '[COLOR red]ERROR[/COLOR]', 'films.png', oOutputParameterHandler) # La suppression n'est pas accessible lors de l'utilisation en Widget if not xbmc.getCondVisibility('Window.IsActive(home)'): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', sCat) oGui.addDir(SITE_IDENTIFIER, 'delBookmark', self.ADDON.VSlang(30211), 'trash.png', oOutputParameterHandler) oGui.setEndOfDirectory() return