# Path: core/logger.py
# def log_enable(active):
# def encode_log(message=""):
# def get_caller(message=None):
# def info(texto=""):
# def debug(texto=""):
# def error(texto=""):
# 
# Path: core/config.py
# PLATFORM_NAME = "kodi-isengard"
# PLUGIN_NAME = "streamondemand-pureita-master"
# def get_platform():
# def is_xbmc():
# def get_library_support():
# def get_system_platform():
# def open_settings():
# def get_setting(name):
# def set_setting(name,value):
# def get_localized_string(code):
# def get_library_path():
# def get_temp_file(filename):
# def get_runtime_path():
# def get_data_path():
# def get_cookie_data():
# def verify_directories_created():
# 
# Path: core/scrapertools.py
# def cache_page(url,post=None,headers=None,modo_cache=None, timeout=None):
# def cachePage(url,post=None,headers=None,modoCache=None, timeout=None):
# def downloadpage(url,post=None,headers=None, follow_redirects=True, timeout=None, header_to_get=None):
# def downloadpageWithResult(url,post=None,headers=None,follow_redirects=True, timeout=None, header_to_get=None):
# def downloadpageWithoutCookies(url):
# def downloadpageGzip(url):
# def getLocationHeaderFromResponse(url):
# def get_header_from_response(url, header_to_get="", post=None, headers=None, follow_redirects=False):
# def get_headers_from_response(url, post=None, headers=None, follow_redirects=False):
# def read_body_and_headers(url, post=None, headers=None, follow_redirects=False, timeout=None):
# def anti_cloudflare(url, headers=None, post=None):
# def printMatches(matches):
# def get_match(data,patron,index=0):
# def find_single_match(data,patron,index=0):
# def find_multiple_matches(text,pattern):
# def entityunescape(cadena):
# def unescape(text):
#     def fixup(m):
# def decodeHtmlentities(string):
#     def substitute_entity(match):
# def entitiesfix(string):
# def htmlclean(cadena):
# def slugify(title):
# def remove_htmltags(string):
# def remove_show_from_title(title,show):
# def getRandom(str):
# def unseo(cadena):
# def get_filename_from_url(url):
# def get_domain_from_url(url):
# def get_season_and_episode(title):
# def get_sha1(cadena):
# def get_md5(cadena):
# def internet(host="8.8.8.8", port=53, timeout=3):
# def wait_for_internet(wait=30, retry=5):


import urllib, urllib2
import os,sys
            import channelselector as plugin
                import xbmc
            import channelselector as plugin
            import channelselector as plugin
            import channelselector as plugin
                import channels.personal as channel
                            import xbmcgui
                        import xbmcgui
                    import xbmcgui
                            import sys
                    import xbmc
                    import xbmcplugin
                    import sys
        import traceback,sys
        import xbmcgui
            import traceback
                            import xbmcgui
from core import logger
from core import config
from core import scrapertools
                from core import updater
                    from platformcode import xbmctools
                from core.item import Item
                from platformcode import xbmctools
                        from servers import servertools
                    from platformcode import xbmctools
                    from platformcode import library
                    from platformcode import library
                    from platformcode import library
                            from servers import servertools
                        from platformcode import subtitletools
        from pprint import pprint
    from servers import servertools
    from core import downloadtools
            plugin.listchannels(params,url,category)

        # El resto de acciones vienen en el parámetro "action", y el canal en el parámetro "channel"
        else:
            '''
            if action=="mainlist" and config.get_setting("updatechannels")=="true":
                try:
                    from core import updater
                    actualizado = updater.updatechannel(channel_name)

                    if actualizado:
                        import xbmcgui
                        advertencia = xbmcgui.Dialog()
                        advertencia.ok("plugin",channel_name,config.get_localized_string(30063))
                except:
                    pass
            '''

            # La acción puede estar en el core, o ser un canal regular. El buscador es un canal especial que está en streamondemand-pureita
            regular_channel_path = os.path.join( config.get_runtime_path() , 'channels' , channel_name+".py" )
            core_channel_path = os.path.join( config.get_runtime_path(), 'core' , channel_name+".py" )
            logger.info("streamondemand-pureita.platformcode.launcher regular_channel_path=%s" % regular_channel_path)
            logger.info("streamondemand-pureita.platformcode.launcher core_channel_path=%s" % core_channel_path)

            if channel_name=="personal" or channel_name=="personal2" or channel_name=="personal3" or channel_name=="personal4" or channel_name=="personal5":
            elif os.path.exists( regular_channel_path ):
                exec "import channels."+channel_name+" as channel"
            elif os.path.exists( core_channel_path ):
                exec "from core import "+channel_name+" as channel"


