def __deepcopy__(self, memo=None): cls = Tag() tags = CaselessDict() frames = [] [ frames.append(frame) if not hasattr(frame, 'frames') else frames.extend(frame.frames) for key, frame in self.__tags.items() if not key.startswith('__') ] funcs = [] frames_copy = [] for frame in frames: funcs.append((getattr(frame, 'get_value', None), getattr(frame, 'set_value', None))) if hasattr(frame, 'get_value'): delattr(frame, 'get_value') if hasattr(frame, 'set_value'): delattr(frame, 'set_value') frames_copy.append(deepcopy(frame)) tags = handle( dict([(frame.HashKey, frame) for frame in frames_copy])) for frame, (get_value, set_value) in zip(frames, funcs): if get_value is not None: frame.get_value = get_value if set_value is not None: frame.set_value = set_value for key, value in self.__tags.items(): if key not in tags: tags[key] = deepcopy(value) cls.set_fundamentals(tags, self.mut_obj, deepcopy(self.images)) cls.filepath = self.filepath return cls
def __init__(self, filename=None): self.__images = [] self.__tags = CaselessDict() self.filetype = name self.__tags['__filetype'] = self.filetype self.__tags['__tag_read'] = u'VorbisComment' util.MockTag.__init__(self, filename)
def __init__(self, filename=None): self.__images = [] self.__tags = CaselessDict() #Used as storage. #Each key as the is the field as used by puddletag, eg. 'artist' #Each value contains an mutagen.id3.Frame object #that have two methods, get_value and set_value. #get_value returns the value stored by the frame as #text/unicode list. #set_value should take text/unicode list in parse it into #it understands. #When saving the frame stored will be used. If it has a 'frames' #attributes, those frames will be used instead. util.MockTag.__init__(self, filename)
def __init__(self, filename=None): self.__images = [] self.__tags = CaselessDict() util.MockTag.__init__(self, filename)