Search in sources :

Example 1 with Episode

use of net.robinfriedli.aiode.entities.Episode in project aiode by robinfriedli.

the class HibernatePlaylistMigrator method loadSpotifyItem.

private void loadSpotifyItem(XmlElement item, int index, SpotifyTrackBulkLoadingService spotifyBulkLoadingService, ShardManager shardManager, Playlist newPlaylist, Map<PlaylistItem, Integer> itemsWithIndex, SpotifyTrackKind kind) {
    String id = item.getAttribute("id").getValue();
    spotifyBulkLoadingService.add(createItem(id, kind), spotifyTrack -> {
        String addedUser = item.getAttribute("addedUser").getValue();
        String addedUserId = item.getAttribute("addedUserId").getValue();
        PlaylistItem playlistItem = spotifyTrack.exhaustiveMatch(track -> new Song(track, addedUser, addedUserId, newPlaylist, session), episode -> new Episode(episode, addedUser, addedUserId, newPlaylist));
        playlistItem.setAddedUser(item.getAttribute("addedUser").getValue());
        playlistItem.setAddedUserId(item.getAttribute("addedUserId").getValue());
        itemsWithIndex.put(playlistItem, index);
    });
}
Also used : Episode(net.robinfriedli.aiode.entities.Episode) Song(net.robinfriedli.aiode.entities.Song) PlaylistItem(net.robinfriedli.aiode.entities.PlaylistItem)

Aggregations

Episode (net.robinfriedli.aiode.entities.Episode)1 PlaylistItem (net.robinfriedli.aiode.entities.PlaylistItem)1 Song (net.robinfriedli.aiode.entities.Song)1