# 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/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/downloadtools.py
# def limpia_nombre_caracteres_especiales(s):
# def limpia_nombre_sin_acentos(s):
# def limpia_nombre_excepto_1(s):
# def limpia_nombre_excepto_2(s):
# def getfilefromtitle(url,title):
# def downloadtitle(url,title):
# def downloadbest(video_urls,title,continuar=False):
# def downloadfile(url,nombrefichero,headers=[],silent=False,continuar=False):
# def downloadfileGzipped(url,pathfichero):
# def GetTitleFromFile(title):
# def sec_to_hms(seconds):
# def downloadIfNotModifiedSince(url,timestamp):
# 
# 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
import os
import re
import sys
import xbmc
import xbmcgui
import string
import xml.parsers.expat
from core import config
from core import logger
from core import downloadtools
from core import scrapertools
    s = s.replace("à","a")
    s = s.replace("è","e")
    s = s.replace("ì","i")
    s = s.replace("ò","o")
    s = s.replace("ù","u")
    s = s.replace("ç","c")
    s = s.replace("Ç","C")
    s = s.replace("Ñ","n")
    s = s.replace("ñ","n")
    return s

def title_to_folder_name(title):
    logger.info("Serie="+title)
    Serie = elimina_tildes(title)
    logger.info("Serie="+Serie)
    Serie = string.translate(Serie,allchars,deletechars)
    logger.info("Serie="+Serie)
    return Serie
 
def savelibrary(titulo="",url="",thumbnail="",server="",plot="",canal="",category="Cine",Serie="",verbose=True,accion="play_from_library",pedirnombre=True, subtitle="", extra=""):
    logger.info("[library.py] savelibrary titulo="+titulo+", url="+url+", server="+server+", canal="+canal+", category="+category+", serie="+Serie+", accion="+accion+", subtitle="+subtitle)

    if category != "Series":  #JUR - DEBUGIN INTERNO PARA 2.14
        category = "Cine"
        
    if category == "Cine":
        filename=string.translate(titulo,allchars,deletechars)+".strm"
        fullfilename = os.path.join(MOVIES_PATH,filename)
    elif category == "Series":
        if Serie == "": #Añadir comprobación de len>0 bien hecha

# 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/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/downloadtools.py
# def limpia_nombre_caracteres_especiales(s):
# def limpia_nombre_sin_acentos(s):
# def limpia_nombre_excepto_1(s):
# def limpia_nombre_excepto_2(s):
# def getfilefromtitle(url,title):
# def downloadtitle(url,title):
# def downloadbest(video_urls,title,continuar=False):
# def downloadfile(url,nombrefichero,headers=[],silent=False,continuar=False):
# def downloadfileGzipped(url,pathfichero):
# def GetTitleFromFile(title):
# def sec_to_hms(seconds):
# def downloadIfNotModifiedSince(url,timestamp):
# 
# 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/library.py
import urllib
import os
import re
import sys
import xbmc
import xbmcgui
import string
import xml.parsers.expat
from core import config
from core import logger
from core import downloadtools
from core import scrapertools

    s = s.replace("à","a")
    s = s.replace("è","e")
    s = s.replace("ì","i")
    s = s.replace("ò","o")
    s = s.replace("ù","u")
    s = s.replace("ç","c")
    s = s.replace("Ç","C")
    s = s.replace("Ñ","n")
    s = s.replace("ñ","n")
    return s

def title_to_folder_name(title):
    logger.info("Serie="+title)
    Serie = elimina_tildes(title)
    logger.info("Serie="+Serie)
    Serie = string.translate(Serie,allchars,deletechars)
    logger.info("Serie="+Serie)
    return Serie
 
def savelibrary(titulo="",url="",thumbnail="",server="",plot="",canal="",category="Cine",Serie="",verbose=True,accion="play_from_library",pedirnombre=True, subtitle="", extra=""):
    logger.info("[library.py] savelibrary titulo="+titulo+", url="+url+", server="+server+", canal="+canal+", category="+category+", serie="+Serie+", accion="+accion+", subtitle="+subtitle)

    if category != "Series":  #JUR - DEBUGIN INTERNO PARA 2.14
        category = "Cine"
        
    if category == "Cine":
        filename=string.translate(titulo,allchars,deletechars)+".strm"
        fullfilename = os.path.join(MOVIES_PATH,filename)
    elif category == "Series":
        if Serie == "": #Añadir comprobación de len>0 bien hecha

            logger.info('[library.py] savelibrary ERROR: intentando añadir una serie y serie=""')