def onInit(self): self.container = self.getControl(6) self.button = self.getControl(5) self.getControl(3).setVisible(False) self.getControl(1).setLabel('ChangeLog') self.button.setLabel('OK') sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/commits' oRequest = urllib2.Request(sUrl) oResponse = urllib2.urlopen(oRequest) sContent = oResponse.read() result = json.loads(sContent) listitems = [] for item in result: #autor icon = item['author']['avatar_url'] login = item['author']['login'] #message try: desc = item['commit']['message'].encode("utf-8") except: desc = 'None' listitem = xbmcgui.ListItem(label = login, label2 = desc) listitem.setArt({'icon' : icon, 'thumb' : icon}) listitems.append(listitem) self.container.addItems(listitems) self.setFocus(self.container)
def getDownload(self): oGui = cGui() sPluginHandle = cPluginHandler().getPluginHandle() sPluginPath = cPluginHandler().getPluginPath() sItemUrl = '%s?site=%s&function=%s&title=%s' % (sPluginPath, SITE_IDENTIFIER, 'StartDownloadList', 'title') meta = {'title': 'Démarrer la liste'} item = xbmcgui.ListItem('Démarrer la liste', iconImage = 'special://home/addons/plugin.video.matrix/resources/art/download.png') #item.setInfo(type='Video', infoLabels = meta) #item.setProperty('Video', 'false') #item.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, item, isFolder = False) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'StopDownloadList', 'Arrêter les Téléchargements', 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'getDownloadList', 'Liste de Téléchargement', 'az.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'CleanDownloadList', 'Nettoyer la liste (Fichiers finis)', 'download.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def onInit(self): self.container = self.getControl(6) self.button = self.getControl(5) self.getControl(3).setVisible(False) self.getControl(1).setLabel(self.ADDON.VSlang(30094)) self.button.setLabel('OK') listitems = [] oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAllPlugins() for aPlugin in aPlugins: #teste si deja dans le dsip sPluginSettingsName = 'plugin_' +aPlugin[1] bPlugin = self.ADDON.getSetting(sPluginSettingsName) #icon = os.path.join(unicode(cConfig().getRootArt(), 'utf-8'), 'sites', aPlugin[1]+'.png') icon = "special://home/addons/plugin.video.vstream/resources/art/sites/%s.png" % aPlugin[1] stitle = aPlugin[0].replace('[COLOR violet]','').replace('[COLOR orange]','').replace('[/COLOR]','').replace('[COLOR dodgerblue]','').replace('[COLOR coral]','') if (bPlugin == 'true'): stitle = ('%s %s') % (stitle, valid) listitem = xbmcgui.ListItem(label = stitle, label2 = aPlugin[2]) listitem.setArt({'icon' : icon, 'thumb' : icon}) listitem.setProperty('Addon.Summary', aPlugin[2]) listitem.setProperty('sitename', aPlugin[1]) if (bPlugin == 'true'): listitem.select(True) listitems.append(listitem) self.container.addItems(listitems) self.setFocus(self.container)
def parseWebM3U():#Traite les m3u oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sHtmlContent = getHtml(sUrl) #cConfig().log(str(sUrl)) line = re.compile('EXTINF:.+?,(.+?)\n(.+?)\n').findall(sHtmlContent) for sTitle, sUrl2 in line: sUrl2 = sUrl2.replace('\r','') #with open('D:\\playlist.m3u', 'r+b') as f: # f.seek(0,2) # f.write('\n'+'#EXTINF:-1,'+sTitle) # f.write('\n'+sUrl2) icon = "tv.png" if '.ts' in sUrl2: sUrl2 = 'plugin://plugin.video.f4mTester/?url='+urllib.quote_plus(sUrl2)+'&streamtype=TSDOWNLOADER&name='+urllib.quote(sTitle) ok = True liz = xbmcgui.ListItem(sTitle, iconImage="DefaultVideo.png", thumbnailImage=icon) commands = [] direct_epg_url= "plugin://plugin.video.vstream/?site=freebox&function=direct_epg&sMovieTitle="+urllib.quote(sTitle)+"&siteUrl="+urllib.quote_plus(sUrl2)+"&sFav=play__&sThumbnail="+urllib.quote(icon)+"&sId=freebox&sCat=6" commands.append(( "Direct Epg" , 'RunPlugin('+ direct_epg_url +')')) soir_epg_url = "plugin://plugin.video.vstream/?site=freebox&function=soir_epg&sMovieTitle="+urllib.quote(sTitle)+"&siteUrl="+urllib.quote_plus(sUrl2)+"&sFav=play__&sThumbnail="+urllib.quote(icon)+"&sId=freebox&sCat=6" commands.append(( "Soir Epg" , 'RunPlugin('+ soir_epg_url +')')) liz.addContextMenuItems( commands ) liz.setArt({'thumb': icon, 'icon': icon}) liz.setInfo(type="Video", infoLabels={"Title": sTitle}) video_streaminfo = {'codec': 'h264'} liz.addStreamInfo('video', video_streaminfo) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sUrl2, listitem=liz, isFolder=False) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def play__(): #Lancer les liens oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') #Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) playmode = '' if playmode == 0: stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=sThumbnail) return listitem = xbmcgui.ListItem(sTitle, iconImage="DefaultVideo.png", thumbnailImage=sThumbnail) listitem.setInfo('video', {'Title': sTitle}) listitem.setProperty("IsPlayable", "true") #xbmc.Player().play(sUrl, listitem) if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') else: xbmc.Player().play(sUrl, listitem) return
def play2__():#Lancer les liens iptv oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') listitem = xbmcgui.ListItem(sTitle, iconImage="DefaultVideo.png", thumbnailImage=sThumbnail) listitem.setInfo('video', {'Title': sTitle}) listitem.setProperty("IsPlayable", "true") #xbmc.Player().play(sUrl, listitem) if 'f4mTester' in sUrl: if not xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')'): dialog().VSerror('Verifer fM4Tester') else: if not xbmc.Player().play(sUrl, listitem): dialog().VSerror('Connexion Impossible') return
def getDownload(self): oGui = cGui() sPluginHandle = cPluginHandler().getPluginHandle() sPluginPath = cPluginHandler().getPluginPath() sItemUrl = '%s?site=%s&function=%s&title=%s' % ( sPluginPath, SITE_IDENTIFIER, 'StartDownloadList', 'title') meta = {'title': 'Démarrer la liste'} item = xbmcgui.ListItem( 'Démarrer la liste', iconImage= 'special://home/addons/plugin.video.vstream/resources/art/download.png' ) # item.setInfo(type='Video', infoLabels=meta) # item.setProperty('Video', 'false') # item.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, item, isFolder=False) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'StopDownloadList', self.ADDON.VSlang(30025), 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'getDownloadList', self.ADDON.VSlang(30039), 'listes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'CleanDownloadList', self.ADDON.VSlang(30040), 'download.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def checkdownload(self): addons = addon() dialogs = dialog() if dialogs.VSyesno("Êtes-vous sûr?"): service_futur = addons.getSetting('service_futur') service_version = addons.getSetting('service_version') if not service_futur: return self.getUpdate() if not service_version: return self.getUpdate() #result = self.resultGit() sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/compare/%s...%s' % ( service_version, service_futur) #pour test #sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/compare/0.6.3...0.6.31' oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() result = json.loads(sHtmlContent) progress_ = progress() progress_.VScreate('Update') addons = addon() #site = '' sdown = 0 add = 0 dell = 0 schange = 0 text = '' listitems = [] if result: #boucle download fichier total = len(result['files']) for i in result['files']: if 'plugin.video.vstream' in i['filename']: progress_.VSupdate(progress_, total) rootpath = self.getRootPath(i['filename']) try: self.__download(i['raw_url'], rootpath) #site += "Add: [B]%s[/B] | Del: [B]%s[/B] | [COLOR green]%s[/COLOR][CR]" % (i['additions'], i['deletions'], i['filename'].encode("utf-8")) add += i['additions'] dell += i['deletions'] sdown = sdown + 1 schange += i['changes'] except: #site += "[COLOR red]"+i['filename'].encode("utf-8")+"[/COLOR][CR]" sdown = sdown + 1 pass progress_.VSclose(progress_) #donner fichier sContent = "Ajouter (%s) | Supprimer (%s) | Changement (%s) [CR]Fichiers mise à jour %s / %s" % ( add, dell, schange, sdown, total) listitem = xbmcgui.ListItem(label="vStream", label2=sContent) icon = "special://home/addons/plugin.video.vstream/resources/art/update.png" listitem.setArt({'icon': icon, 'thumb': icon}) listitems.append(listitem) #boucle commit for i in result['commits']: try: #text += "[B]%s[/B]: %s[CR]" % (i['commit']['author']['name'], i['commit']['message'].encode("utf-8")) icon = i['author']['avatar_url'] login = i['author']['login'] desc = i['commit']['message'].encode("utf-8") listitem = xbmcgui.ListItem(label=login, label2=desc) listitem.setArt({'icon': icon, 'thumb': icon}) except: #text += "[B]%s[/B]: nop[CR]" % (i['commit']['author']['name']) listitem = xbmcgui.ListItem(label='None', label2='none') pass listitems.append(listitem) #sContent = "Changement (%s) | Fichiers mise à jour %s / %s [CR]" % (schange, sdown, total) #sContent += "%s" % (text.encode("utf-8")) #sContent += "%s" % (site) addons.setSetting('service_time', str(datetime.datetime.now())) addons.setSetting('service_version', str(service_futur)) addons.setSetting('home_update', str('false')) #fin = dialog().VSok(sContent) #fin = self.TextBoxes(sContent) fin = self.Box(listitems) return