Search in sources :

Example 1 with PlaylistChecksum

use of se.light.assembly64.model.PlaylistChecksum in project assembly64fx by freabemania.

the class PlaylistService method mergePlaylists.

private void mergePlaylists() {
    PlaylistChecksum serverChecksums = getChecksumsFromServer();
    // get local list
    List<PlaylistInfo> localPlayListInfo = getLocalPlaylistInfo();
    long localPlaylistChksum = Support.getChksumPInfo(localPlayListInfo, false);
    // get local public list
    List<PlaylistInfo> localPublicPlayListInfo = getLocalPublicPlaylistInfo();
    long localPublicPlaylistChksum = Support.getChksumPInfo(localPublicPlayListInfo, true);
    if (!serverChecksums.getPrivateList().equals(localPlaylistChksum)) {
        List<PlaylistInfo> playlistInfo = getPlaylistInfo();
        playlists = playlistInfo;
        flushPlaylistInfo(false, playlistInfo);
        LOGGER.info("Refreshed and flushed private playlist");
    } else {
        playlists = localPlayListInfo;
        LOGGER.info("Resolved local playlist with ok checksum");
    }
    if (!serverChecksums.getPublicList().equals(localPublicPlaylistChksum)) {
        List<PlaylistInfo> remotePublicPlayListInfo = getPublicPlaylists();
        flushPublicPlaylistInfo(remotePublicPlayListInfo);
        LOGGER.info("Refreshed and flushed public playlist");
    } else {
        publicPlaylists = localPublicPlayListInfo;
        LOGGER.info("Resolved public playlist with ok checksum");
    }
}
Also used : PlaylistChecksum(se.light.assembly64.model.PlaylistChecksum) PlaylistInfo(se.light.assembly64.model.PlaylistInfo)

Aggregations

PlaylistChecksum (se.light.assembly64.model.PlaylistChecksum)1 PlaylistInfo (se.light.assembly64.model.PlaylistInfo)1