'Event hook called when an import task finishes.'

def imported(self, session, task):

    if task.is_album:
        album = task.album
        (album.genre, src) = self._get_genre(album)
        self._log.debug(u'added    last.fm    album    genre    ({0}):    {1}', src, album.genre)
        album.store()
        if ('track' in self.sources):
            for item in album.items():
                (item.genre, src) = self._get_genre(item)
                self._log.debug(u'added    last.fm    item    genre    ({0}):    {1}', src, item.genre)
                item.store()
    else:
        item = task.item
        (item.genre, src) = self._get_genre(item)
        self._log.debug(u'added    last.fm    item    genre    ({0}):    {1}', src, item.genre)
        item.store()
