예제 #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()
예제 #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()
예제 #3
0
 def set_filepath(self, val):
     self.__tags.update(MockTag.set_filepath(self, val))
예제 #4
0
 def get_filepath(self):
     return MockTag.get_filepath(self)
예제 #5
0
 def set_filepath(self,  val):
     self.__tags.update(MockTag.set_filepath(self, val))
예제 #6
0
 def get_filepath(self):
     return MockTag.get_filepath(self)