def main(argv=None): if sys.argv: argv = sys.argv queries = kodi.parse_query(sys.argv[2]) log_utils.log('Version: |%s| Queries: |%s|' % (kodi.get_version(), queries)) log_utils.log('Args: |%s|' % (argv)) # don't process params that don't match our url exactly. (e.g. plugin://plugin.video.1channel/extrafanart) plugin_url = 'plugin://%s/' % (kodi.get_id()) if argv[0] != plugin_url: return mode = queries.get('mode', None) url_dispatcher.dispatch(mode, queries)
def play_link(link): log_utils.log('Playing Link: |%s|' % (link), log_utils.LOGDEBUG) hmf = urlresolver.HostedMediaFile(url=link) if not hmf: log_utils.log('Indirect hoster_url not supported by urlresolver: %s' % (link)) return False log_utils.log('Link Supported: |%s|' % (link), log_utils.LOGDEBUG) stream_url = hmf.resolve() if not stream_url or not isinstance(stream_url, basestring): try: msg = stream_url.msg except: msg = link kodi.notify('Resolve Failed: %s' % (msg), duration=7500) return False log_utils.log('Link Resolved: |%s|%s|' % (link, stream_url), log_utils.LOGDEBUG) listitem = xbmcgui.ListItem(path=stream_url) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)