示例#1
0
    def run(self):
        html = BS(urlread(self.args['url']))
        flashvars = html.find('embed')['src']
        params = parse_url_qs(flashvars)
        host = params['host']
        playpath = 'ampsflash/%s' % params['flv']
        url = 'rtmp://%s/ondemand?_fcs_vhost=%s' % (host, host)
        properties = {'PlayPath': playpath,
                      'TcUrl': url}

        self.app.play_video(url, info=self.args['info'], properties=properties)
    def __init__(self, modes, plugin_id=None, default_handler=None, plugin_name='XBMC Video Plugin'):
        self.plugin_id = plugin_id
        self.plugin_name = plugin_name
        self.addon = xbmcaddon.Addon(id=self.plugin_id)
        self.dp = None
        #set the default mode, when the plugin is first called, there will be no qs arguments
        #use user_specified default_handler, else pick the first handler in the modes list
        self.default_handler = default_handler or modes[0][1] 
        self.modes = dict(modes)

        #parse command line parameters into a dictionary
        self.argv0 = sys.argv[0]
        self.argv1 = int(sys.argv[1])

        #parse params from qs, also include the pickled fragment
        self.params = parse_url_qs(sys.argv[2], pickled_fragment=True)