def download_karaoke_file(url, dest, displayname=False): print 'Downloading karaoke file' print 'URL: %s' % url print 'Destination: %s' % dest if not displayname: displayname = url dlg = xbmcgui.DialogProgress() dlg.create(__addonname__, __language__(70130), displayname) start_time = time.time() if os.path.isfile(dest): print 'File to be downloaded already esists' return True try: urllib.urlretrieve( url, dest, lambda nb, bs, fs: _pbhook(nb, bs, fs, dlg, start_time)) except: #only handle StopDownloading (from cancel), #ContentTooShort (from urlretrieve), and OS (from the race condition); #let other exceptions bubble if sys.exc_info()[0] in (urllib.ContentTooShortError, StopDownloading, OSError): return False else: buggalo.onExceptionRaised() #buggalo.onExceptionRaised(url + " - " + dest) return True
def PseudoTV(): try: import resources.lib.Overlay as Overlay if hasVersionChanged(__version__) == True: return HandleUpgrade() setProperty("PseudoTVRunning", "True") while getProperty("PseudoTVService") == "True": xbmc.sleep(25) if preStart() == True: MyOverlayWindow = Overlay.TVOverlay("script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) for curthread in threading.enumerate(): log("Active Thread: " + str(curthread.name)) if curthread.name != "MainThread": try: curthread.join() log("Joined Thread: " + str(curthread.name)) except: pass del MyOverlayWindow except Exception,e: log('default: PseudoTV Overlay Failed! ' + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def SetPluginArt_NEW(self, mediapath, arttype): self.log('SetPluginArt_NEW') self.log('SetPluginArt, mediapath = ' + mediapath) setImage = '' try: plugin = os.path.split(mediapath.replace('plugin://', '')) addon = os.path.split(plugin[0])[1] YTid = (plugin[1]).replace('?video_id=', '').replace( '?action=play_video&videoid=', '') youtube = ['plugin.video.bromix.youtube', 'plugin.video.youtube'] if addon in youtube: self.log('SetPluginArt, Youtube') setImage = "http://img.youtube.com/vi/" + YTid + "/0.jpg" # else: # self.log('SetPluginArt, JsonThumb') # setImage = self.JsonThumb(mediapath) if not setImage: self.log('SetPluginArt, PluginIcon') icon = 'special://home/addons/' + YTid + '/icon.png' fanart = 'special://home/addons/' + YTid + '/fanart.jpg' if FileAccess.exists(xbmc.translatePath(icon)): setImage = icon except Exception: buggalo.onExceptionRaised() return setImage
def JsonArtwork(self, mediapath, type, arttype, media='video'): self.log("JsonArtwork") arttype = arttype.replace('folder', 'poster').replace( 'character', 'characterart').replace('logo', 'clearlogo').replace( 'disc', 'discart') #correct search names arttype = ((type + '.' + arttype if type == 'tvshow' else arttype)) fletype = '' file_detail = [] try: chanlist = ChannelList() json_query = uni( '{"jsonrpc":"2.0","method":"Files.GetDirectory","params":{"directory":"%s","media":"%s","properties":["art"]},"id":10}' % (chanlist.escapeDirJSON(mediapath), media)) json_folder_detail = chanlist.sendJSON(json_query) file_detail = re.compile("{(.*?)}", re.DOTALL).findall(json_folder_detail) for f in file_detail: arttypes = re.search(('"%s" *: *"(.*?)"' % arttype), f) if arttypes != None and len(arttypes.group(1)) > 0: fletype = (unquote( (arttypes.group(1).split(','))[0])).replace( 'image://', '').replace('.jpg/', '.jpg').replace('.png/', '.png') break except Exception: buggalo.onExceptionRaised() self.log("JsonArtwork, fletype = " + fletype) return fletype
def PseudoTV(): import resources.lib.Overlay as Overlay try: MyOverlayWindow = Overlay.TVOverlay( "script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) except: MyOverlayWindow = Overlay.TVOverlay("script.pseudotv.TVOverlay.xml", __cwd__, Skin_Select) for curthread in threading.enumerate(): try: log("Active Thread: " + str(curthread.name), xbmc.LOGERROR) if curthread.name != "MainThread": try: curthread.join() except Exception: buggalo.onExceptionRaised() pass log("Joined " + curthread.name) except Exception: buggalo.onExceptionRaised() pass del MyOverlayWindow xbmcgui.Window(10000).setProperty("PseudoTVRunning", "False")
def onPlayBackStarted(self): try: # ListItem.Duration je z databáze, bývá nepřesná v řádech minut # Player.TimeRemaining je přesnější if self.titulky is not None: self.setSubtitles(self.titulky[0]) while True: xbmc.sleep(1000) self.itemDuration = xbmc.getInfoLabel( 'Player.TimeRemaining(hh:mm:ss)') if (self.itemDuration != '') and (self.itemDuration != '00:00:00'): self.itemDuration = self.get_sec(self.itemDuration) break # plánovaný čas dokončení 100 % přehrání self.estimateFinishTime = xbmc.getInfoLabel( 'Player.FinishTime(hh:mm:ss)') if (not self.pomSlovnik) or (not self.itemDBID in self.pomSlovnik): return self.seekTime(self.pomSlovnik[self.itemDBID]) del self.pomSlovnik[self.itemDBID] except Exception: buggalo.onExceptionRaised({ 'self.itemDuration: ': self.itemDuration, 'self.estimateFinishTime: ': self.estimateFinishTime, 'pomSlovnik: ': json.dumps(self.pomSlovnik, indent=2) })
def eventLoop(self): dixie.log('Database.eventLoop() >>>>>>>>>> starting...') while True: self.event.wait() self.event.clear() event = self.eventQueue.pop(0) command = event[0] callback = event[1] dixie.log('Database.eventLoop() >>>>>>>>>> processing command: %s' % command.__name__) try: result = command(*event[2:]) self.eventResults[command.__name__] = result if callback: if self._initializeS == command: threading.Thread(name='Database callback', target=callback, args=[result]).start() elif self._initializeP == command: threading.Thread(name='Database callback', target=callback, args=[result]).start() else: threading.Thread(name='Database callback', target=callback).start() if self._close == command: del self.eventQueue[:] break except Exception, e: dixie.log('Database.eventLoop() >>>>>>>>>> exception! %s' % str(e)) buggalo.onExceptionRaised()
def Fanart_Download(self, type, arttype, id, FilePath): try: if type == 'tvshow': arttype = arttype.replace('graphical', 'banner').replace('folder', 'poster').replace('fanart', 'landscape') fan = str(self.fanarttv.get_image_list_TV(id)) file_detail = re.compile( "{(.*?)}", re.DOTALL ).findall(fan) pref_language = self.fanarttv.get_abbrev(REAL_SETTINGS.getSetting('limit_preferred_language')) for f in file_detail: languages = re.search("'language' *: *(.*?),", f) art_types = re.search("'art_type' *: *(.*?),", f) fanPaths = re.search("'url' *: *(.*?),", f) if languages and len(languages.group(1)) > 0: language = (languages.group(1)).replace("u'",'').replace("'",'') if language == pref_language: if art_types and len(art_types.group(1)) > 0: art_type = art_types.group(1).replace("u'",'').replace("'",'').replace("[",'').replace("]",'') if art_type.lower() == arttype.lower(): if fanPaths and len(fanPaths.group(1)) > 0: fanPath = fanPaths.group(1).replace("u'",'').replace("'",'') if fanPath.startswith('http'): download_silent(fanPath,FilePath) break except Exception,e: self.log("script.pseudotv.live-Artdownloader: Fanart_Download Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def SetDefaultArt(self, chname, mpath, arttypeEXT): self.logDebug('SetDefaultArt, chname = ' + chname + ', arttypeEXT = ' + arttypeEXT) try: setImage = '' arttype = arttypeEXT.split(".")[0] MediaImage = os.path.join(MEDIA_LOC, (arttype + '.png')) StockImage = os.path.join(IMAGES_LOC, (arttype + '.png')) ChannelLogo = os.path.join(LOGO_LOC,chname[0:18] + '.png') if FileAccess.exists(ChannelLogo): self.logDebug('SetDefaultArt, Channel Logo') return ChannelLogo elif mpath[0:6] == 'plugin': self.logDebug('SetDefaultArt, Plugin Icon') icon = 'special://home/addons/'+(mpath.replace('plugin://',''))+ '/icon.png' return icon elif FileAccess.exists(MediaImage): self.logDebug('SetDefaultArt, Media Image') return MediaImage elif FileAccess.exists(StockImage): self.logDebug('SetDefaultArt, Stock Image') return StockImage else: self.logDebug('SetDefaultArt, THUMB') return THUMB except Exception,e: self.log("script.pseudotv.live-Artdownloader: SetDefaultArt Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def DownloadMetaArt(self, type, fle, id, typeEXT, ART_LOC): self.log('DownloadMetaArt') ArtPath = os.path.join(ART_LOC, fle) setImage = '' if type == 'tvshow': Tid = id Mid = '' else: Mid = id Tid = '' typeEXT = typeEXT.split('.')[0] typeEXT = typeEXT.replace('landscape', 'backdrop_url').replace( 'fanart', 'backdrop_url').replace('logo', 'backdrop_url').replace( 'clearart', 'backdrop_url').replace('poster', 'cover_url').replace( 'banner', 'banner_url') try: self.log('DownloadMetaArt, metahander') self.metaget = metahandlers.MetaData(preparezip=False) ImageURL = str( self.metaget.get_meta(type, '', imdb_id=str(Mid), tmdb_id=str(Tid)))[typeEXT] resource = urllib.urlopen(ImageURL) output = FileAccess.open(ArtPath, 'w') output.write(resource.read()) output.close() setImage = ArtPath except Exception: buggalo.onExceptionRaised() return setImage
def onPlayBackStopped(self): try: # Player.TimeRemaining - už zde nemá hodnotu # Player.FinishTime - kdy přehrávání skutečně zkončilo timeDifference = 55555 timeRatio = 55555 self.realFinishTime = xbmc.getInfoLabel( 'Player.FinishTime(hh:mm:ss)') timeDifference = self.get_sec(self.estimateFinishTime) - \ self.get_sec(self.realFinishTime) timeRatio = timeDifference.seconds / \ float((self.itemDuration).seconds) # upravit podmínku na 0.05 tj. zbývá shlédnout 5% if abs(timeRatio) < 0.1: self.setWatched() else: self.createResumePoint((1 - timeRatio) * float( (self.itemDuration).seconds), float((self.itemDuration).seconds)) except Exception: buggalo.onExceptionRaised({ 'self.itemDuration: ': self.itemDuration, 'self.estimateFinishTime: ': self.estimateFinishTime, 'self.realFinishTime: ': self.realFinishTime, 'timeDifference: ': timeDifference, 'timeRatio: ': timeRatio, })
def SetDefaultArt(self, chname, mpath, arttypeEXT): self.logDebug('SetDefaultArt, chname = ' + chname + ', arttypeEXT = ' + arttypeEXT) try: setImage = '' arttype = arttypeEXT.split(".")[0] MediaImage = os.path.join(MEDIA_LOC, (arttype + '.png')) StockImage = os.path.join(IMAGES_LOC, (arttype + '.png')) ChannelLogo = os.path.join(LOGO_LOC, chname[0:18] + '.png') if FileAccess.exists(ChannelLogo): self.logDebug('SetDefaultArt, Channel Logo') return ChannelLogo elif mpath[0:6] == 'plugin': self.logDebug('SetDefaultArt, Plugin Icon') icon = 'special://home/addons/' + (mpath.replace( 'plugin://', '')) + '/icon.png' return icon elif FileAccess.exists(MediaImage): self.logDebug('SetDefaultArt, Media Image') return MediaImage elif FileAccess.exists(StockImage): self.logDebug('SetDefaultArt, Stock Image') return StockImage else: self.logDebug('SetDefaultArt, THUMB') return THUMB except Exception, e: self.log( "script.pseudotv.live-Artdownloader: SetDefaultArt Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def PseudoTV(): try: import resources.lib.Overlay as Overlay if hasVersionChanged(__version__) == True: return HandleUpgrade() setProperty("PseudoTVRunning", "True") while getProperty("PseudoTVService") == "True": xbmc.sleep(25) if preStart() == True: MyOverlayWindow = Overlay.TVOverlay( "script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) for curthread in threading.enumerate(): log("Active Thread: " + str(curthread.name)) if curthread.name != "MainThread": try: curthread.join() log("Joined Thread: " + str(curthread.name)) except: pass del MyOverlayWindow except Exception, e: log('default: PseudoTV Overlay Failed! ' + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def PseudoTV(): import resources.lib.Overlay as Overlay xbmcgui.Window(10000).setProperty("PseudoTVRunning", "True") try: MyOverlayWindow = Overlay.TVOverlay("script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) except Exception: buggalo.addExtraData("Skin_Select = ", str(Skin_Select)) buggalo.onExceptionRaised() Error('PseudoTV Lite','Error loading "' + Skin_Select + '" skin!','Verify selected skin in settings') return for curthread in threading.enumerate(): try: log("Active Thread: " + str(curthread.name), xbmc.LOGERROR) if curthread.name != "MainThread": try: curthread.join() except: pass log("Joined " + curthread.name) except: pass del MyOverlayWindow xbmcgui.Window(10000).setProperty("PseudoTVRunning", "False")
def getUnzipped(theurl, thedir, thename, generalid): """Args: * theurl: The URL where the zip can be downloaded * thedir: The directory where the zipfile should be saved into * thename: The complete filename of the zipfile Function: Retrieves the zipfile from the URL location given, using urlresolver. The function then unzips the file. WORKAROUND INCLUDED: xbmc.extract can't handle a comma in the filename ( up to v12: Frodo) The script will remove any comma's in the name of the filename """ theoldname = thename name = os.path.join(thedir, thename) try: if not os.path.exists(thedir): os.makedirs(thedir) except Exception: buggalo.onExceptionRaised() #buggalo.onExceptionRaised(thedir) print 'can\'t create directory (' + thedir + ')' return #try: print theurl[0:25] if urlresolver.HostedMediaFile(theurl).valid_url() or theurl[0:25] == "http://www.mediafire.com/": try: if theurl[0:25] == "http://www.mediafire.com/": url = theurl else: url = urlresolver.resolve(theurl) print 'translated link: ' + url if download_karaoke_file(url, name, name): # Code to circumvent a bug in URIUtils::HasExtension thenewname = theoldname.replace(",", "") if thenewname != theoldname: newname = os.path.join(thedir, thenewname) os.rename(name, newname) name = newname # Python unzip is rubbish!!! gave me corrupted unzips every time xbmc.executebuiltin('xbmc.extract(' + name + ')', True) # Remove the zip file os.unlink(name) return 1 else: reportFile('brokenlink', generalid, thename, theurl); xbmcgui.Dialog().ok(__addonname__, __language__(70120), __language__(70121), '') return 0 except: xbmcgui.Dialog().ok(__addonname__, __language__(70126), __language__(70127), __language__(70121)) return 0 else: reportFile('brokenlink', generalid, thename, theurl); xbmcgui.Dialog().ok(__addonname__, __language__(70122), __language__(70121), '') return 0 return 0
def getConfigInfo(): try: _json = utils.loadJsonFromUrl(jsonurl + "config.php?version=" + __addon__.getAddonInfo('version')) if _json == None: xbmcgui.Dialog().ok(__addonname__, ' ', __language__(70111)) return filename = _json[0]['full_file_name'] urlname = _json[0]['url_name'] print filename print urlname if filename == None and urlname == None: xbmcgui.Dialog().ok(__addonname__, ' ', __language__(70117)) donotloaddir = 1 return line1 = "This is a simple example of OK dialog" line2 = "Showing this message using" line3 = "XBMC python modules" xbmcgui.Dialog().ok(__addonname__, line1, line2, line3) except Exception as e: buggalo.onExceptionRaised() print (e)
def PseudoTV(): try: setProperty("PseudoTVRunning", "True") import resources.lib.Overlay as Overlay if hasVersionChanged(__version__) == True: HandleUpgrade() else: chkVersion() preStart() MyOverlayWindow = Overlay.TVOverlay("script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) for curthread in threading.enumerate(): log("Active Thread: " + str(curthread.name), xbmc.LOGERROR) if curthread.name != "MainThread": try: curthread.join() except: pass log("Joined " + curthread.name) del MyOverlayWindow setProperty("PseudoTVRunning", "False") except Exception,e: log('default: PseudoTV Overlay Failed! ' + str(e)) setProperty("PseudoTVRunning", "False") buggalo.onExceptionRaised() return
def __init__(self, itemType=None, itemDBID=None, slovnik=None, titulky=None): try: xbmc.Player.__init__(self) self.estimateFinishTime = '00:00:00' self.realFinishTime = '00:00:00' self.itemDuration = '00:00:00' self.itemDBID = itemDBID self.itemType = itemType self.pomSlovnik = slovnik self.titulky = titulky # dummy call to fix weird error see: # http://bugs.python.org/issue7980 try: datetime.strptime('2012-01-01', '%Y-%m-%d') except TypeError: datetime(*(time.strptime('2012-01-01', '%Y-%m-%d')[0:6])) except Exception: buggalo.onExceptionRaised({ 'self.itemDBID: ': self.itemDBID, 'self.itemType: ': self.itemType })
def DownloadMetaArt(self, type, fle, id, typeEXT, ART_LOC): self.log('DownloadMetaArt') ArtPath = os.path.join(ART_LOC, fle) setImage = '' if type == 'tvshow': Tid = id Mid = '' else: Mid = id Tid = '' typeEXT = typeEXT.split('.')[0] typeEXT = typeEXT.replace('landscape','backdrop_url').replace('fanart','backdrop_url').replace('logo','backdrop_url').replace('clearart','backdrop_url').replace('poster','cover_url').replace('banner','banner_url') try: self.log('DownloadMetaArt, metahander') self.metaget = metahandlers.MetaData(preparezip=False) ImageURL = str(self.metaget.get_meta(type, '', imdb_id=str(Mid), tmdb_id=str(Tid)))[typeEXT] resource = urllib.urlopen(ImageURL) output = FileAccess.open(ArtPath, 'w') output.write(resource.read()) output.close() setImage = ArtPath except Exception: buggalo.onExceptionRaised() return setImage
def eventLoop(self): print 'Database.eventLoop() >>>>>>>>>> starting...' while True: self.event.wait() self.event.clear() event = self.eventQueue.pop(0) command = event[0] callback = event[1] print 'Database.eventLoop() >>>>>>>>>> processing command: ' + command.__name__ try: result = command(*event[2:]) self.eventResults[command.__name__] = result if callback: if self._initialize == command: threading.Thread(name='Database callback', target=callback, args=[result]).start() else: threading.Thread(name='Database callback', target=callback).start() if self._close == command: del self.eventQueue[:] break except Exception: print 'Database.eventLoop() >>>>>>>>>> exception!' buggalo.onExceptionRaised() print 'Database.eventLoop() >>>>>>>>>> exiting...'
def KARAOKELINKS(url, id, tempkey): url = url + '?generalid='+ str(id) url = url + '&tempkey='+ str(tempkey) print jsonurl + url try: _json = loadJsonFromUrl(jsonurl + url) filename = _json[0]['full_file_name'] urlname = _json[0]['url_name'] print filename print urlname timestr = time.strftime("%Y%m%d%H%M%S") fullDir = os.path.join(PATH, TEMP_DL_DIR + timestr) #delete directory deleteDir(fullDir) print 'den dir' print fullDir #download new file getUnzipped(urlname, fullDir, filename, id) #fullFilePath = os.path.splitext(os.path.join(fullDir, filename))[0] #fullFilePath = fullFilePath + '.mp3' os.chdir(fullDir) i = 1 for files in glob.glob("*.mp3"): if i == 1: i = 2 xbmc.Player().play(os.path.join(fullDir, files)) if len(glob.glob("*.mp3")) < 1: reportFile('badzip', id, filename, urlname); xbmcgui.Dialog().ok(__addonname__, __language__(70123), __language__(70124), __language__(70125)) #xbmcplugin.endOfDirectory(int(sys.argv[1])) #while xbmc.Player().isPlaying(): # print 'sleeping...' # xbmc.sleep(1000) #def addDir(name,url,mode,iconimage,page, id, param1, param2="", isfolder=True): liz=xbmcgui.ListItem('', '', iconImage='DefaultAlbumCover.png', thumbnailImage='') #liz.setInfo( type='music', infoLabels={ 'Title': name, 'count': id} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url='',listitem=liz,isFolder=False) except Exception as e: buggalo.onExceptionRaised() print (e)
def createResumePoint(self, seconds, total): try: pomer = seconds / total if pomer < 0.05: return self.pomSlovnik.update({self.itemDBID: seconds}) except Exception: buggalo.onExceptionRaised({'seconds: ': seconds}) return
def ConvertBug(self, org, mod): self.log("ConvertBug") try: org = xbmc.translatePath(org) original = Image.open(org) converted_img = original.convert('LA') converted_img.save(mod) except Exception: buggalo.onExceptionRaised() return mod
def _resolve(self, itm): if itm is None: return None if itm.get('provider') == 'plugin.video.online-files' and itm.get( 'params').get('cp') == 'webshare.cz': if self.parent.getSetting('wsuser') != "": try: from myprovider.webshare import Webshare as wx self.ws = wx(self.parent.getSetting('wsuser'), self.parent.getSetting('wspass')) if not self.ws.login(): res = sctop.yesnoDialog(sctop.getString(30945), sctop.getString(30946), "") if res == True: sctop.openSettings('201.101') return None else: udata = self.ws.userData() util.debug("[SC] udata: %s" % str(udata)) if udata == False: util.debug("[SC] NIEJE VIP ucet") sctop.infoDialog(sctop.getString(30947), icon="WARNING") sctop.sleep(5000) elif int(udata) <= 14: sctop.infoDialog(sctop.getString(30948) % str(udata), icon="WARNING") util.debug("[SC] VIP ucet konci") itm['url'] = self.ws.resolve( itm.get('params').get('play').get('ident')) except: buggalo.onExceptionRaised() pass else: sctop.infoDialog(sctop.getString(30945), icon="WARNING") #sctop.openSettings('0.1') else: try: raise ResolveException('zatial nic...') hmf = urlresolver.HostedMediaFile(url=itm['url'], include_disabled=False, include_universal=False) if hmf.valid_url() is True: try: itm['url'] = hmf.resolve() except: pass except: pass itm['title'] = self.parent.encode(itm['title']) return itm
def fillSources(self, type, source, path=None): self.log("fillSources") dlg = xbmcgui.Dialog() print source, type, path # Parse Source, return title, path try: if source == 'PVR': self.log("PVR") retval = dlg.browse(1, "Select File", "video", "", False, False, "pvr://") if len(retval) > 0: return retval, retval elif source == 'HDhomerun': self.log("HDhomerun") xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % ("PseudoTV Lite", "Coming Soon", 4000, THUMB)) elif source == 'Local Video': self.log("Local Video") retval = dlg.browse( 1, "Select File", "video", ".avi|.mp4|.m4v|.3gp|.3g2|.f4v|.mov|.mkv|.flv|.ts|.m2ts|.strm", False, False, "") if len(retval) > 0: return retval, retval elif source == 'Local Music': self.log("Local Music") retval = dlg.browse(1, "Select File", "music", ".mp3|.flac|.mp4", False, False, "") if len(retval) > 0: return retval, retval elif source == 'UPNP': self.log("UPNP") retval = dlg.browse(1, "Select File", "video", "", False, False, "upnp://") return retval elif source == 'Kodi Favourites': self.log("Kodi Favourites") select = selectDialog(self.FavouritesNameList, 'Select Favourites') return self.FavouritesNameList[ select], self.FavouritesPathList[select] elif source == 'URL': self.log("URL") input = dlg.input('Enter URL', type=xbmcgui.INPUT_ALPHANUM) if len(input) > 0: return input, input else: return except: xbmc.executebuiltin("Dialog.Close(busydialog)") buggalo.onExceptionRaised()
def createResumePoint(self, seconds, total): if 1 or self.scid is None: return try: pomer = seconds / total if pomer < 0.05: return resume = self.parent.getResumePoint() resume.update({self.scid: seconds}) self.parent.setResumePoint(resume) except Exception: buggalo.onExceptionRaised({'seconds: ': seconds}) return
def setControls(self): # set heading #heading = "PrimeWire v%s" % (_1CH.get_version()) try: _json = loadJsonFromUrl(jsonurl + "search.php?type=getwelcome") if _json == None: xbmcgui.Dialog().ok(__addonname__, ' ', __language__(70111)) return heading = _json[0]['welcome_header'] text = _json[0]['welcome_content'] except Exception as e: buggalo.onExceptionRaised() print (e) self.win.getControl(self.CONTROL_LABEL).setLabel(heading) self.win.getControl(self.CONTROL_TEXTBOX).setText(text)
def main(doLogin=True): dixie.CheckUsername() import message message.check() CheckChanXML() CheckSkin() CheckLogos() dixie.ShowBusy() import buggalo import gui buggalo.GMAIL_RECIPIENT = '*****@*****.**' try: if not dixie.validToRun(): dixie.notify('Failed to obtain a response from On-Tapp.TV') return CheckVersion() CheckSkinVersion() CheckLogoVersion() CheckIniVersion() CheckFilmOn() CheckForUpdate() CheckForChannels() dixie.log('****** OnTapp.TV - All OK *******') dixie.CloseBusy() xbmcgui.Window(10000).setProperty('OTT_RUNNING', 'True') xbmc.executebuiltin('XBMC.ActivateWindow(home)') w = gui.TVGuide() CopyKeymap() w.doModal() RemoveKeymap() del w xbmcgui.Window(10000).clearProperty('OTT_RUNNING') except Exception: buggalo.onExceptionRaised()
def DownloadArt(self, type, id, arttype, arttype_fallback, cachefile, chname, mpath, arttypeEXT): self.log('DownloadArt') try: data = [type, id, arttype, arttype_fallback, cachefile, chname, mpath, arttypeEXT] try: if self.DownloadArtTimer.isAlive(): self.DownloadArtTimer.cancel() self.DownloadArtTimer.join() except: pass self.DownloadArtTimer = threading.Timer(0.5, self.DownloadArt_Thread, [data]) self.DownloadArtTimer.name = "DownloadArtTimer" self.DownloadArtTimer.start() # Sleep between Download, keeps cpu usage down and reduces the number of simultaneous threads. xbmc.sleep(500) except Exception,e: self.log("script.pseudotv.live-Artdownloader: DownloadArt Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def __init__(self): xbmc.log("version %s started" % addon_version) xbmc.executebuiltin('SetProperty(extendedinfo_running,True,home)') try: self._parse_argv() if self.infos: self.control = StartInfoActions(self.infos, self.params) elif not self.handle: import DialogVideoList dialog = DialogVideoList.DialogVideoList( u'script-%s-VideoList.xml' % addon_name, addon_path) dialog.doModal() if self.control == "plugin": xbmcplugin.endOfDirectory(self.handle) xbmc.executebuiltin('ClearProperty(extendedinfo_running,home)') except Exception: xbmc.executebuiltin('Dialog.Close(busydialog)') buggalo.onExceptionRaised() xbmc.executebuiltin('ClearProperty(extendedinfo_running,home)')
def FindBug(self, chtype, chname): self.logDebug("FindBug, chname = " + chname) try: setImage = '' BugName = (chname[0:18] + '.png') BugFLE = xbmc.translatePath(os.path.join(LOGO_LOC, BugName)) cachedthumb = xbmc.getCacheThumbName(BugFLE) cachefile = xbmc.translatePath( os.path.join(ART_LOC, cachedthumb[0], cachedthumb[:-4] + ".png")).replace("\\", "/") if REAL_SETTINGS.getSetting('UNAlter_ChanBug') == 'true': if chname == 'OnDemand': DefaultBug = os.path.join(IMAGES_LOC, 'ondemand.png') else: DefaultBug = os.path.join(IMAGES_LOC, 'logo.png') else: if chname == 'OnDemand': DefaultBug = os.path.join(IMAGES_LOC, 'Default_ondemand.png') else: DefaultBug = os.path.join(IMAGES_LOC, 'Default.png') if chtype == 8: return 'NA.png' else: if REAL_SETTINGS.getSetting('UNAlter_ChanBug') == 'true': if not FileAccess.exists(BugFLE): BugFLE = DefaultBug return BugFLE else: if FileAccess.exists(cachefile): return cachefile else: if not FileAccess.exists(BugFLE): return DefaultBug else: return self.ConvertBug(BugFLE, cachefile) except Exception, e: self.log( "script.pseudotv.live-Artdownloader: FindBug Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def updateTimebar(self, scheduleTimer = True): try: # move timebar to current time timeDelta = datetime.datetime.today() - self.viewStartDate control = self.getControl(self.C_MAIN_TIMEBAR) if control: (x, y) = control.getPosition() try: # Sometimes raises: # exceptions.RuntimeError: Unknown exception thrown from the call "setVisible" control.setVisible(timeDelta.days == 0) except: pass control.setPosition(self._secondsToXposition(timeDelta.seconds), y) if scheduleTimer and not xbmc.abortRequested and not self.isClosing: threading.Timer(1, self.updateTimebar).start() except Exception: buggalo.onExceptionRaised()
def fillSources(self, type, source, path=None): self.log("fillSources") dlg = xbmcgui.Dialog() print source, type, path # Parse Source, return title, path try: if source == 'PVR': self.log("PVR") retval = dlg.browse(1, "Select File", "video", "", False, False, "pvr://") if len(retval) > 0: return retval, retval elif source == 'HDhomerun': self.log("HDhomerun") xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ("PseudoTV Lite", "Coming Soon", 4000, THUMB) ) elif source == 'Local Video': self.log("Local Video") retval = dlg.browse(1, "Select File", "video", ".avi|.mp4|.m4v|.3gp|.3g2|.f4v|.mov|.mkv|.flv|.ts|.m2ts|.strm", False, False, "") if len(retval) > 0: return retval, retval elif source == 'Local Music': self.log("Local Music") retval = dlg.browse(1, "Select File", "music", ".mp3|.flac|.mp4", False, False, "") if len(retval) > 0: return retval, retval elif source == 'UPNP': self.log("UPNP") retval = dlg.browse(1, "Select File", "video", "", False, False, "upnp://") return retval elif source == 'Kodi Favourites': self.log("Kodi Favourites") select = selectDialog(self.FavouritesNameList, 'Select Favourites') return self.FavouritesNameList[select], self.FavouritesPathList[select] elif source == 'URL': self.log("URL") input = dlg.input('Enter URL', type=xbmcgui.INPUT_ALPHANUM) if len(input) > 0: return input, input else: return except: xbmc.executebuiltin( "Dialog.Close(busydialog)" ) buggalo.onExceptionRaised()
def JsonThumb(self, mediapath, media='video'): self.log("JsonThumb") file_detail = [] thumbnail = '' try: chanlist = ChannelList() json_query = ( '{jsonrpc":"2.0","method":"Files.GetDirectory","params":{"directory":"%s","properties":["thumbnail"]}, "id": 1}' % (chanlist.escapeDirJSON(mediapath))) json_folder_detail = chanlist.sendJSON(json_query) file_detail = re.compile("{(.*?)}", re.DOTALL).findall(json_folder_detail) for f in file_detail: thumbnails = re.search('"thumbnail" *: *"(.*?)"', f) if thumbnails != None and len(thumbnails.group(1)) > 0: thumbnail = thumbnails.group(1) break except Exception: buggalo.onExceptionRaised() self.log("JsonThumb, thumbnail = " + thumbnail) return thumbnail
def FindBug_NEW(self, chtype, chname): self.logDebug("FindBug_NEW, chname = " + chname) try: setImage = '' BugName = (chname[0:18] + '.png') BugFLE = xbmc.translatePath(os.path.join(LOGO_LOC,BugName)) cachedthumb = xbmc.getCacheThumbName(BugFLE) cachefile = xbmc.translatePath(os.path.join(ART_LOC, cachedthumb[0], cachedthumb[:-4] + ".png")).replace("\\", "/") if REAL_SETTINGS.getSetting('UNAlter_ChanBug') == 'true': if chname == 'OnDemand': DefaultBug = os.path.join(IMAGES_LOC,'ondemand.png') else: DefaultBug = os.path.join(IMAGES_LOC,'logo.png') else: if chname == 'OnDemand': DefaultBug = os.path.join(IMAGES_LOC,'Default_ondemand.png') else: DefaultBug = os.path.join(IMAGES_LOC,'Default.png') if chtype == 8: return 'NA.png' else: if REAL_SETTINGS.getSetting('UNAlter_ChanBug') == 'true': if not FileAccess.exists(BugFLE): BugFLE = DefaultBug return BugFLE else: if FileAccess.exists(cachefile): return cachefile else: if not FileAccess.exists(BugFLE): return DefaultBug else: return self.ConvertBug(BugFLE, cachefile) except Exception,e: self.log("script.pseudotv.live-Artdownloader: FindBug_NEW Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def PseudoTV(): try: import resources.lib.Overlay as Overlay if hasVersionChanged(__version__) == True: return HandleUpgrade() setProperty("PseudoTVRunning", "True") setProperty("SkinHelperShutdownRequested", "True") preStart() MyOverlayWindow = Overlay.TVOverlay("script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) for curthread in threading.enumerate(): log("Active Thread: " + str(curthread.name)) if curthread.name != "MainThread": try: curthread.join() except: pass log("Joined Thread: " + str(curthread.name)) del MyOverlayWindow except Exception,e: log('default: PseudoTV Overlay Failed! ' + str(e)) buggalo.onExceptionRaised()
def download_karaoke_file(url, dest, displayname=False): print 'Downloading karaoke file' print 'URL: %s' % url print 'Destination: %s' % dest if not displayname: displayname = url dlg = xbmcgui.DialogProgress() dlg.create(__addonname__,__language__(70130), displayname) start_time = time.time() if os.path.isfile(dest): print 'File to be downloaded already esists' return True try: urllib.urlretrieve(url, dest, lambda nb, bs, fs: _pbhook(nb, bs, fs, dlg, start_time)) except: #only handle StopDownloading (from cancel), #ContentTooShort (from urlretrieve), and OS (from the race condition); #let other exceptions bubble if sys.exc_info()[0] in (urllib.ContentTooShortError, utils.StopDownloading, OSError): return False else: buggalo.onExceptionRaised() #buggalo.onExceptionRaised(url + " - " + dest) return True
def PseudoTV(): try: import resources.lib.Overlay as Overlay if hasVersionChanged(__version__) == True: return HandleUpgrade() setProperty("PseudoTVRunning", "True") setProperty("SkinHelperShutdownRequested", "True") preStart() MyOverlayWindow = Overlay.TVOverlay( "script.pseudotv.live.TVOverlay.xml", __cwd__, Skin_Select) for curthread in threading.enumerate(): log("Active Thread: " + str(curthread.name)) if curthread.name != "MainThread": try: curthread.join() except: pass log("Joined Thread: " + str(curthread.name)) del MyOverlayWindow except Exception, e: log('default: PseudoTV Overlay Failed! ' + str(e)) buggalo.onExceptionRaised()
def Fanart_Download(self, type, arttype, id, FilePath): try: if type == 'tvshow': arttype = arttype.replace('graphical', 'banner').replace( 'folder', 'poster').replace('fanart', 'landscape') fan = str(self.fanarttv.get_image_list_TV(id)) file_detail = re.compile("{(.*?)}", re.DOTALL).findall(fan) pref_language = get_abbrev( REAL_SETTINGS.getSetting('limit_preferred_language')) for f in file_detail: languages = re.search("'language' *: *(.*?),", f) art_types = re.search("'art_type' *: *(.*?),", f) fanPaths = re.search("'url' *: *(.*?),", f) if languages and len(languages.group(1)) > 0: language = (languages.group(1)).replace("u'", '').replace( "'", '') if language == pref_language: if art_types and len(art_types.group(1)) > 0: art_type = art_types.group(1).replace( "u'", '').replace("'", '').replace( "[", '').replace("]", '') if art_type.lower() == arttype.lower(): if fanPaths and len(fanPaths.group(1)) > 0: fanPath = fanPaths.group(1).replace( "u'", '').replace("'", '') if fanPath.startswith('http'): return download_silent( fanPath, FilePath) break except Exception, e: self.log( "script.pseudotv.live-Artdownloader: Fanart_Download Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def run(self, argv): try: params = dict(urlparse.parse_qsl(argv)) #Parameters action = params.get('action') id_globo_videos = params.get('id_globo_videos') id_cms = params.get('id_cms') id = params.get('id') kind = params.get('kind') slug = params.get('slug') letter = params.get('letter') id_sexyhot = params.get('id_sexyhot') meta = params.get('meta') provider = params.get('provider') metaJson = json.loads(meta) if meta is not None else None isFolder = params.get('isFolder') url = params.get('url') page = params.get('page') q = params.get('q') category = params.get('category') program_id = params.get('program_id') date = params.get('date') poster = params.get('poster') bingewatch = (params.get('bingewatch') or 'false').lower() == "true" children_id = params.get('children_id') state = params.get('state') region = params.get('region') subcategory = params.get('subcategory') #Actions if action is None: from resources.lib.indexers import navigator navigator.navigator().root() elif action == 'settings': from resources.lib.indexers import navigator navigator.navigator().openSettings() elif action == 'clear': from resources.lib.indexers import navigator navigator.navigator().clear_cache() elif action == 'clearAuth': from resources.lib.indexers import navigator navigator.navigator().clear_credentials() elif action == 'login': from resources.lib.indexers import navigator navigator.navigator().cache_auth() elif action == 'refresh': from resources.lib.modules import control control.refresh() elif action == 'searchMenu': from resources.lib.indexers import navigator navigator.navigator().searchMenu() elif action == 'search': from resources.lib.indexers import navigator navigator.navigator().search(q, page) elif action == 'featured': from resources.lib.indexers import vod vod.Vod().get_extras() elif action == 'favorites': from resources.lib.indexers import vod vod.Vod().get_favorites() elif action == 'addFavorites': from resources.lib.indexers import vod vod.Vod().add_favorites(id_globo_videos) elif action == 'delFavorites': from resources.lib.indexers import vod vod.Vod().del_favorites(id_globo_videos) elif action == 'watchlater': from resources.lib.indexers import vod vod.Vod().get_watch_later() elif action == 'addwatchlater': from resources.lib.indexers import vod vod.Vod().add_watch_later(id_globo_videos) elif action == 'delwatchlater': from resources.lib.indexers import vod vod.Vod().del_watch_later(id_globo_videos) elif action == 'watchhistory': from resources.lib.indexers import vod vod.Vod().get_watch_history() elif action == 'liveChannels': from resources.lib.indexers import live live.Live().get_channels() elif action == 'vodChannels': from resources.lib.indexers import vod vod.Vod().get_vod_channels_directory() ## COMMON elif action == 'showdates': from resources.lib.indexers import vod page = page or 1 vod.Vod().get_program_dates(program_id, poster, provider) elif action == 'openvideos' and date: from resources.lib.indexers import vod vod.Vod().get_videos_by_program_date(program_id, date, poster, provider, bingewatch) ###GLOBOSAT PLAY #PREMIER FC elif action == 'playlive' and provider == 'premierefc': from resources.lib.indexers import live live.Live().get_subitems_pfc(metaJson) #LIVE CHANNELS elif action == 'playlive' and provider == 'globosat': from resources.lib.modules.globosat import player player.Player().playlive(id_globo_videos, meta) #VOD CHANNELS elif action == 'openchannel' and provider == 'globosat': from resources.lib.indexers import vod if slug == 'combate': vod.Vod().get_channel_categories(slug=slug) elif id_cms: vod.Vod().get_channel_programs(channel_id=id_cms) elif action == 'openvideos' and provider == 'globosat': from resources.lib.indexers import vod page = page or 1 vod.Vod().get_videos_by_program(program_id, int(page), poster, 'globosat', bingewatch) elif action == 'playvod' and provider == 'globosat': from resources.lib.modules.globosat import player player.Player().playlive(id_globo_videos, meta) elif action == 'opencategory' and provider == 'combate': from resources.lib.indexers import vod vod.Vod().get_events_by_categories(category) elif action == 'openevent' and provider == 'combate': from resources.lib.indexers import vod vod.Vod().get_event_videos(category, url) elif action == 'openfighters': from resources.lib.indexers import vod vod.Vod().get_fighters(letter) elif action == 'openfighter': from resources.lib.indexers import vod vod.Vod().get_fighter_videos(slug, page) elif action == 'openfeatured' and provider == 'globosat': from resources.lib.indexers import vod vod.Vod().get_featured() elif action == 'openextra' and provider == 'globosat': from resources.lib.indexers import vod vod.Vod().get_track(id, kind) ###GLOBO PLAY elif action == 'playlive' and provider == 'multicam' and ( isFolder is True or str(isFolder).lower() == 'true'): from resources.lib.indexers import live live.Live().get_subitems_bbb(id_globo_videos) elif action == 'playlive' and provider == 'globoplay': from resources.lib.modules.globoplay import player player.Player().play_stream(id_globo_videos, meta) elif action == 'openchannel' and provider == 'globoplay': from resources.lib.indexers import vod if slug == 'futura': vod.Vod().get_channel_categories(slug=slug) else: vod.Vod().get_channel_categories() elif action == 'openextra' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_videos_by_category(category, int(page or 1), poster) elif action == 'opencategory' and provider == 'futura': from resources.lib.indexers import vod vod.Vod().open_futura_menu(category) elif action == 'opencategory' and provider == 'globoplay' and subcategory is not None: from resources.lib.indexers import vod vod.Vod().get_programs_by_subcategory(category, subcategory) elif action == 'opencategory' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_programs_by_category(category) elif action == 'openlocal' and region is not None and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_programs_by_region(region) elif action == 'openlocal' and state is not None and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_regions(state) elif action == 'openlocal' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_states() elif action == 'openvideos' and provider == 'globoplay': from resources.lib.indexers import vod page = page or 1 vod.Vod().get_videos_by_program(program_id, int(page), poster, 'globoplay', bingewatch) elif action == 'playvod' and provider == 'globoplay': from resources.lib.modules.globoplay import player player.Player().play_stream(id_globo_videos, meta) elif action == 'playvod' and provider == 'globoplay': from resources.lib.modules.globoplay import player player.Player().play_stream(id_globo_videos, meta, children_id) elif action == 'open4k' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_4k() ###SEXY HOT elif action == 'openchannel' and provider == 'sexyhot': from resources.lib.modules.sexyhotplay import indexer indexer.indexer().get_categories() elif action == 'getVideos' and provider == 'sexyhot': from resources.lib.modules.sexyhotplay import indexer indexer.indexer().get_videos(url) elif action == 'playvod' and provider == 'sexyhot': from resources.lib.modules.sexyhotplay import player player.Player().play_vod(id_sexyhot, meta) except Exception: buggalo.onExceptionRaised()
def DownloadArt_Thread(self, data): self.log('DownloadArt_Thread') try: if getProperty("PseudoTVRunning") == "True": type = data[0] id = data[1] arttype = data[2] arttype_fallback = data[3] cachefile = data[4] chname = data[5] mpath = data[6] arttypeEXT = data[7] # print cachefile drive, Dpath = os.path.splitdrive(cachefile) path, filename = os.path.split(Dpath) # print drive, Dpath, path, filename if not FileAccess.exists(os.path.join(drive,path)): FileAccess.makedirs(os.path.join(drive,path)) if type == 'tvshow': self.logDebug('DownloadArt_Thread, tvshow') FanTVDownload = True TVFilePath = cachefile tvdb_Types = ['banner', 'fanart', 'folder', 'poster'] try: if arttype in tvdb_Types: self.logDebug('DownloadArt_Thread, TVDB') arttype = arttype.replace('banner', 'graphical').replace('folder', 'poster') tvdb = str(self.tvdbAPI.getBannerByID(id, arttype)) tvdbPath = tvdb.split(', ')[0].replace("[('", "").replace("'", "") if tvdbPath.startswith('http'): download_silent(tvdbPath,TVFilePath) FanTVDownload = False except Exception,e: self.log("script.pseudotv.live-Artdownloader: DownloadArt_Thread, TVDB Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised() if FanTVDownload == True: self.logDebug('DownloadArt_Thread, Fanart.TV') try: arttype = arttype.replace('graphical', 'banner').replace('folder', 'poster').replace('fanart', 'landscape') fan = str(self.fanarttv.get_image_list_TV(id)) file_detail = re.compile( "{(.*?)}", re.DOTALL ).findall(fan) pref_language = self.fanarttv.get_abbrev(REAL_SETTINGS.getSetting('limit_preferred_language')) for f in file_detail: languages = re.search("'language' *: *(.*?),", f) art_types = re.search("'art_type' *: *(.*?),", f) fanPaths = re.search("'url' *: *(.*?),", f) if languages and len(languages.group(1)) > 0: language = (languages.group(1)).replace("u'",'').replace("'",'') if language == pref_language: if art_types and len(art_types.group(1)) > 0: art_type = art_types.group(1).replace("u'",'').replace("'",'').replace("[",'').replace("]",'') if art_type.lower() == arttype.lower(): if fanPaths and len(fanPaths.group(1)) > 0: fanPath = fanPaths.group(1).replace("u'",'').replace("'",'') if fanPath.startswith('http'): download_silent(fanPath,TVFilePath) break except Exception,e: self.log("script.pseudotv.live-Artdownloader: DownloadArt_Thread, Fanart.TV Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised() elif type == 'movie': self.logDebug('DownloadArt_Thread, movie') FanMovieDownload = True MovieFilePath = cachefile tmdb_Types = ['fanart', 'folder', 'poster'] try: if arttype in tmdb_Types: self.logDebug('DownloadArt_Thread, TMDB') arttype = arttype.replace('folder', 'poster') tmdb = self.tmdbAPI.get_image_list(id) data = str(tmdb).replace("[", "").replace("]", "").replace("'", "") data = data.split('}, {') tmdbPath = str([s for s in data if arttype in s]).split("', 'width: ")[0] match = re.search('url *: *(.*?),', tmdbPath) if match: tmdbPath = match.group().replace(",", "").replace("url: u", "").replace("url: ", "") if tmdbPath.startswith('http'): download_silent(tmdbPath,MovieFilePath) FanMovieDownload = False except Exception,e: self.log("script.pseudotv.live-Artdownloader: DownloadArt_Thread, movie Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
def KARAOKELINKS(url, id, tempkey): if tempkey == 'session': url = url + '?generalid='+ __addon__.getSetting('session_key') else: url = url + '?generalid='+ str(id) url = url + '&tempkey='+ str(tempkey) print jsonurl + url try: _json = utils.loadJsonFromUrl(jsonurl + url) filename = _json[0]['full_file_name'] urlname = _json[0]['url_name'] print filename print urlname if filename == None and urlname == None: xbmcgui.Dialog().ok(__addonname__, ' ', __language__(70117)) donotloaddir = 1 return timestr = time.strftime("%Y%m%d%H%M%S") fullDir = os.path.join(PATH, TEMP_DL_DIR + timestr) #delete directory deleteDir(fullDir) print 'Directory' print fullDir #download new file #fullFilePath = os.path.splitext(os.path.join(fullDir, filename))[0] #fullFilePath = fullFilePath + '.mp3' if getUnzipped(urlname, fullDir, filename, id) == 1: os.chdir(fullDir) i = 1 for files in glob.glob("*.mp3"): if i == 1: i = 2 xbmc.Player().play(os.path.join(fullDir, files)) if len(glob.glob("*.mp3")) < 1: reportFile('badzip', id, filename, urlname); xbmcgui.Dialog().ok(__addonname__, __language__(70123), __language__(70124), __language__(70125)) #xbmcplugin.endOfDirectory(int(sys.argv[1])) #while xbmc.Player().isPlaying(): # print 'sleeping...' # xbmc.sleep(1000) #def addDir(name,url,mode,iconimage,page, id, param1, param2="", isfolder=True): liz=xbmcgui.ListItem('', '', iconImage='DefaultAlbumCover.png', thumbnailImage='') #liz.setInfo( type='music', infoLabels={ 'Title': name, 'count': id} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url='',listitem=liz,isFolder=0) except Exception as e: buggalo.onExceptionRaised() print (e)
def main(doLogin=True): busy = None try: busy = xbmcgui.WindowXMLDialog('DialogBusy.xml', '') busy.show() try: busy.getControl(10).setVisible(False) except: pass except: busy = None import buggalo import gui buggalo.GMAIL_RECIPIENT = '*****@*****.**' try: if doLogin: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' code = session.doLogin() response = session.checkFiles(url) else: code = 200 response = '' if code == 503: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Something went wrong with your login', 'Please check your settings.') d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Daily IP Address limit reached.', 'Restricted for 2 hours.') return if response == 401: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'Something went wrong with your login', 'You will now get Basic Channels.') d.ok(TITLE + ' Error - %s.' % response, 'OnTapp.TV failed to log in', 'Check your settings.', 'Please subscribe at www.on-tapp.tv.') dixie.SetSetting('dixie.url', 'Basic Channels') dixie.SetSetting('DIXIEURL', 'Basic Channels') return else: # if doLogin: # xbmcgui.Dialog().ok(TITLE + ' Status', 'Status - %s' % response, 'Login OK.', 'Thank you.') CheckDixieURL() CheckVersion() GetCats() CheckSkin() CheckSkinVersion() CheckForUpdate() xbmcgui.Window(10000).setProperty('OTT_RUNNING', 'True') xbmc.executebuiltin('XBMC.ActivateWindow(home)') w = gui.TVGuide() if busy: busy.close() busy = None CopyKeymap() w.doModal() RemoveKeymap() del w xbmcgui.Window(10000).clearProperty('OTT_RUNNING') except Exception: buggalo.onExceptionRaised()
def main(doLogin=True): busy = None try: busy = xbmcgui.WindowXMLDialog('DialogBusy.xml', '') busy.show() try: busy.getControl(10).setVisible(False) except: pass except: busy = None import buggalo import gui buggalo.GMAIL_RECIPIENT = '*****@*****.**' try: if doLogin: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' code = session.doLogin() response = session.checkFiles(url) else: code = 200 response = '' if code == 503: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Something went wrong with your login', 'Please check your settings.') d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Daily IP Address limit reached.', 'Restricted for 2 hours.') print '****** OnTapp.TV Error 503. Too many login attempts/IPs exceeded *******' return if response == 401: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'Something went wrong with your login', 'Check your settings, or subscribe at www.on-tapp.tv.') print '****** OnTapp.TV Error 401. Access Denied. Not a paid member. *******' return if response == 301: xbmc.executebuiltin('XBMC.RunScript($CWD/deleteDB.py)') d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'It looks like you do not have a paid subcription.', 'Check your settings, or subscribe at www.on-tapp.tv.') print '****** OnTapp.TV Error 301. Free member. No paid subscription. *******' return if doLogin: # CheckDixieURL() CheckVersion() GetChannels() GetCats() CheckSkin() CheckSkinVersion() CheckIniVersion() CheckForUpdate() CheckForChannels() print '****** OnTapp.TV - All OK *******' xbmcgui.Window(10000).setProperty('OTT_RUNNING', 'True') xbmc.executebuiltin('XBMC.ActivateWindow(home)') w = gui.TVGuide() if busy: busy.close() busy = None CopyKeymap() w.doModal() RemoveKeymap() del w xbmcgui.Window(10000).clearProperty('OTT_RUNNING') except Exception: buggalo.onExceptionRaised()
def main(doLogin=True): busy = None try: busy = xbmcgui.WindowXMLDialog('DialogBusy.xml', '') busy.show() try: busy.getControl(10).setVisible(False) except: pass except: busy = None import buggalo import gui buggalo.GMAIL_RECIPIENT = '*****@*****.**' try: if doLogin: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' code = session.doLogin() response = session.checkFiles(url) else: code = 200 response = '' if code == 503: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Something went wrong with your login', 'Please check your settings.') d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Daily IP Address limit reached.', 'Restricted for 2 hours.') return if response == 401: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'Something went wrong with your login', 'You will now get Basic Channels.') d.ok(TITLE + ' Error - %s.' % response, 'OnTapp.TV failed to log in', 'Check your settings.', 'Please subscribe at www.on-tapp.tv.') dixie.SetSetting('dixie.url', 'Basic Channels') dixie.SetSetting('DIXIEURL', 'Basic Channels') return else: # if doLogin: # xbmcgui.Dialog().ok(TITLE + ' Status', 'Status - %s' % response, 'Login OK.', 'Thank you.') CheckDixieURL() CheckVersion() GetCats() CheckSkin() CheckSkinVersion() CheckIniVersion() CheckForUpdate() xbmcgui.Window(10000).setProperty('OTT_RUNNING', 'True') xbmc.executebuiltin('XBMC.ActivateWindow(home)') w = gui.TVGuide() if busy: busy.close() busy = None CopyKeymap() w.doModal() RemoveKeymap() del w xbmcgui.Window(10000).clearProperty('OTT_RUNNING') except Exception: buggalo.onExceptionRaised()
def FindArtwork(self, type, chtype, chname, id, dbid, mpath, arttypeEXT): self.logDebug("FindArtwork, type = " + type + ', chtype = ' + str(chtype) + ', chname = ' + chname + ', id = ' + str(id) + ', dbid = ' + str(dbid) + ', arttypeEXT = ' + arttypeEXT) try: setImage = '' CacheArt = False DefaultArt = False arttypeEXT = EXTtype(arttypeEXT) arttype = arttypeEXT.split(".")[0] fle = id + '-' + arttypeEXT ext = arttypeEXT.split('.')[1] cachedthumb = xbmc.getCacheThumbName(os.path.join(removeNonAscii(mpath), fle)) cachefile = xbmc.translatePath(os.path.join(ART_LOC, cachedthumb[0], cachedthumb[:-4] + "." + ext)).replace("\\", "/") if isLowPower() == True: return setImage elif FileAccess.exists(cachefile): self.logDebug('FindArtwork, Artwork Cache') return cachefile elif chtype <= 7: self.logDebug('FindArtwork, chtype <= 7 - FOLDER') smpath = mpath.rsplit('/',2)[0] artSeries = xbmc.translatePath(os.path.join(smpath, arttypeEXT)) artSeason = xbmc.translatePath(os.path.join(mpath, arttypeEXT)) artSeries_fallback = xbmc.translatePath(os.path.join(smpath, self.getFallback_Arttype(arttypeEXT))) artSeason_fallback = xbmc.translatePath(os.path.join(mpath, self.getFallback_Arttype(arttypeEXT))) if type == 'tvshow': if FileAccess.exists(artSeries): return artSeries elif FileAccess.exists(artSeason): return artSeason elif FileAccess.exists(artSeries_fallback): return artSeries_fallback elif FileAccess.exists(artSeason_fallback): return artSeason_fallback else: if FileAccess.exists(artSeason): return artSeason elif FileAccess.exists(artSeason_fallback): return artSeason_fallback self.logDebug('FindArtwork, chtype <= 7 - JSON/DBID') SetImage = self.JsonArt(type, chname, mpath, arttypeEXT) if FileAccess.exists(SetImage): return SetImage elif dbid != '0': SetImage = self.dbidArt(type, chname, mpath, dbid, arttypeEXT) if FileAccess.exists(SetImage): return SetImage if ENHANCED_DATA == True and id != '0': self.logDebug('FindArtwork, Artwork Download') self.DownloadArt(type, id, arttype, cachefile, chname, mpath, arttypeEXT) return cachefile else: if id == '0': if chtype == 8 and dbid != '0': self.logDebug('FindArtwork, XMLTV') return decodeString(dbid) elif type == 'youtube': self.logDebug('FindArtwork, YOUTUBE') return "http://i.ytimg.com/vi/"+dbid+"/mqdefault.jpg" elif type == 'rss' and dbid != '0': self.logDebug('FindArtwork, RSS') return decodeString(dbid) else: if ENHANCED_DATA == True and id != '0': self.logDebug('FindArtwork, Artwork Download') self.DownloadArt(type, id, arttype, cachefile, chname, mpath, arttypeEXT) return cachefile except Exception,e: self.log("script.pseudotv.live-Artdownloader: FindArtwork Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()
except: pass try: page = int( params['page'] ) except: pass try: if mode == None: build_main_directory() elif mode == 0: build_search_directory(name, url) elif mode == 1: build_film_database_directory() elif mode == 2: build_coming_soon_directory() elif mode == 3: build_top_150_directory() elif mode == 4: find_trailers( url, name, page, library ) elif mode == 5: play_video( url, name, download ) elif mode == 6: build_featured_directory( page ) elif mode == 7: getMovieLibrary() elif mode == 8: library_trailers( url, name, page, download ) except Exception: buggalo.onExceptionRaised()
yeslabel = ADDON.getLocalizedString(99975) if xbmcgui.Dialog().yesno(heading, line1, line2, line3, nolabel, yeslabel): ADDON.setSetting('warn.if.not.in.denmark', 'false') if __name__ == '__main__': ADDON = xbmcaddon.Addon(id='plugin.video.dr.dk.live') PATH = sys.argv[0] HANDLE = int(sys.argv[1]) PARAMS = urlparse.parse_qs(sys.argv[2][1:]) FANART = os.path.join(ADDON.getAddonInfo('path'), 'fanart.jpg') ICON = os.path.join(ADDON.getAddonInfo('path'), 'icon.png') buggalo.SUBMIT_URL = 'http://tommy.winther.nu/exception/submit.php' try: danishTV = DanishLiveTV() if 'playChannel' in PARAMS: danishTV.playChannel(PARAMS['playChannel'][0]) elif 'category' in PARAMS: danishTV.showChannels(int(PARAMS['category'][0])) elif ADDON.getSetting('group.by.category') == 'true': danishTV.imInDenmark() danishTV.showCategories() else: danishTV.imInDenmark() danishTV.showChannels() except Exception: buggalo.onExceptionRaised()
def FindArtwork_NEW(self, type, chtype, chname, id, dbid, mpath, arttypeEXT): self.logDebug("FindArtwork_NEW, type = " + type + ', chtype = ' + str(chtype) + ', chname = ' + chname + ', id = ' + str(id) + ', dbid = ' + str(dbid) + ', arttypeEXT = ' + arttypeEXT) try: setImage = '' CacheArt = False DefaultArt = False arttype = arttypeEXT.split(".")[0] arttypeEXT_fallback = arttypeEXT.replace('landscape','fanart').replace('clearart','logo').replace('character','logo').replace('folder','poster') arttype_fallback = arttypeEXT_fallback.split(".")[0] fle = id + '-' + arttypeEXT ext = arttypeEXT.split('.')[1] url = os.path.join(mpath, fle) cachedthumb = xbmc.getCacheThumbName(url) cachefile = xbmc.translatePath(os.path.join(ART_LOC, cachedthumb[0], cachedthumb[:-4] + "." + ext)).replace("\\", "/") if chtype <= 7: self.logDebug('FindArtwork_NEW, Infolder Artwork') smpath = mpath.rsplit('/',2)[0] #Path Above mpath ie Series folder artSeries = xbmc.translatePath(os.path.join(smpath, arttypeEXT)) artSeason = xbmc.translatePath(os.path.join(mpath, arttypeEXT)) artSeries_fallback = xbmc.translatePath(os.path.join(smpath, arttypeEXT_fallback)) artSeason_fallback = xbmc.translatePath(os.path.join(mpath, arttypeEXT_fallback)) if FileAccess.exists(cachefile): return cachefile elif FileAccess.exists(artSeries): return artSeries elif FileAccess.exists(artSeason): return artSeason elif FileAccess.exists(artSeries_fallback): return artSeries_fallback elif FileAccess.exists(artSeason_fallback): return artSeason_fallback else: SetImage = self.JsonArt(type, chname, mpath, arttypeEXT) if not SetImage and dbid != '0': SetImage = self.dbidArt(type, chname, mpath, dbid, arttypeEXT) if not SetImage: if REAL_SETTINGS.getSetting('EnhancedGuideData') == 'true': self.logDebug('FindArtwork_NEW, Artwork Download') self.DownloadArt(type, id, arttype, arttype_fallback, cachefile, chname, mpath, arttypeEXT) else: return SetImage else: if id == '0': if type == 'youtube': self.logDebug('FindArtwork_NEW, Youtube') return "http://i.ytimg.com/vi/"+dbid+"/mqdefault.jpg" elif type == 'rss': self.logDebug('FindArtwork_NEW, RSS') if dbid != '0': return dbid.decode('base64') else: return self.SetDefaultArt_NEW(chname, mpath, arttypeEXT) else: return self.SetDefaultArt_NEW(chname, mpath, arttypeEXT) else: self.logDebug('FindArtwork_NEW, Artwork Cache') if FileAccess.exists(cachefile): return cachefile else: if REAL_SETTINGS.getSetting('EnhancedGuideData') == 'true': self.logDebug('FindArtwork_NEW, Artwork Download') self.DownloadArt(type, id, arttype, arttype_fallback, cachefile, chname, mpath, arttypeEXT) except Exception,e: self.log("script.pseudotv.live-Artdownloader: FindArtwork_NEW Failed" + str(e), xbmc.LOGERROR) buggalo.onExceptionRaised()