Python xbmc.log() Examples
The following are 30
code examples of xbmc.log().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
xbmc
, or try the search function
.
Example #1
Source File: sport365.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def derot(xset, hset, src): xset = eval(xset) hset = eval(hset) import string o = '' u = '' il = 0 for first in hset: u += first o += xset[il] il += 1 rot13 = string.maketrans(o, u) link = string.translate(src, rot13) xbmc.log('@#@DEROT-LINK: %s' % link, xbmc.LOGNOTICE) return link
Example #2
Source File: loghandler.py From plugin.video.emby with GNU General Public License v3.0 | 6 votes |
def emit(self, record): if self._get_log_level(record.levelno): try: string = self.format(record) except Exception as error: xbmc.log("Error trying to format string for log", level=xbmc.LOGNOTICE) return if self.mask_info: for server in self.sensitive['Server']: string = string.replace(server.encode('utf-8') or "{server}", "{emby-server}") for token in self.sensitive['Token']: string = string.replace(token.encode('utf-8') or "{token}", "{emby-token}") try: xbmc.log(string, level=xbmc.LOGNOTICE) except UnicodeEncodeError: xbmc.log(string.encode('utf-8'), level=xbmc.LOGNOTICE)
Example #3
Source File: kodiutils.py From script.module.inputstreamhelper with MIT License | 6 votes |
def jsonrpc(*args, **kwargs): """Perform JSONRPC calls""" from json import dumps, loads # We do not accept both args and kwargs if args and kwargs: log(4, 'ERROR: Wrong use of jsonrpc()') return None # Process a list of actions if args: for (idx, cmd) in enumerate(args): if cmd.get('id') is None: cmd.update(id=idx) if cmd.get('jsonrpc') is None: cmd.update(jsonrpc='2.0') return loads(xbmc.executeJSONRPC(dumps(args))) # Process a single action if kwargs.get('id') is None: kwargs.update(id=0) if kwargs.get('jsonrpc') is None: kwargs.update(jsonrpc='2.0') return loads(xbmc.executeJSONRPC(dumps(kwargs)))
Example #4
Source File: ResetDatabase.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def deleteDB(): try: xbmc.log("[script.tvguide.fullscreen] Deleting database...", xbmc.LOGDEBUG) dbPath = xbmc.translatePath(xbmcaddon.Addon(id = 'script.tvguide.fullscreen').getAddonInfo('profile')) dbPath = os.path.join(dbPath, 'source.db') delete_file(dbPath) passed = not os.path.exists(dbPath) if passed: xbmc.log("[script.tvguide.fullscreen] Deleting database...PASSED", xbmc.LOGDEBUG) else: xbmc.log("[script.tvguide.fullscreen] Deleting database...FAILED", xbmc.LOGDEBUG) return passed except Exception, e: xbmc.log('[script.tvguide.fullscreen] Deleting database...EXCEPTION', xbmc.LOGDEBUG) return False
Example #5
Source File: source.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def __init__(self, addon, force): self.needReset = False self.fetchError = False self.start = True self.force = force ''' self.xmltvInterval = int(addon.getSetting('sd.interval')) self.logoSource = int(addon.getSetting('logos.source')) self.addonsType = int(addon.getSetting('addons.ini.type')) # make sure the folder in the user's profile exists or create it! if not os.path.exists(self.PLUGIN_DATA): os.makedirs(self.PLUGIN_DATA) # make sure the ini file is fetched as well if necessary if self.addonsType != self.INI_TYPE_DEFAULT: customFile = str(addon.getSetting('addons.ini.file')) if os.path.exists(customFile): # uses local file provided by user! xbmc.log('[%s] Use local file: %s' % (ADDON.getAddonInfo('id'), customFile), xbmc.LOGDEBUG) else: # Probably a remote file xbmc.log('[%s] Use remote file: %s' % (ADDON.getAddonInfo('id'), customFile), xbmc.LOGDEBUG) self.updateLocalFile(customFile, addon, True, force=force) '''
Example #6
Source File: vpnapi.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def __init__(self): # Class initialisation. Fails with a RuntimeError exception if VPN Manager add-on is not available, or too old self.filtered_addons = [] self.filtered_windows = [] self.primary_vpns = [] self.last_updated = 0 self.refreshLists() self.default = self.getConnected() xbmc.log("VPN Mgr API : Default is " + self.default, level=xbmc.LOGDEBUG) self.timeout = 30 if not xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"): xbmc.log("VPN Mgr API : VPN Manager is not installed, cannot use filtering", level=xbmc.LOGERROR) raise RuntimeError("VPN Manager is not installed") else: v = int((xbmcaddon.Addon("service.vpn.manager").getAddonInfo("version").strip()).replace(".","")) if v < 310: raise RuntimeError("VPN Manager " + str(v) + " installed, but needs to be v3.1.0 or later")
Example #7
Source File: vpnapi.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def connectToValidated(self, connection, wait): # Given the number of a validated connection, connect to it. Return True when the connection has happened # or False if there's a problem connecting (or there's not a VPN connection available for this connection # number). Return True without messing with the connection if the current VPN is the same as the VPN being # requested. The wait parameter will determine if the function returns once the connection has been made, # or if it's fire and forget (in which case True will be returned regardless) if not self.isVPNSetUp(): return False if connection < 1 or connection > 10: return False connection = connection - 1 self.refreshLists() if self.primary_vpns[connection] == "": return False if self.getConnected() == self.primary_vpns[connection]: return True xbmc.log(msg="VPN Mgr API : Connecting to " + self.primary_vpns[connection], level=xbmc.LOGDEBUG) self.setAPICommand(self.primary_vpns[connection]) if wait: return self.waitForConnection(self.primary_vpns[connection]) return True
Example #8
Source File: default.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def get_gam_genres(url): # 3 try: r = requests.get(url).text r = client.parseDOM(r, 'li', attrs={'id': r'menu-item-\d+'})[1:] # xbmc.log('POSTs: {}'.format(r)) # r = client.parseDOM(r, 'div', attrs={'class': 'categorias'})[0] # r = client.parseDOM(r, 'li', attrs={'class': 'cat-item.+?'}) for post in r: try: # xbmc.log('POST: {}'.format(post)) url = client.parseDOM(post, 'a', ret='href')[0] name = client.parseDOM(post, 'a')[0] name = clear_Title(name).encode('utf-8') if 'facebook' in url or 'imdb' in url: continue # xbmc.log('NAME: {} | URL: {}'.format(name, url)) addDir('[B][COLOR white]%s[/COLOR][/B]' % name, url, 4, ART + 'movies.jpg', FANART, '') except BaseException: pass except BaseException: pass views.selectView('menu', 'menu-view')
Example #9
Source File: default.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def Get_Seasons(url, name):#4 r = client.request(url).decode('latin-1').encode('utf-8') episodes = client.parseDOM(r, 'div', attrs={'class': 'tab-content'})[0] data = client.parseDOM(r, 'div', attrs={'class': 'VideoPlayer'})[0] poster = client.parseDOM(r, 'img', ret='src')[0] ss = zip(client.parseDOM(data, 'a', ret='href'), client.parseDOM(data, 'a')) xbmc.log('@#@SEASONS:%s' % ss, xbmc.LOGNOTICE) desc = client.parseDOM(r, 'p', attrs={'class': 'text-dark font-size-13'})[0].encode('latin-1') desc = clear_Title(desc) for i in ss: xbmc.log('@#@FOR-i:%s' % i[1], xbmc.LOGNOTICE) season = re.sub('[\n|\t|\r|\s]', '', i[1]) surl = url + '|' + episodes.encode('utf-8') + '|' + i[0][1:].encode('utf-8') + '|' + str(poster) title = '[B][COLOR white]%s [B]| [COLOR lime]%s[/COLOR][/B]' % (name, season) addDir(title, surl, 7, poster, FANART, desc) setView('movies', 'menu-view')
Example #10
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def deleteFile(filename): log('Deleting %s' % filename) if len(filename) < 1: log('Empty filename') return try: current = xbmc.Player().getPlayingFile() if xbmc.Player().isPlaying() else '' except: current = '' while current == filename: try: current = xbmc.Player().getPlayingFile() if xbmc.Player().isPlaying() else '' except: current = '' xbmc.sleep(1000) tries = 15 while xbmcvfs.exists(filename) and tries > 0: tries -= 1 try: xbmcvfs.delete(filename) except Exception, e: log('ERROR %s in deleteFile %s' % (str(e), filename)) log('ERROR tries=%d' % tries) xbmc.sleep(500)
Example #11
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def stopDownloaders(): log('in STOPDOWNLOADERS') #signal all downloaders to stop for i in range(MAX_DOWNLOADERS): state = xbmcgui.Window(10000).getProperty(PROPERTY % i) if state: xbmcgui.Window(10000).setProperty(PROPERTY % i, 'Signal') #now wait for them to all stop i = 0 while i < MAX_DOWNLOADERS: state = xbmcgui.Window(10000).getProperty(PROPERTY % i) if state: xbmc.sleep(100) i = 0 else: i += 1
Example #12
Source File: default.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def albums(name, url): duplicate = [] link = GET_url(url) try: artist_url = regex_from_to(link, 'class="album_report__image"\s*', '"') get_artist_icon(name, artist_url) xbmc.log("370 name = {0}\nartist_url = {1}".format(name, artist_url), xbmc.LOGNOTICE) except: pass all_albums = re.compile('<div class="album_report"><h5 class="album_report__heading"><a class="album_report__link" href="(.+?)"><img alt="(.+?)" class="album_report__image" src="(.+?)"/><span class="album_report__name">(.+?)</span></a></h5><div cla(.+?)lbum_report__second_line"><span class="album_report__date">(.+?)</span>').findall(link) #all_albums = re.compile('<div class="album_report"><h5 class="album_report__heading"><a class="album_report__link" href="(.+?)"><img alt="(.+?)" class="album_report__image" src="(.+?)"/><span class="album_report__name">(.+?)</span></a></h5><div class="album_report__second_line"><span class="album_report__date">(.+?)</span>').findall(link) for url1,d1,thumb,album,d2,year in all_albums: title = "%s - %s - %s" % (name, album, year) if title not in duplicate: duplicate.append(title) thumb = thumb.replace('al', 'alm').replace('covers', 'mcovers') addDir(title.replace('&', 'and'),'http://musicmp3.ru' + url1,5,thumb,'albums') setView('movies', 'album')
Example #13
Source File: log.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def log_severe(msg): log(msg, level=LOGSEVERE)
Example #14
Source File: default.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def get_artist_icon(name, url): xbmc.log("724 name = {0}\nurl = {1}".format(name, url), xbmc.LOGNOTICE) data_path = os.path.join(ARTIST_ART, name + '.jpg') xbmc.log("726 datapath = {0}".format(data_path), xbmc.LOGNOTICE) if not os.path.exists(data_path): dlThread = DownloadIconThread(name, url, data_path) dlThread.start()
Example #15
Source File: kodiutils.py From script.module.inputstreamhelper with MIT License | 5 votes |
def copy(src, dest): """Copy a file (using xbmcvfs)""" from xbmcvfs import copy as vfscopy log(2, "Copy file '{src}' to '{dest}'.", src=src, dest=dest) return vfscopy(from_unicode(src), from_unicode(dest))
Example #16
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def run(self): if xbmcvfs.exists(self.filename): log('DOWNLOADER - %s %s already exists' % (self.title, self.filename)) self.complete = True return self.slot = getFreeSlot() log('DOWNLOADER - TITLE %s' % self.title) log('DOWNLOADER - SLOT %d' % self.slot) log('DOWNLOADER - DOWNLOADING URL %s' % self.url) log('DOWNLOADER - DOWNLOADING FILE %s' % self.filename) if self.slot < 0: log('CAN\'T FIND FREE SLOT - WILL NOT DOWNLOAD') else: self.downloadFile() xbmcgui.Window(10000).clearProperty(PROPERTY % self.slot) if self.complete: log('%s DOWNLOAD COMPLETED' % self.title) try: self.applyID3() except Exception, e: log('Error applying tags %s' % str(e))
Example #17
Source File: log.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def log(msg, level=LOGDEBUG): # override message level to force logging when addon logging turned on if control.setting('debug') == 'true' and level == LOGDEBUG: level = LOGNOTICE try: xbmc.log('{0}, {1}:: {2}'.format(control.addonInfo('name'), control.addonInfo('version'), msg), level) except Exception as e: try: xbmc.log('Logging Failure: %s' % e, level) except BaseException: pass # just give up
Example #18
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def applyID3(self): if ADDON.getSetting('keep_downloads')=='false': return if not xbmcvfs.exists(self.filename): return if self.track < 1: return log('Applying ID3 tags to %s' % self.title) temp = self.filename.rsplit(os.sep, 1)[-1] temp = os.path.join(TEMP, temp) doCopy = self.filename != temp if doCopy: xbmcvfs.copy(self.filename, temp) #Remove track number from title title=self.title try: title=title[title.find('. ')+2:] except: title=title audio = MP3(temp, ID3=EasyID3) audio['title'] = title audio['artist'] = self.artist audio['album'] = self.album audio['tracknumber'] = str(self.track) audio['date'] = '' audio['genre'] = '' audio.save(v1=2) log(audio.pprint()) if doCopy: del audio deleteFile(self.filename) xbmcvfs.copy(temp, self.filename) deleteFile(temp)
Example #19
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def downloadFile(self): try: headers = {'Host':'listen.musicmp3.ru', 'Range':'bytes=0-', 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0', 'Accept':'audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5','Referer':'https://www.goldenmp3.ru'} xbmcgui.Window(10000).setProperty(PROPERTY % self.slot, 'Downloading') from contextlib import closing with closing(requests.get(self.url, headers=headers, stream=True)) as r: f = xbmcvfs.File(self.filename, 'w') for chunk in r.iter_content(chunk_size=1024): if xbmcgui.Window(10000).getProperty(PROPERTY % self.slot) == 'Signal': log('SIGNALLED VIA WINDOW PROPERTY') self.signal() if self._signal: log('SIGNALLED') f.close() return if chunk: f.write(chunk) f.close() self.complete = True except Exception, e: xbmcgui.Window(10000).setProperty(self.filename, 'EXCEPTION') log('Error in downloadFile % s' % str(e)) try: f.close() except: pass
Example #20
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def play(sys, params): log('Setting resolving property') xbmcgui.Window(10000).setProperty(RESOLVING, RESOLVING) title = urllib.unquote_plus(params['title']) artist = urllib.unquote_plus(params['artist']) album = urllib.unquote_plus(params['album']) track = urllib.unquote_plus(params['track']) image = urllib.unquote_plus(params['image']) duration = urllib.unquote_plus(params['duration']) filename = urllib.unquote_plus(params['filename']) url = urllib.unquote_plus(params['url']) log('**** In playFile ****') log(title) log(url) log(filename) playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) posn = playlist.getposition() next = posn+1 fetchFile(title, artist, album, track, url, filename) fetchNext(next) log('**** FILE %s NOW AVAILABLE ****' % filename) liz = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image, path=filename) liz.setInfo('music', {'Title':title, 'Artist':artist, 'Album':album, 'Duration':duration}) liz.setProperty('mimetype', 'audio/mpeg') liz.setProperty('IsPlayable','true') xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz) log('Clearing resolving property') xbmcgui.Window(10000).clearProperty(RESOLVING) #------------------------------------------------------------------------
Example #21
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def fetchFile(title, artist, album, track, url, filename): log('IN fetchFile') nDownloaders = getNmrDownloaders() log('Number of downloaders= %d' % nDownloaders) if nDownloaders >= MAX_DOWNLOADERS: #-1 to allow for fetchNext stopDownloaders() if xbmcvfs.exists(xbmc.translatePath(filename)) and xbmcvfs.File(filename).size() > 250 * 1024: log('%s already exists' % filename) return log('**** FILE %s DOES NOT EXISTS - START DOWNLOADING****' % filename) startFile(title, artist, album, track, url, filename)
Example #22
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def resetCache(): log('in RESETCACHE') if not xbmcvfs.exists(TEMP): try: xbmcvfs.mkdirs(TEMP) except: pass return dirs, files = xbmcvfs.listdir(TEMP) for file in files: filename = os.path.join(TEMP, file) deleteFile(filename)
Example #23
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def resetCache_original(): log('in RESETCACHE') if os.path.exists(TEMP): try: shutil.rmtree(TEMP) except: pass xbmc.sleep(1000) try: os.makedirs(TEMP) except: pass
Example #24
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def startFile(title, artist, album, track, url, filename): log('Creating downloader') retries = 2 while retries > 0: retries -= 1 downloader = Downloader(title, artist, album, track, url, filename) downloader.start() if verifyFileSize(filename): return stopDownloaders() deleteFile(filename)
Example #25
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def getFreeSlot(): for i in range(MAX_DOWNLOADERS): state = xbmcgui.Window(10000).getProperty(PROPERTY % i) if state: log('State %d Found' % i) else: return i return -1
Example #26
Source File: kodiutils.py From script.module.inputstreamhelper with MIT License | 5 votes |
def delete(path): """Remove a file (using xbmcvfs)""" from xbmcvfs import delete as vfsdelete log(2, "Delete file '{path}'.", path=path) return vfsdelete(from_unicode(path))
Example #27
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def verifyFileSize(filename): if not filename: return True ADDONID = 'plugin.audio.mp3streams' ADDON = xbmcaddon.Addon(ADDONID) precache = int(ADDON.getSetting('pre-cache').replace('K', '')) filename = xbmc.translatePath(filename) log('VERIFYING %s' % filename) count = 100 while count > 0: if xbmcgui.Window(10000).getProperty(filename) == 'EXCEPTION': xbmcgui.Window(10000).clearProperty(filename) log('Exception downloading %s' % filename) return False log('verifyFileSize %d' % count) if xbmcvfs.exists(filename): size = xbmcvfs.File(filename).size() log('CURRENT SIZE = %d' % size) if size == 212 and unavailable(filename): return False if size > precache * 1024: log(size) log('FILE SIZE VERIFIED!!') return True count -= 1 xbmc.sleep(500) return False
Example #28
Source File: kodiutils.py From script.module.inputstreamhelper with MIT License | 5 votes |
def mkdir(path): """Create a directory (using xbmcvfs)""" from xbmcvfs import mkdir as vfsmkdir log(2, "Create directory '{path}'.", path=path) return vfsmkdir(from_unicode(path))
Example #29
Source File: playerMP3.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def check(): global COUNT if xbmc.Player().isPlaying(): COUNT = 0 else: COUNT += 1 log('MP3 Service Checking Kodi is still trying to play %d' % COUNT) if COUNT > RETRIES: clear()
Example #30
Source File: sport365.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def getStreams(url): try: from resources.lib import cache past = 'U2FsdGVkX19q9T+lFjzxG4a0je4b6tI1Uc3HUVnoWBiD/Vw59IpxZ+cJuwDsjszZPsVkradgfXb0sxZVxY2J1h96IuNIpyAHyNS1vUKYpcU=' # xbmc.log('PAST IS: %s' % past, level=xbmc.LOGNOTICE) pastes = cache.get(getUrl, 3, jscrypto.decode(past, base64.b64decode('SXMgT25seSBPbmUgQnVnYXRzaW5obw=='))) # xbmc.log('PASTES IS: %s' % pastes, level=xbmc.LOGNOTICE) ret = xor2(base64.b64decode(pastes), 'sly6B89wqxt2N') ret = json.loads(ret) info, key = ret['i7'], ret['k7'] except BaseException: raise Exception() xbmc.log('RET IS: %s' % str(ret), level=xbmc.LOGNOTICE) myurl = url content = getUrl(myurl) sources = re.findall(r'''onClick=['"]\w+\(\'(\w+)\'''', content, re.DOTALL) out = [] for i, s in enumerate(set(sources)): decrypter = pyAES.Decrypter(pyAES.AESModeOfOperationECB(key)) data = decrypter.feed(s.strip().decode('hex')) data += decrypter.feed() s = data.decode('hex') title = 'Link {}'.format(i + 1) out.append({"title": title, "tvid": title, "url": '{}@{}@{}'.format(s, info, key), "refurl": url}) # xbmc.log('HTMLSTREAMS-OUT: %s' % str(out), level=xbmc.LOGNOTICE) return out