本文整理汇总了Python中navigation.Navigation.dispatch方法的典型用法代码示例。如果您正苦于以下问题:Python Navigation.dispatch方法的具体用法?Python Navigation.dispatch怎么用?Python Navigation.dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation.Navigation
的用法示例。
在下文中一共展示了Navigation.dispatch方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: traverse
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def traverse(self, dir_items, stack):
print '***** stack: ' + str(stack)
i = 0
for (handle, url, listitem, isFolder) in dir_items:
i += 1
params = url.split('?')[1]
if isFolder or (self.traverse_video and url.find('plugin') == 0):
self.xbmcplugin.reset()
swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin,
self.xbmcgui, self.xbmcaddon)
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon, swe, 'plugin', '1',
'?' + params)
if listitem.caption == nav.localize(30301):
continue
stack.append(i)
print '***** selecting %d: %s' % (i, listitem.caption)
nav.dispatch()
new_list = deepcopy(self.xbmcplugin.dir_items)
self.traverse(new_list, stack)
else:
pass
if len(stack) > 0:
stack.pop()
return
示例2: diritems
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def diritems(self, params=None):
self.xbmcplugin.reset()
swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.addon)
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.addon, swe, 'plugin', '1', params)
nav.dispatch()
return self.xbmcplugin.dir_items
示例3: test_main_menu
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def test_main_menu(self):
argv = ['plugin.video.dreamfilm', '1']
xbmc = Xbmc()
xbmcplugin = Xbmcplugin()
xbmcgui = Xbmcgui()
df = dreamfilm.Dreamfilm()
navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
navigation.dispatch()
self.assertEqual(len(xbmcplugin.dir_items), 8)
示例4: test_traverse_all
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def test_traverse_all(self):
self.xbmcplugin.reset()
swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon)
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon, swe, 'plugin', '1', '')
self.assertEquals(nav.plugin_url, 'plugin')
self.assertEquals(nav.handle, 1)
self.assertEquals(nav.params, {})
# call with no parameters
nav.dispatch()
self.traverse_video = True
self.traverse(self.xbmcplugin.dir_items, [])
示例5: test_traverse_all
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def test_traverse_all(self):
argv = ['plugin', '1', '']
self.streamtv = streamtv.Streamtv(self.xbmc, self.xbmcplugin,
self.xbmcgui, self.xbmcaddon)
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon, self.streamtv, argv)
self.assertEquals(nav.plugin_url, 'plugin')
self.assertEquals(nav.handle, 1)
self.assertEquals(nav.params, {})
# call with no parameters
nav.dispatch()
self.traverse_video = False
self.traverse(self.xbmcplugin.dir_items, [])
示例6: test_list_latest_movies
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def test_list_latest_movies(self):
url = 'plugin.video.dreamfilm'
params = Navigation.encode_parameters({'action': 'latestmovies'})
argv = [url, 1, params]
xbmc = Xbmc()
xbmcplugin = Xbmcplugin()
xbmcgui = Xbmcgui()
df = dreamfilm.Dreamfilm()
with open('fixtures/startpage.html') as f:
df._latest_movie_html = mock.MagicMock(return_value=f.read())
navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
navigation.dispatch()
self.assertEqual(len(xbmcplugin.dir_items), 12)
示例7: test_search_dispatch
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def test_search_dispatch(self):
# Mock
xbmc = Xbmc()
xbmcplugin = Xbmcplugin()
xbmcgui = Xbmcgui()
xbmc.Keyboard.getText = mock.MagicMock(return_value='bad')
df = dreamfilm.Dreamfilm()
with open('fixtures/search.html') as f:
df._search = mock.MagicMock(return_value=f.read())
params = Navigation.encode_parameters({'action': 'search'})
argv = ['plugin.video.dreamfilm', '1', params]
navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
navigation.dispatch()
self.assertEqual(len(xbmcplugin.dir_items), 3)
示例8: traverse
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def traverse(self, dir_items, stack):
print '***** stack: ' + str(stack)
self.streamtv = streamtv.Streamtv(self.xbmc, self.xbmcplugin,
self.xbmcgui, self.xbmcaddon)
i = 0
for (handle, url, listitem, isFolder) in dir_items:
i += 1
params = url.split('?')[1]
if isFolder or (self.traverse_video and url.find('plugin') == 0):
stack.append(i)
print '***** selecting %d: %s' % (i, listitem.caption)
argv = ['plugin', '1', '?' + params]
self.xbmcplugin.reset()
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon, self.streamtv, argv)
nav.dispatch()
new_list = deepcopy(self.xbmcplugin.dir_items)
self.traverse(new_list, stack)
else:
pass
if len(stack) > 0:
stack.pop()
return
示例9: test_navigation
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
def test_navigation(self):
argv = ['plugin', '1', '']
self.streamtv = streamtv.Streamtv(self.xbmc, self.xbmcplugin,
self.xbmcgui, self.xbmcaddon)
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon, self.streamtv, argv)
self.assertEquals(nav.plugin_url, 'plugin')
self.assertEquals(nav.handle, 1)
self.assertEquals(nav.params, {})
# call with no parameters
nav.dispatch()
self.assertTrue(len(self.xbmcplugin.dir_items) > 0)
self.assertEquals(self.xbmcplugin.dir_items[0][2].caption, 'Alla')
# select first item in list
params = self.xbmcplugin.dir_items[0][1].split('?')[1]
argv = ['plugin', '1', '?' + params]
self.xbmcplugin.reset()
nav = Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
self.xbmcaddon, self.streamtv, argv)
nav.dispatch()
self.assertTrue(len(self.xbmcplugin.dir_items) > 0)
示例10: Navigation
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
# -*- coding: utf-8 -*-
import sys
import xbmcplugin
import xbmcgui
import xbmcaddon
import xbmc
from navigation import Navigation
navigation = Navigation(xbmc, xbmcplugin, xbmcgui, xbmcaddon, sys.argv)
navigation.dispatch()
示例11: Xbmc
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import dispatch [as 别名]
from navigation import Navigation
import dreamfilm
from mocks import Xbmc, Xbmcgui, Xbmcplugin
if __name__ == '__main__':
argv = ['./offline.py', 1]
history = []
history.append(argv)
while True:
xbmc = Xbmc()
xbmcplugin = Xbmcplugin()
xbmcgui = Xbmcgui()
navigation = Navigation(dreamfilm.Dreamfilm(), xbmc, xbmcplugin, xbmcgui, argv)
ret = navigation.dispatch()
if ret == Xbmc.BACK:
history = history[:-1]
argv = history[-1]
continue
if not xbmcplugin.dir_items:
continue
for idx, item in enumerate(xbmcplugin.dir_items):
print "%d) %s" % (idx, item[2].caption)
print "Enter number for menu option or '..' to go back"
inp = raw_input('>> ')
if inp == "..":
history = history[:-1]
argv = history[-1]
continue