本文整理汇总了Python中resources.lib.libraries.control.infoDialog函数的典型用法代码示例。如果您正苦于以下问题:Python infoDialog函数的具体用法?Python infoDialog怎么用?Python infoDialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了infoDialog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addFavourite
def addFavourite(meta, content, query):
try:
item = dict()
meta = json.loads(meta)
imdb = item['imdb'] = meta['imdb']
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 '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, imdb))
dbcur.execute("INSERT INTO %s Values (?, ?)" % content, (imdb, repr(item)))
dbcon.commit()
if query == None: control.refresh()
control.infoDialog(control.lang(30411).encode('utf-8'), heading=title)
except:
return
示例2: add
def add(self, tvshowtitle, year, imdb, tmdb, tvdb, tvrage, range=False):
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 episodes
items = episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, idx=False)
try: items = [{'name': i['name'], 'title': i['title'], 'year': i['year'], 'imdb': i['imdb'], 'tmdb': i['tmdb'], 'tvdb': i['tvdb'], 'tvrage': i['tvrage'], 'season': i['season'], 'episode': i['episode'], 'tvshowtitle': i['tvshowtitle'], 'alter': i['alter'], 'date': 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']]
if not items[0]['tmdb'] == '0': id += [items[0]['tmdb']]
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
for i in items:
try:
if xbmc.abortRequested == True: return sys.exit()
if self.check_setting == 'true':
if i['episode'] == '1':
self.block = True
from resources.lib.sources import sources
src = sources().getSources(i['name'], i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['season'], i['episode'], i['tvshowtitle'], i['alter'], i['date'])
if len(src) > 0: self.block = False
if self.block == True: raise Exception()
if int(self.date) <= int(re.sub('[^0-9]', '', str(i['date']))):
from resources.lib.sources import sources
src = sources().getSources(i['name'], i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['season'], i['episode'], i['tvshowtitle'], i['alter'], i['date'])
if not len(src) > 0: raise Exception()
self.strmFile(i)
except:
pass
if range == True: return
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)')
示例3: range
def range(self, url, query):
if query == 'tool':
return xbmc.executebuiltin('RunPlugin(%s?action=moviesToLibrary&url=%s)' % (sys.argv[0], urllib.quote_plus(url)))
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'], i['tmdb'], 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)')
示例4: 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:
control.log('## ITEMS %s' % i['title'])
for i in items:
try:
if xbmc.abortRequested == True: return sys.exit()
self.add('%s (%s)' % (i['title'], i['year']), i['title'], i['year'], i['imdb'], i['tmdb'], 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)')
示例5: 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"], i["tmdb"], 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)")
示例6: deleteFavourite
def deleteFavourite(meta, content):
try:
meta = json.loads(meta)
imdb = meta['imdb']
if 'title' in meta: title = meta['title']
if 'tvshowtitle' in meta: title = meta['tvshowtitle']
try:
dbcon = database.connect(control.favouritesFile)
dbcur = dbcon.cursor()
dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, imdb))
dbcon.commit()
except:
pass
try:
dbcon = database.connect(control.databaseFile)
dbcur = dbcon.cursor()
dbcur.execute("DELETE FROM favourites WHERE imdb_id = '%s'" % imdb)
dbcon.commit()
except:
pass
control.refresh()
control.infoDialog(control.lang(30412).encode('utf-8'), heading=title)
except:
return
示例7: 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.databaseFile)
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
示例8: play
def play(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, url):
try:
if imdb == "0":
imdb = "0000000"
imdb = "tt" + re.sub("[^0-9]", "", str(imdb))
content = "movie" if tvshowtitle == None else "episode"
self.sources = self.getSources(
name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date
)
if self.sources == []:
raise Exception()
self.sources = self.sourcesFilter()
if control.window.getProperty("PseudoTVRunning") == "True":
url = self.sourcesDirect()
elif url == "dialog://":
url = self.sourcesDialog()
elif url == "direct://":
url = self.sourcesDirect()
elif (
not control.infoLabel("Container.FolderPath").startswith("plugin://")
and control.setting("autoplay_library") == "false"
):
url = self.sourcesDialog()
elif (
control.infoLabel("Container.FolderPath").startswith("plugin://")
and control.setting("autoplay") == "false"
):
url = self.sourcesDialog()
else:
url = self.sourcesDirect()
if url == None:
raise Exception()
if url == "close://":
return
if control.setting("playback_info") == "true":
control.infoDialog(self.selectedSource, heading=name)
from resources.lib.libraries.player import player
player().run(content, name, url, imdb, tvdb)
return url
except:
control.infoDialog(control.lang(30501).encode("utf-8"))
pass
示例9: playItem
def playItem(self, content, name, imdb, tvdb, source):
try:
next = []
prev = []
for i in range(1,1000000):
try:
u = control.infoLabel('ListItem(%s).FolderPath' % str(i))
u = json.loads(dict(urlparse.parse_qsl(u.replace('?','')))['source'])[0]
next.append(u)
except:
break
for i in range(-1000000,0)[::-1]:
try:
u = control.infoLabel('ListItem(%s).FolderPath' % str(i))
u = json.loads(dict(urlparse.parse_qsl(u.replace('?','')))['source'])[0]
prev.append(u)
except:
break
items = json.loads(source)
source, quality = items[0]['source'], items[0]['quality']
items = [i for i in items+next+prev if i['quality'] == quality and i['source'] == source][:15]
items += [i for i in next+prev if i['quality'] == quality and not i['source'] == source][:35]
block = None
for i in items:
try:
if i['source'] == block: raise Exception()
w = workers.Thread(self.sourcesResolve, i['url'], i['provider'])
w.start() ; time.sleep(20)
if w.is_alive() == True: block = i['source']
if self.url == None: raise Exception()
if control.setting('playback_info') == 'true':
control.infoDialog(i['label'], heading=name)
from resources.lib.libraries.player import player
player().run(content, name, self.url, imdb, tvdb)
return self.url
except:
pass
raise Exception()
except:
control.infoDialog(control.lang(30501).encode('utf-8'))
pass
示例10: play
def play(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta, url):
try:
if not control.infoLabel('Container.FolderPath').startswith('plugin://'):
control.playlist.clear()
control.resolve(int(sys.argv[1]), True, control.item(path=None))
control.execute('Dialog.Close(okdialog)')
if imdb == '0': imdb = '0000000'
imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))
content = 'movie' if tvshowtitle == None else 'episode'
self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date)
if self.sources == []: raise Exception()
self.sources = self.sourcesFilter()
if control.window.getProperty('PseudoTVRunning') == 'True':
url = self.sourcesDirect()
elif url == 'dialog://':
url = self.sourcesDialog()
elif url == 'direct://':
url = self.sourcesDirect()
elif not control.infoLabel('Container.FolderPath').startswith('plugin://') and control.setting('autoplay_library') == 'false':
url = self.sourcesDialog()
elif control.infoLabel('Container.FolderPath').startswith('plugin://') and control.setting('autoplay') == 'false':
url = self.sourcesDialog()
else:
url = self.sourcesDirect()
if url == None: raise Exception()
if url == 'close://': return
if control.setting('playback_info') == 'true':
control.infoDialog(self.selectedSource, heading=name)
try: self.progressDialog.close()
except: pass
control.sleep(200)
from resources.lib.libraries.player import player
player().run(content, name, url, year, imdb, tvdb, meta)
return url
except:
control.infoDialog(control.lang(30501).encode('utf-8'))
示例11: 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('You need to remove file manually', 'Can not remove from Queue')
示例12: playItem
def playItem(self, content, name, imdb, tvdb, url, source, provider):
try:
url = self.sourcesResolve(url, provider)
if url == None: raise Exception()
if control.setting('playback_info') == 'true':
control.infoDialog(source, heading=name)
from resources.lib.libraries.player import player
player().run(content, name, url, imdb, tvdb)
return url
except:
control.infoDialog(control.lang(30501).encode('utf-8'))
pass
示例13: clearSources
def clearSources(self):
try:
yes = control.yesnoDialog(control.lang(30510).encode('utf-8'), '', '')
if not yes: return
control.makeFile(control.dataPath)
dbcon = database.connect(control.sourcescacheFile)
dbcur = dbcon.cursor()
dbcur.execute("DROP TABLE IF EXISTS rel_src")
dbcur.execute("VACUUM")
dbcon.commit()
control.infoDialog(control.lang(30511).encode('utf-8'))
except:
pass
示例14: add
def add(self, name, title, year, imdb, tmdb, range=False):
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
try:
if not self.dupe_setting == "true":
raise Exception()
id = [imdb, tmdb] if not tmdb == "0" else [imdb]
lib = control.jsonrpc(
'{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["imdbnumber", "originaltitle", "year"]}, "id": 1}'
% (year, str(int(year) + 1), str(int(year) - 1))
)
lib = unicode(lib, "utf-8", errors="ignore")
lib = json.loads(lib)["result"]["movies"]
lib = [
i
for i in lib
if str(i["imdbnumber"]) in id
or (i["originaltitle"].encode("utf-8") == title and str(i["year"]) == year)
][0]
except:
lib = []
try:
if not lib == []:
raise Exception()
if self.check_setting == "true":
from resources.lib.sources import sources
src = sources().checkSources(name, title, year, imdb, tmdb, "0", "0", None, None, None, "0", None)
if src == False:
raise Exception()
self.strmFile({"name": name, "title": title, "year": year, "imdb": imdb, "tmdb": tmdb})
except:
pass
if range == True:
return
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)")
示例15: onPlayBackStarted
def onPlayBackStarted(self):
if control.setting('playback_info') == 'true':
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)
try:
if self.offset == '0': raise Exception()
self.seekTime(float(self.offset))
except:
pass
try:
if not control.setting('subtitles') == 'true': raise Exception()
try: subtitle = subtitles.get(self.name, self.imdb, self.season, self.episode)
except: subtitle = subtitles.get(self.name, self.imdb, '', '')
except:
pass