本文整理汇总了Python中resources.lib.modules.control.infoDialog函数的典型用法代码示例。如果您正苦于以下问题:Python infoDialog函数的具体用法?Python infoDialog怎么用?Python infoDialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了infoDialog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clear
def clear(table=None):
try:
control.idle()
if table == None: table = ['rel_list', 'rel_lib']
elif not type(table) == list: table = [table]
yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')
if not yes: return
dbcon = database.connect(control.cacheFile)
dbcur = dbcon.cursor()
for t in table:
try:
dbcur.execute("DROP TABLE IF EXISTS %s" % t)
dbcur.execute("VACUUM")
dbcon.commit()
except:
pass
nanscrapers.clear_cache()
control.infoDialog(control.lang(30402).encode('utf-8'))
except:
pass
示例2: add
def add(self, tvshowtitle, year, imdb, tvdb, range=False):
if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
control.infoDialog(control.lang(32552).encode('utf-8'), time=10000000)
self.infoDialog = True
from resources.lib.indexers import episodes
items = episodes.episodes().get(tvshowtitle, year, imdb, tvdb, idx=False)
try: items = [{'title': i['title'], 'year': i['year'], 'imdb': i['imdb'], 'tvdb': i['tvdb'], 'season': i['season'], 'episode': i['episode'], 'tvshowtitle': i['tvshowtitle'], 'premiered': i['premiered']} for i in items]
except: items = []
try:
if not self.dupe_setting == 'true': raise Exception()
if items == []: raise Exception()
id = [items[0]['imdb'], items[0]['tvdb']]
lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["imdbnumber", "title", "year"]}, "id": 1}')
lib = unicode(lib, 'utf-8', errors='ignore')
lib = json.loads(lib)['result']['tvshows']
lib = [i['title'].encode('utf-8') for i in lib if str(i['imdbnumber']) in id or (i['title'].encode('utf-8') == items[0]['tvshowtitle'] and str(i['year']) == items[0]['year'])][0]
lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}' % lib)
lib = unicode(lib, 'utf-8', errors='ignore')
lib = json.loads(lib)['result']['episodes']
lib = ['S%02dE%02d' % (int(i['season']), int(i['episode'])) for i in lib]
items = [i for i in items if not 'S%02dE%02d' % (int(i['season']), int(i['episode'])) in lib]
except:
pass
files_added = 0
for i in items:
try:
if xbmc.abortRequested == True: return sys.exit()
if self.check_setting == 'true':
if i['episode'] == '1':
self.block = True
src = lib_tools.check_sources(i['title'], i['year'], i['imdb'], i['tvdb'], i['season'], i['episode'], i['tvshowtitle'], i['premiered'])
if src: self.block = False
if self.block == True: raise Exception()
premiered = i.get('premiered', '0')
if (premiered != '0' and int(re.sub('[^0-9]', '', str(premiered))) > int(self.date)) or (premiered == '0' and not self.include_unknown):
continue
self.strmFile(i)
files_added += 1
except:
pass
if range == True: return
if self.infoDialog == True:
control.infoDialog(control.lang(32554).encode('utf-8'), time=1)
if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo') and files_added > 0:
control.execute('UpdateLibrary(video)')
示例3: addView
def addView(content):
try:
skin = control.skin
skinPath = control.skinPath
xml = os.path.join(skinPath,'addon.xml')
file = control.openFile(xml)
read = file.read().replace('\n','')
file.close()
try: src = re.compile('defaultresolution="(.+?)"').findall(read)[0]
except: src = re.compile('<res.+?folder="(.+?)"').findall(read)[0]
src = os.path.join(skinPath, src)
src = os.path.join(src, 'MyVideoNav.xml')
file = control.openFile(src)
read = file.read().replace('\n','')
file.close()
views = re.compile('<views>(.+?)</views>').findall(read)[0]
views = [int(x) for x in views.split(',')]
for view in views:
label = control.infoLabel('Control.GetLabel(%s)' % (view))
if not (label == '' or label == None): break
record = (skin, content, str(view))
control.makeFile(control.dataPath)
dbcon = database.connect(control.viewsFile)
dbcur = dbcon.cursor()
dbcur.execute("CREATE TABLE IF NOT EXISTS views (""skin TEXT, ""view_type TEXT, ""view_id TEXT, ""UNIQUE(skin, view_type)"");")
dbcur.execute("DELETE FROM views WHERE skin = '%s' AND view_type = '%s'" % (record[0], record[1]))
dbcur.execute("INSERT INTO views Values (?, ?, ?)", record)
dbcon.commit()
viewName = control.infoLabel('Container.Viewmode')
control.infoDialog(control.lang(30491).encode('utf-8'), heading=viewName)
except:
return
示例4: addFavourite
def addFavourite(meta, content, query):
try:
item = dict()
meta = json.loads(meta)
try: id = meta['imdb']
except: id = meta['tvdb']
if 'title' in meta: title = item['title'] = meta['title']
if 'tvshowtitle' in meta: title = item['title'] = meta['tvshowtitle']
if 'year' in meta: item['year'] = meta['year']
if 'poster' in meta: item['poster'] = meta['poster']
if 'fanart' in meta: item['fanart'] = meta['fanart']
if 'imdb' in meta: item['imdb'] = meta['imdb']
if 'tmdb' in meta: item['tmdb'] = meta['tmdb']
if 'tvdb' in meta: item['tvdb'] = meta['tvdb']
if 'tvrage' in meta: item['tvrage'] = meta['tvrage']
control.makeFile(control.dataPath)
dbcon = database.connect(control.favouritesFile)
dbcur = dbcon.cursor()
dbcur.execute("CREATE TABLE IF NOT EXISTS %s (""id TEXT, ""items TEXT, ""UNIQUE(id)"");" % content)
dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, id))
dbcur.execute("INSERT INTO %s Values (?, ?)" % content, (id, repr(item)))
dbcon.commit()
if query == None: control.refresh()
control.infoDialog(control.lang(30411).encode('utf-8'), heading=title)
except:
return
示例5: addFavourite
def addFavourite(meta, content):
try:
item = dict()
meta = json.loads(meta)
# print "META DUMP FAVOURITES %s" % meta
try: id = meta['imdb']
except: id = meta['tvdb']
if 'title' in meta: title = item['title'] = meta['title']
if 'tvshowtitle' in meta: title = item['title'] = meta['tvshowtitle']
if 'year' in meta: item['year'] = meta['year']
if 'poster' in meta: item['poster'] = meta['poster']
if 'fanart' in meta: item['fanart'] = meta['fanart']
if 'imdb' in meta: item['imdb'] = meta['imdb']
if 'tmdb' in meta: item['tmdb'] = meta['tmdb']
if 'tvdb' in meta: item['tvdb'] = meta['tvdb']
if 'tvrage' in meta: item['tvrage'] = meta['tvrage']
control.makeFile(dataPath)
dbcon = database.connect(favouritesFile)
dbcur = dbcon.cursor()
dbcur.execute("CREATE TABLE IF NOT EXISTS %s (""id TEXT, ""items TEXT, ""UNIQUE(id)"");" % content)
dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, id))
dbcur.execute("INSERT INTO %s Values (?, ?)" % content, (id, repr(item)))
dbcon.commit()
control.refresh()
control.infoDialog('Added to Watchlist', heading=title)
except:
return
示例6: resolve
def resolve(url):
actions = [
("plugin://plugin.video.yatp/?action=play&torrent=%s", "plugin.video.yatp", "YATP-Yet Another Torrent Player"),
("plugin://plugin.video.quasar/play?uri=%s", "plugin.video.quasar", "Quasar"),
]
if not xbmcvfs.exists(os.path.dirname(torrent_path)):
try:
xbmcvfs.mkdirs(os.path.dirname(torrent_path))
except:
os.mkdir(os.path.dirname(torrent_path))
file = urllib2.urlopen(url)
output = open(torrent_path, "wb")
output.write(file.read())
output.close()
choice = int(control.setting("torrentPlayer"))
action = actions[choice]
if choice == 0:
url = torrent_path
if addonInstaller.isInstalled(action[1]):
return action[0] % url
else:
control.infoDialog(
"Torrent player not installed. Install it or select a different torrent player.",
heading=action[2],
time=6000,
)
return ""
示例7: range
def range(self, url):
control.idle()
yes = control.yesnoDialog(control.lang(30425).encode("utf-8"), "", "")
if not yes:
return
if not control.condVisibility("Window.IsVisible(infodialog)") and not control.condVisibility("Player.HasVideo"):
control.infoDialog(control.lang(30421).encode("utf-8"), time=10000000)
self.infoDialog = True
from resources.lib.indexers import movies
items = movies.movies().get(url, idx=False)
if items == None:
items = []
for i in items:
try:
if xbmc.abortRequested == True:
return sys.exit()
self.add(i["name"], i["title"], i["year"], i["imdb"], range=True)
except:
pass
if self.infoDialog == True:
control.infoDialog(control.lang(30423).encode("utf-8"), time=1)
if self.library_setting == "true" and not control.condVisibility("Library.IsScanningVideo"):
control.execute("UpdateLibrary(video)")
示例8: resolve
def resolve(self,url):
try:
referer,id = url.split('##')
s = requests.Session()
s.headers = {'Accept':'application/json, text/javascript, */*; q=0.01','Host':'www.streamgaroo.com','Referer':referer,'X-Requested-With' : 'XMLHttpRequest'}
html = s.post('http://www.streamgaroo.com/calls/get/source',data={'h':urllib.unquote(id)}).text
s.headers = ({'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','Host':'www.streamgaroo.com','Referer':referer, 'Accept-Encoding':'gzip, deflate, lzma, sdch'})
link = json.loads(html)['link']
html = s.get(link).text
#hls
try:
url = re.findall('playStream\(.+?,.((?:http|rtmp)[^\"\']+)',html)[0]
if 'rtmp' in url:
return url
else:
return url + '|%s' %urllib.urlencode({'X-Requested-With':constants.get_shockwave(),'Referer':link,'User-agent':client.agent()})
except: pass
#everything else
import liveresolver
return liveresolver.resolve(link,html=html)
except:
control.infoDialog('No stream available!')
return ''
示例9: clearCache
def clearCache(self):
control.idle()
yes = control.yesnoDialog(control.lang(32056).encode('utf-8'), '', '')
if not yes: return
from resources.lib.modules import cache
cache.cache_clear()
control.infoDialog(control.lang(32057).encode('utf-8'), sound=True, icon='INFO')
示例10: showPlaybackInfo
def showPlaybackInfo(self):
try:
if not control.setting('player.info') == 'true': raise Exception()
elapsedTime = '%s %s %s' % (control.lang(30464).encode('utf-8'), int((time.time() - self.loadingTime)), control.lang(30465).encode('utf-8'))
control.infoDialog(elapsedTime, heading=self.name)
except:
pass
示例11: clear
def clear(table=None):
try:
control.idle()
if table == None: table = ['rel_list', 'rel_lib']
elif not type(table) == list: table = [table]
yes = control.yesnoDialog('Are You Sure?', '', '')
if not yes: return
dbcon = database.connect(control.cacheFile)
dbcur = dbcon.cursor()
for t in table:
try:
dbcur.execute("DROP TABLE IF EXISTS %s" % t)
dbcur.execute("VACUUM")
dbcon.commit()
except:
pass
control.infoDialog('Cache.db Cleared')
xbmc.executebuiltin('Container.Refresh()')
except:
pass
示例12: range
def range(self, url):
control.idle()
yes = control.yesnoDialog(control.lang(32555).encode('utf-8'), '', '')
if not yes: return
if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
control.infoDialog(control.lang(32552).encode('utf-8'), time=10000000)
self.infoDialog = True
from resources.lib.indexers import tvshows
items = tvshows.tvshows().get(url, idx=False)
if items == None: items = []
for i in items:
try:
if xbmc.abortRequested == True: return sys.exit()
self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True)
except:
pass
if self.infoDialog == True:
control.infoDialog(control.lang(32554).encode('utf-8'), time=1)
if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'):
control.execute('UpdateLibrary(video)')
示例13: addDownload
def addDownload(name, url, image, resolved=False):
if resolved:
resolved = url
try:
def download(): return []
result = cache.get(download, 600000000, table='rel_dl')
result = [i['name'] for i in result]
except:
pass
if name in result:
return control.infoDialog('Stavka je već dodana u red čekanja', name)
try:
if not resolved:
import urlresolver
resolved = urlresolver.resolve(url)
except:
return control.infoDialog('Unplayable stream')
pass
try:
u = resolved.split('|')[0]
try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
except: headers = dict('')
ext = os.path.splitext(urlparse.urlparse(u).path)[1][1:].lower()
if ext == 'm3u8': raise Exception()
#if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4'
try: name = name.decode('utf-8')
except: pass
name=re.sub('[^-a-zA-Z0-9_.() ]+', '', name)
name=name.rstrip('.')
dest = name + '.' + ext
req = urllib2.Request(u, headers=headers)
resp = urllib2.urlopen(req, timeout=30)
size = int(resp.headers['Content-Length'])
size = ' %.2f GB' % (float(size) / 1073741824)
no = control.yesnoDialog(dest, 'Veličina datoteke je ' + size, 'Nastaviti s preuzimanjem?', name + ' - ' + 'Potvrdi preuzimanje', 'Potvrdi', 'Prekini')
if no: return
except:
return control.infoDialog('Nije moguće preuzeti')
pass
def download(): return [{'name': name, 'url': url, 'image': image}]
result = cache.get(download, 600000000, table='rel_dl')
result = [i for i in result if not i['url'] == url]
def download(): return result + [{'name': name, 'url': url, 'image': image}]
result = cache.get(download, 0, table='rel_dl')
control.infoDialog('Datoteka dodana u red čekanja', name)
示例14: removeDownload
def removeDownload(url):
try:
def download(): return []
result = cache.get(download, 600000000, table='rel_dl')
if result == '': result = []
result = [i for i in result if not i['url'] == url]
if result == []: result = ''
def download(): return result
result = cache.get(download, 0, table='rel_dl')
control.refresh()
except:
control.infoDialog('Morate ručno ukloniti datoteku', 'Nije moguće ukloniti datoteku')
示例15: removeDownload
def removeDownload(url):
try:
def download(): return []
result = cache.neptune_download_get(download, 600000000, table='rel_dl')
if result == '': result = []
result = [i for i in result if not i['url'] == url]
if result == []: result = ''
def download(): return result
result = cache.neptune_download_get(download, 0, table='rel_dl')
control.refresh()
except:
control.infoDialog('You need to remove file manually', 'Can not remove from Queue')