本文整理汇总了Python中xbmcswift2.xbmc.executebuiltin函数的典型用法代码示例。如果您正苦于以下问题:Python executebuiltin函数的具体用法?Python executebuiltin怎么用?Python executebuiltin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了executebuiltin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_channel
def remove_channel(channel):
channels = get_channels()
try:
channels.remove(channel)
except:
pass
xbmc.executebuiltin("Container.Refresh")
示例2: batch_add_movies_to_library
def batch_add_movies_to_library(library_folder, id):
if id == None:
return
changed = False
movie_folder = os.path.join(library_folder, str(id) + "/")
if not xbmcvfs.exists(movie_folder):
try:
xbmcvfs.mkdir(movie_folder)
except:
pass
nfo_filepath = os.path.join(movie_folder, str(id) + ".nfo")
if not xbmcvfs.exists(nfo_filepath):
changed = True
nfo_file = xbmcvfs.File(nfo_filepath, "w")
content = "http://www.imdb.com/title/%s/" % str(id)
nfo_file.write(content)
nfo_file.close()
strm_filepath = os.path.join(movie_folder, str(id) + ".strm")
src = "imdb"
if not xbmcvfs.exists(strm_filepath):
changed = True
strm_file = xbmcvfs.File(strm_filepath, "w")
try:
content = plugin.url_for("movies_play", src=src, id=id, mode="library")
strm_file.write(content)
strm_file.close()
except:
pass
if xbmc.getCondVisibility("system.hasaddon(script.qlickplay)"):
xbmc.executebuiltin("RunScript(script.qlickplay,info=afteradd)")
if xbmc.getCondVisibility("system.hasaddon(script.extendedinfo)"):
xbmc.executebuiltin("RunScript(script.extendedinfo,info=afteradd)")
return changed
示例3: listRecordings
def listRecordings():
recordings=[]
defaultrecording=str(plugin.get_setting("defaultrecording", unicode))
alllanguages = sorted(bibledata.languagelib)
for language in alllanguages:
thislanguage = bibledata.languagelib[language]
recordings.append({'label': thislanguage['title'],
'path': plugin.url_for('listRecordings'),
'icon': 'DefaultShortcut.png'})
for index in bibledata.recordinglib:
recording = dict(bibledata.recordinglib[index])
if recording['language']==language:
alabel = recording['title']
if recording['code']==defaultrecording:
alabel=alabel + " (Current Default Recording)"
recordings.append(
{'label': alabel,
'path': plugin.url_for('listBooks', recording=recording['code']),
'context_menu':[
makedefaultrecording(recording['code'])
],
'icon': 'DefaultArtist.png'
}
)
if forceViewMode=="true":
xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')
return plugin.finish(recordings)
示例4: PasswordSection
def PasswordSection(password="0000", path="0", tracking_string="Home"):
'''
Liệt kê danh sách các item của một sheet
Parameters
----------
path : string
"gid" của sheet
tracking_string : string
Tên dễ đọc của view
'''
GA( # tracking
"Password Section - %s" % tracking_string,
"/password-section/%s" % path
)
passwords = plugin.get_storage('passwords')
if password in passwords and (time.time() - passwords[password] < 1800):
items = AddTracking(getItems(path))
return plugin.finish(items)
else:
passw_string = plugin.keyboard(heading='Nhập password')
if passw_string == password:
passwords[password] = time.time()
items = AddTracking(getItems(path))
return plugin.finish(items)
else:
header = "Sai mật khẩu!!!"
message = "Mật khẩu không khớp. Không tải được nội dung"
xbmc.executebuiltin('Notification("%s", "%s", "%d", "%s")' %
(header, message, 10000, ''))
return plugin.finish()
示例5: main
def main():
channel = []
result = urlfetch.fetch(__homeUrl__,headers=reg)
soup = BeautifulSoup(result.content, convertEntities=BeautifulSoup.HTML_ENTITIES)
items = soup.findAll('div', {'class' : 'item_view'})
for item in items:
common = item.find('a', {'class' : 'tv_channel '})
if common == None :
common = item.find('a', {'class' : 'tv_channel active'})
lock = item.find('img', {'class' : 'lock'})
if lock == None :
title = common.get('title')
url = common.get('data-href')
thumb = common.find('img',{'class':'img-responsive'}).get('data-original')
thumb = thumb.split('?')
if 'giai-tri-tv' in url or 'phim-viet' in url or 'the-thao-tv-hd' in url or 'kenh-17' in url or 'e-channel' in url or 'hay-tv' in url or 'ddramas' in url or 'bibi' in url or 'o2-tv' in url or 'info-tv' in url or 'style-tv' in url or 'invest-tv' in url or 'yeah1' in url:
pass
else :
data = {
'label': title.replace('-',' '),
'path': xbmcplugin.url_for('plays', id = url.replace('http://fptplay.net/livetv/','')),
'thumbnail':thumb[0],
'is_playable': True
}
channel.append(data)
xbmc.executebuiltin('Container.SetViewMode(%d)' % 500)
return xbmcplugin . finish ( channel )
示例6: search
def search(search_func, term = None):
""" Search wrapper """
external = False
if plugin.id == xbmc.getInfoLabel('Container.PluginName'):
# Skip if search item isn't currently selected
label = xbmc.getInfoLabel('ListItem.label')
if label and not equals(label, _("Search")):
return
else:
external = True
if term is None:
# Get search keyword
search_entered = plugin.keyboard(heading=_("search for"))
if not search_entered:
return
else:
search_entered = term
# Perform search
url = plugin.url_for(search_func, term=search_entered, page='1')
if external:
xbmc.executebuiltin('ActivateWindow(10025,"plugin://%s/",return)' % plugin.id)
xbmc.executebuiltin('Container.Update("%s")' % url)
else:
plugin.redirect(url)
示例7: AddPlaylist
def AddPlaylist(tracking_string="Add Playlist"):
sheet_url = plugin.keyboard(
heading='Nhập URL của Google Spreadsheet (có hỗ trợ link rút gọn như bit.ly, goo.gl)')
if sheet_url:
if not re.match("^https*://", sheet_url):
sheet_url = "https://" + sheet_url
try:
resp, content = http.request(sheet_url, "HEAD")
sid, gid = re.compile(
"/d/(.+?)/.+?gid=(\d+)").findall(resp["content-location"])[0]
match_passw = re.search('passw=(.+?)($|&)', resp["content-location"])
playlists = plugin.get_storage('playlists')
name = plugin.keyboard(heading='Đặt tên cho Playlist')
item = "[[COLOR yellow]%s[/COLOR]] %[email protected]%s" % (name, gid, sid)
if match_passw:
item += "@@" + match_passw.group(1)
if 'sections' in playlists:
playlists["sections"] = [item] + playlists["sections"]
else:
playlists["sections"] = [item]
xbmc.executebuiltin('Container.Refresh')
except:
line1 = "Vui lòng nhập URL hợp lệ. Ví dụ dạng đầy đủ:"
line2 = "http://docs.google.com/spreadsheets/d/xxx/edit#gid=###"
line3 = "Hoặc rút gọn: http://bit.ly/xxxxxx hoặc http://goo.gl/xxxxx"
dlg = xbmcgui.Dialog()
dlg.ok("URL không hợp lệ!!!", line1, line2, line3)
示例8: on_play_video
def on_play_video(mode, players, params, trakt_ids=None):
assert players
# Cancel resolve
action_cancel()
# Get video link
use_simple_selector = plugin.get_setting(SETTING_USE_SIMPLE_SELECTOR, converter=bool)
is_extended = not (use_simple_selector or len(players) == 1)
if not is_extended:
xbmc.executebuiltin("ActivateWindow(busydialog)")
try:
selection = get_video_link(players, params, mode, use_simple_selector)
finally:
if not is_extended:
xbmc.executebuiltin("Dialog.Close(busydialog)")
if not selection:
return
# Get selection details
link = selection["path"]
action = selection.get("action", "")
plugin.log.info("Playing url: %s" % to_utf8(link))
# Activate link
if action == "ACTIVATE":
action_activate(link)
else:
if trakt_ids:
set_property("script.trakt.ids", json.dumps(trakt_ids))
return link
return None
示例9: movies_batch_add_to_library
def movies_batch_add_to_library():
""" Batch add movies to library """
movie_batch_file = plugin.get_setting(SETTING_MOVIES_BATCH_ADD_FILE_PATH)
if xbmcvfs.exists(movie_batch_file):
try:
f = open(xbmc.translatePath(movie_batch_file), 'r')
r = f.read()
f.close()
ids = r.split('\n')
except: return plugin.notify(msg='Movies Batch Add File', title='Not found', delay=3000, image=get_icon_path("movies"))
library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))
import_tmdb()
for id in ids:
if "," in id:
csvs = id.split(',')
for csv in csvs:
if not str(csv).startswith("tt") and csv != "":
movie = tmdb.Movies(csv).info()
id = movie.get('imdb_id')
batch_add_movies_to_library(library_folder, id)
else:
if not str(id).startswith("tt") and id != "":
movie = tmdb.Movies(id).info()
id = movie.get('imdb_id')
batch_add_movies_to_library(library_folder, id)
os.remove(xbmc.translatePath(movie_batch_file))
if xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)):
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/tv/batch_add_to_library)")
return True
else:
xbmc.sleep(1000)
plugin.notify(msg='Added movie strm-files', title='Starting library scan', delay=3000, image=get_icon_path("movies"))
scan_library(type="video")
return True
elif xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)): xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/tv/batch_add_to_library)")
示例10: lists_trakt_add_liked_to_library
def lists_trakt_add_liked_to_library():
lists, pages = trakt.trakt_get_liked_lists(1)
misc_ids = []
movie_ids = []
tv_ids = []
import xbmcgui
pDialog = xbmcgui.DialogProgress()
pDialog.create('[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR]', 'Creating batch import files')
for page in range(0, int(pages)):
lists, ignore = trakt.trakt_get_liked_lists(page)
list_number = 1
if (pDialog.iscanceled()): return
percent = (int(page) / int(pages)) * 100
pDialog.update(int(percent), '{0} {1} of {2} ... '.format(_("Scanning for new content"), page, pages))
for list in lists:
list_number += 1
pDialog.update(int(percent), '{0} {1} of {2} ... '.format(_("Scanning for new content"), page, pages), 'list {0} of {1} on page'.format(list_number, len(lists) + 1))
info = list["list"]
user = info["user"]["username"]
slug = info["ids"]["slug"]
items = lists_trakt_show_list(user, slug)
list_misc_ids, list_movie_ids, list_tv_ids = batch_find_list_ids(items)
write_list_id_files(list_misc_ids, list_movie_ids, list_tv_ids, slug, user)
misc_ids.extend(list_misc_ids)
movie_ids.extend(list_movie_ids)
tv_ids.extend(list_tv_ids)
pDialog.close()
write_batch_id_files(tv_ids, movie_ids, misc_ids)
dialogs.notify(msg='Generating', title='.strm-files', delay=3000, image=get_icon_path("metalliq"))
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/movies/batch_add_to_library)")
示例11: lists_trakt_add_all_to_library
def lists_trakt_add_all_to_library(user, slug):
items = lists_trakt_show_list(user, slug, raw=True)
misc_ids, movie_ids, tv_ids = batch_find_list_ids(items)
write_list_id_files(misc_ids, tv_ids, movie_ids, slug, user)
write_batch_id_files(tv_ids, movie_ids, misc_ids)
dialogs.notify(msg='Conversion done', title='starting batch-add', delay=3000, image=get_icon_path("metalliq"))
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/movies/batch_add_to_library)")
示例12: scan_library
def scan_library(type="video"):
while not xbmc.abortRequested and \
(xbmc.getCondVisibility('Library.IsScanning') or \
xbmc.getCondVisibility('Window.IsActive(progressdialog)')):
xbmc.sleep(1000)
xbmc.executebuiltin('UpdateLibrary(video)')
xbmc.executebuiltin('UpdateLibrary(music)')
示例13: move_channel_down
def move_channel_down(channel):
channels = get_channels()
old_index = channels.index(channel)
new_index = old_index + 1
if old_index >= 0:
channels.insert(new_index, channels.pop(old_index))
xbmc.executebuiltin("Container.Refresh")
示例14: mark_as_watched
def mark_as_watched(self):
if not self.id:
return
RPC.video_library.set_episode_details(episodeid = self.id, \
playcount=1, resume={"position": 0})
xbmc.executebuiltin('Container.Refresh')
示例15: live_search_term
def live_search_term(term):
""" Perform search of a specified <term>"""
term = to_utf8(term)
channels = get_channels()
if term not in channels:
channels.append(term)
xbmc.executebuiltin("Container.Refresh")
return live_play(term)