def play_acestream_link(url, name='Video', icon=None): """ Play an acestream link by the provided name, icon and url. :param url: Acestream url :type url: str :param name: Link name :type name: str :param icon: Icon url :type icon: str """ _plexus_uri = 'plugin://program.plexus/?mode=1&url={CHURL}&name={CHNAME}'\ .format( CHURL=urllib.quote(url, safe=''), CHNAME=urllib.quote(name, safe='') ) if icon: _plexus_uri += "&iconimage={CHICON}".format( CHICON=urllib.quote(icon, safe='')) tools.write_log('PLAY: %s | %s' % (name, url)) tools.write_log('URI: "{0}"'.format(_plexus_uri)) xbmc.Player().play("{0}".format(_plexus_uri))
def check_for_updates(notify, notify_secs): cache = Cache(__path__, minutes=5) # Si está en caché continúa c_version = cache.load(_server_addon_xml_url, False) if c_version: return # No está en caché, comprueba la última versión try: xml = tools.get_web_page(_server_addon_xml_url) except WebSiteError as ex: tools.write_log('%s: %s' % (ex.title, ex.message)) return server_v = re.findall(r'version="([0-9]{1,5}\.[0-9]{1,5}\.[0-9]{1,5})"', xml, re.U) if server_v and type(server_v) == list and len(server_v) > 0: cache.save(_server_addon_xml_url, {'version': server_v[0]}) sv = server_v[0].split('.') lv = __version__.split('.') if float('%s.%s' % (sv[0], sv[1])) > float('%s.%s' % (lv[0], lv[1])) or \ (float('%s.%s' % (sv[0], sv[1])) == float('%s.%s' % (lv[0], lv[1])) and int(sv[2]) > int(lv[2])): tools.write_log('Server version: %s' % server_v[0]) tools.write_log('Installed version: %s' % __version__) if notify: tools.Notify().notify(u'Acestream Sports', u'Se está actualizando a la versión %s' % server_v[0], disp_time=notify_secs) xbmc.executebuiltin("UpdateAddonRepos") xbmc.executebuiltin("UpdateLocalAddons")
# Menú de MovistarTV if 'event' in params: kodi.show_channels(movistartv.get_channels( params['event'])) # Opciones de SportsTV elif params['source'] == 'SportsTV': sportstv = MovistarTV(settings, sports=True) if params['action'] == 'show': # Menú de MovistarTV if 'event' in params: kodi.show_channels(sportstv.get_channels(params['event'])) elif params['action'] == 'play': if 'url' in params: Kodi.play_acestream_link(params['url'], params['name'], params['icon']) elif 'video' in params: kodi.play_video(params['video']) if __name__ == '__main__': try: # Llama al controlador y le pasa la cadena de parámetros controller(sys.argv[2][1:]) except WebSiteError as e: tools.write_log('%s: %s' % (e.title, e.message)) tools.Notify().notify(e.title, e.message, disp_time=e.time)