# 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/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/platformtools.py
# def dialog_ok(heading, line1, line2="", line3=""):
# def dialog_notification(heading, message, icon=0, time=5000, sound=True):
# def dialog_yesno(heading, line1, line2="", line3="", nolabel="No", yeslabel="Si", autoclose=""):
# def dialog_select(heading, _list):
# def dialog_progress(heading, line1, line2="", line3=""):
# def dialog_progress_bg(heading, message=""):
# def dialog_input(default="", heading="", hidden=False):
# def dialog_numeric(_type, heading, default=""):
# def itemlist_refresh():
# def itemlist_update(item):
# def render_items(itemlist, parentitem):
# def is_playing():
# def play_video(item):
# def show_channel_settings(list_controls=None, dict_values=None, caption="", callback=None, item=None,
#                           custom_button=None):
# def show_video_info(data, caption="", callback=None, item=None):


import os
import sys
import traceback
        import re
    import time
        import shutil
from core import logger
from core import scrapertools
from platformcode import platformtools
  from lib.sambatools import libsmb as samba
        #local/local
        elif not path.lower().startswith("smb://") and not dest.lower().startswith("smb://"):
            dest = encode(dest)
            path = encode(path)
            os.rename(path, dest)
        #mixto En este caso se copia el archivo y luego se elimina el de origen
        else:
          return copy(path, dest) == True and remove(path) == True
    except:
        logger.error("ERROR al mover el archivo: %s" %(path))
        logger.error(traceback.format_exc())
        return False
    else:
      return True


def copy(path, dest, silent = False):
    """
    Copia un archivo
    @param path: ruta del fichero a copiar
    @type path: str
    @param dest: ruta donde copiar
    @type dest: str
    @rtype: bool
    @return: devuelve False en caso de error
    """
    try:
      fo = file_open(path, "rb")
      fd = file_open(dest, "wb")
      if fo and fd:

# 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/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/platformtools.py
# def dialog_ok(heading, line1, line2="", line3=""):
# def dialog_notification(heading, message, icon=0, time=5000, sound=True):
# def dialog_yesno(heading, line1, line2="", line3="", nolabel="No", yeslabel="Si", autoclose=""):
# def dialog_select(heading, _list):
# def dialog_progress(heading, line1, line2="", line3=""):
# def dialog_progress_bg(heading, message=""):
# def dialog_input(default="", heading="", hidden=False):
# def dialog_numeric(_type, heading, default=""):
# def itemlist_refresh():
# def itemlist_update(item):
# def render_items(itemlist, parentitem):
# def is_playing():
# def play_video(item):
# def show_channel_settings(list_controls=None, dict_values=None, caption="", callback=None, item=None,
#                           custom_button=None):
# def show_video_info(data, caption="", callback=None, item=None):


# Path: core/filetools.py
import os
import sys
import traceback
        import re
    import time
        import shutil
from core import logger
from core import scrapertools
from platformcode import platformtools
  from lib.sambatools import libsmb as samba

        #local/local
        elif not path.lower().startswith("smb://") and not dest.lower().startswith("smb://"):
            dest = encode(dest)
            path = encode(path)
            os.rename(path, dest)
        #mixto En este caso se copia el archivo y luego se elimina el de origen
        else:
          return copy(path, dest) == True and remove(path) == True
    except:
        logger.error("ERROR al mover el archivo: %s" %(path))
        logger.error(traceback.format_exc())
        return False
    else:
      return True


def copy(path, dest, silent = False):
    """
    Copia un archivo
    @param path: ruta del fichero a copiar
    @type path: str
    @param dest: ruta donde copiar
    @type dest: str
    @rtype: bool
    @return: devuelve False en caso de error
    """
    try:
      fo = file_open(path, "rb")
      fd = file_open(dest, "wb")
      if fo and fd:

        if not silent: dialogo = platformtools.dialog_progress("Copiando archivo", "")