Exemplo n.º 1
0
    def __init__(self, libclass, libtags):
        MockTag.__init__(self)

        self.__tags = CaselessDict()
        tags = self.__tags

        tags.update(self.load(libtags['~filename'])[0])
        tags['__tag_read'] = u'QuodLibet'

        self.library = libclass
        self.remove = partial(libclass.delete, track=libtags)
        self._libtags = libtags

        for key, value in libtags.items():
            if not value and not isinstance(value, (int, long)):
                continue
            if key in mapping:
                tags.update(mapping[key](value))
            else:
                if not isinstance(value, unicode):  #Strings
                    try:
                        value = unicode(value, 'utf8', 'replace')
                    except (TypeError, ValueError):
                        try:
                            value = unicode(value)  #Usually numbers
                        except:
                            traceback.print_exc()
                            continue
                tags[key] = [value]
        del (tags['~filename'])

        self.filepath = libtags['~filename']
        self.set_attrs(ATTRIBUTES, self.__tags)
        self.update_tag_list()
Exemplo n.º 2
0
    def __init__(self, libclass, libtags):
        MockTag.__init__(self)

        self.__tags = CaselessDict()
        tags = self.__tags

        tags.update(self.load(libtags['~filename'])[0])
        tags['__tag_read'] = u'QuodLibet'

        self.library = libclass
        self.remove = partial(libclass.delete, track=libtags)
        self._libtags = libtags

        for key, value in libtags.items():
            if not value and not isinstance(value, (int, long)):
                continue
            if key in mapping:
                tags.update(mapping[key](value))
            else:
                if not isinstance(value, unicode): #Strings
                    try: value = unicode(value, 'utf8', 'replace')
                    except (TypeError, ValueError):
                        try: value = unicode(value) #Usually numbers
                        except:
                            traceback.print_exc()
                            continue
                tags[key] = [value]
        del(tags['~filename'])

        self.filepath = libtags['~filename']
        self.set_attrs(ATTRIBUTES, self.__tags)
        self.update_tag_list()
Exemplo n.º 3
0
 def set_filepath(self, val):
     self.__tags.update(MockTag.set_filepath(self, val))
Exemplo n.º 4
0
 def get_filepath(self):
     return MockTag.get_filepath(self)
Exemplo n.º 5
0
 def set_filepath(self,  val):
     self.__tags.update(MockTag.set_filepath(self, val))
Exemplo n.º 6
0
 def get_filepath(self):
     return MockTag.get_filepath(self)