# Path: core/logger.py
# def log_enable(active):
# def encode_log(message=""):
# def get_caller(message=None):
# def info(texto=""):
# def debug(texto=""):
# def error(texto=""):
# 
# Path: core/config.py
# PLATFORM_NAME = "kodi-isengard"
# PLUGIN_NAME = "streamondemand-pureita-master"
# def get_platform():
# def is_xbmc():
# def get_library_support():
# def get_system_platform():
# def open_settings():
# def get_setting(name):
# def set_setting(name,value):
# def get_localized_string(code):
# def get_library_path():
# def get_temp_file(filename):
# def get_runtime_path():
# def get_data_path():
# def get_cookie_data():
# def verify_directories_created():
# 
# Path: core/scrapertools.py
# def cache_page(url,post=None,headers=None,modo_cache=None, timeout=None):
# def cachePage(url,post=None,headers=None,modoCache=None, timeout=None):
# def downloadpage(url,post=None,headers=None, follow_redirects=True, timeout=None, header_to_get=None):
# def downloadpageWithResult(url,post=None,headers=None,follow_redirects=True, timeout=None, header_to_get=None):
# def downloadpageWithoutCookies(url):
# def downloadpageGzip(url):
# def getLocationHeaderFromResponse(url):
# def get_header_from_response(url, header_to_get="", post=None, headers=None, follow_redirects=False):
# def get_headers_from_response(url, post=None, headers=None, follow_redirects=False):
# def read_body_and_headers(url, post=None, headers=None, follow_redirects=False, timeout=None):
# def anti_cloudflare(url, headers=None, post=None):
# def printMatches(matches):
# def get_match(data,patron,index=0):
# def find_single_match(data,patron,index=0):
# def find_multiple_matches(text,pattern):
# def entityunescape(cadena):
# def unescape(text):
#     def fixup(m):
# def decodeHtmlentities(string):
#     def substitute_entity(match):
# def entitiesfix(string):
# def htmlclean(cadena):
# def slugify(title):
# def remove_htmltags(string):
# def remove_show_from_title(title,show):
# def getRandom(str):
# def unseo(cadena):
# def get_filename_from_url(url):
# def get_domain_from_url(url):
# def get_season_and_episode(title):
# def get_sha1(cadena):
# def get_md5(cadena):
# def internet(host="8.8.8.8", port=53, timeout=3):
# def wait_for_internet(wait=30, retry=5):


# Path: platformcode/launcher.py
import urllib, urllib2
import os,sys
            import channelselector as plugin
                import xbmc
            import channelselector as plugin
            import channelselector as plugin
            import channelselector as plugin
                import channels.personal as channel
                            import xbmcgui
                        import xbmcgui
                    import xbmcgui
                            import sys
                    import xbmc
                    import xbmcplugin
                    import sys
        import traceback,sys
        import xbmcgui
            import traceback
                            import xbmcgui
from core import logger
from core import config
from core import scrapertools
                from core import updater
                    from platformcode import xbmctools
                from core.item import Item
                from platformcode import xbmctools
                        from servers import servertools
                    from platformcode import xbmctools
                    from platformcode import library
                    from platformcode import library
                    from platformcode import library
                            from servers import servertools
                        from platformcode import subtitletools
        from pprint import pprint
    from servers import servertools
    from core import downloadtools

            plugin.listchannels(params,url,category)

        # El resto de acciones vienen en el parámetro "action", y el canal en el parámetro "channel"
        else:
            '''
            if action=="mainlist" and config.get_setting("updatechannels")=="true":
                try:
                    from core import updater
                    actualizado = updater.updatechannel(channel_name)

                    if actualizado:
                        import xbmcgui
                        advertencia = xbmcgui.Dialog()
                        advertencia.ok("plugin",channel_name,config.get_localized_string(30063))
                except:
                    pass
            '''

            # La acción puede estar en el core, o ser un canal regular. El buscador es un canal especial que está en streamondemand-pureita
            regular_channel_path = os.path.join( config.get_runtime_path() , 'channels' , channel_name+".py" )
            core_channel_path = os.path.join( config.get_runtime_path(), 'core' , channel_name+".py" )
            logger.info("streamondemand-pureita.platformcode.launcher regular_channel_path=%s" % regular_channel_path)
            logger.info("streamondemand-pureita.platformcode.launcher core_channel_path=%s" % core_channel_path)

            if channel_name=="personal" or channel_name=="personal2" or channel_name=="personal3" or channel_name=="personal4" or channel_name=="personal5":
            elif os.path.exists( regular_channel_path ):
                exec "import channels."+channel_name+" as channel"
            elif os.path.exists( core_channel_path ):
                exec "from core import "+channel_name+" as channel"


            logger.info("streamondemand-pureita.platformcode.launcher running channel %s %s" % (channel.__name__ , channel.__file__))