# Path: core/jsontools.py
# def loads(*args, **kwargs):
# def dumps(*args, **kwargs):
# def to_utf8(dct):
# def load_json(data):
#     def to_utf8(dct):
# def dump_json(data):


import base64
import copy
import os
import urllib
                import time
from HTMLParser import HTMLParser
from core import jsontools as json
            str_item = base64.b64decode(urllib.unquote(url))
            json_item = json.load_json(str_item, object_hook=self.toutf8)
            if json_item is not None and len(json_item) > 0:
                self.__dict__.update(json_item)
                decoded = True
        except:
            pass

        if not decoded:
            url = urllib.unquote_plus(url)
            dct = dict([[param.split("=")[0], param.split("=")[1]] for param in url.split("&") if "=" in param])
            self.__dict__.update(dct)
            self.__dict__ = self.toutf8(self.__dict__)

        if 'infoLabels' in self.__dict__ and not isinstance(self.__dict__['infoLabels'], InfoLabels):
            self.__dict__['infoLabels'] = InfoLabels(self.__dict__['infoLabels'])

        return self

    def tojson(self, path=""):
        """
        Crea un JSON a partir del item, para guardar archivos de favoritos, lista de descargas, etc...
        Si se especifica un path, te lo guarda en la ruta especificada, si no, devuelve la cadena json
        Usos: item.tojson(path="ruta\archivo\json.json")
              file.write(item.tojson())

        @param path: ruta
        @type path: str
        """
        if path:

# Path: core/jsontools.py
# def loads(*args, **kwargs):
# def dumps(*args, **kwargs):
# def to_utf8(dct):
# def load_json(data):
#     def to_utf8(dct):
# def dump_json(data):


# Path: core/item.py
import base64
import copy
import os
import urllib
                import time
from HTMLParser import HTMLParser
from core import jsontools as json

            str_item = base64.b64decode(urllib.unquote(url))
            json_item = json.load_json(str_item, object_hook=self.toutf8)
            if json_item is not None and len(json_item) > 0:
                self.__dict__.update(json_item)
                decoded = True
        except:
            pass

        if not decoded:
            url = urllib.unquote_plus(url)
            dct = dict([[param.split("=")[0], param.split("=")[1]] for param in url.split("&") if "=" in param])
            self.__dict__.update(dct)
            self.__dict__ = self.toutf8(self.__dict__)

        if 'infoLabels' in self.__dict__ and not isinstance(self.__dict__['infoLabels'], InfoLabels):
            self.__dict__['infoLabels'] = InfoLabels(self.__dict__['infoLabels'])

        return self

    def tojson(self, path=""):
        """
        Crea un JSON a partir del item, para guardar archivos de favoritos, lista de descargas, etc...
        Si se especifica un path, te lo guarda en la ruta especificada, si no, devuelve la cadena json
        Usos: item.tojson(path="ruta\archivo\json.json")
              file.write(item.tojson())

        @param path: ruta
        @type path: str
        """
        if path:

            open(path, "wb").write(json.dump_json(self.__dict__))