'For reimports, preserves metadata for reimported items and
albums.'

def reimport_metadata(self, lib):

    if self.is_album:
        replaced_album = self.replaced_albums.get(self.album.path)
        if replaced_album:
            self.album.added = replaced_album.added
            self.album.update(replaced_album._values_flex)
            self.album.artpath = replaced_album.artpath
            self.album.store()
            log.debug(u'Reimported    album:    added    {0},    flexible    attributes    {1}    from    album    {2}    for    {3}', self.album.added, replaced_album._values_flex.keys(), replaced_album.id, displayable_path(self.album.path))
    for item in self.imported_items():
        dup_items = self.replaced_items[item]
        for dup_item in dup_items:
            if (dup_item.added and (dup_item.added != item.added)):
                item.added = dup_item.added
                log.debug(u'Reimported    item    added    {0}    from    item    {1}    for    {2}', item.added, dup_item.id, displayable_path(item.path))
            item.update(dup_item._values_flex)
            log.debug(u'Reimported    item    flexible    attributes    {0}    from    item    {1}    for    {2}', dup_item._values_flex.keys(), dup_item.id, displayable_path(item.path))
            item.store()
