'Records the replaced items and albums in the `replaced_items`
and `replaced_albums` dictionaries.'

def record_replaced(self, lib):

    self.replaced_items = defaultdict(list)
    self.replaced_albums = defaultdict(list)
    replaced_album_ids = set()
    for item in self.imported_items():
        dup_items = list(lib.items(dbcore.query.BytesQuery('path', item.path)))
        self.replaced_items[item] = dup_items
        for dup_item in dup_items:
            if ((not dup_item.album_id) or (dup_item.album_id in replaced_album_ids)):
                continue
            replaced_album = dup_item.get_album()
            if replaced_album:
                replaced_album_ids.add(dup_item.album_id)
                self.replaced_albums[replaced_album.path] = replaced_album
