Search in sources :

Example 1 with StringKeys

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

the class PlaylistService method deleteSongs.

public void deleteSongs(PlaylistInfo playlist, List<PlaylistEntry> playlistEntry) {
    StringKeys keys = StringKeys.of(playlistEntry.stream().map(item -> String.valueOf(item.getSongId())).collect(Collectors.toList()));
    getClient().target(getBackendServer()).path("/leet/playlistsnew/deletesongs/" + playlist.getId()).request().header("email", getSessionInfo().getEmail()).header("token", getSessionInfo().getToken()).put(Entity.json(keys)).close();
    List<PlaylistEntry> list = getSongsForPlaylist(playlist);
    keys.getKeys().stream().forEach(item -> list.removeIf(entry -> entry.getSongId().equals(item)));
    flushLocalList(playlist, list);
    playlist.setChecksum(getChksum(list));
    flushPlaylistInfo();
    Analytics.sendEvent("sidify", "deletesong");
}
Also used : Support.isOffline(se.light.assembly64.Support.isOffline) ReturningTask(se.light.assembly64.model.ReturningTask) PlaylistEntry(se.light.assembly64.model.PlaylistEntry) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) Support.getBackendServer(se.light.assembly64.Support.getBackendServer) PlaylistInfo(se.light.assembly64.model.PlaylistInfo) ArrayList(java.util.ArrayList) Support.getSessionInfo(se.light.assembly64.Support.getSessionInfo) Support.getChksum(se.light.assembly64.Support.getChksum) ExecutorUtil.executeAsyncWithRetry(se.light.assembly64.util.ExecutorUtil.executeAsyncWithRetry) Map(java.util.Map) Support(se.light.assembly64.Support) PlaylistChecksum(se.light.assembly64.model.PlaylistChecksum) Support.flush(se.light.assembly64.Support.flush) ContentEntry(se.light.assembly64.model.ContentEntry) MD5Method(libsidplay.sidtune.MD5Method) Analytics(se.light.assembly64.Analytics) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) SidTune(libsidplay.sidtune.SidTune) SidFileInfo(se.light.assembly64.model.SidFileInfo) Support.getClient(se.light.assembly64.Support.getClient) Set(java.util.Set) FileUtils(org.apache.commons.io.FileUtils) Collectors(java.util.stream.Collectors) Entity(javax.ws.rs.client.Entity) File(java.io.File) Executors(java.util.concurrent.Executors) GenericType(javax.ws.rs.core.GenericType) Support.readList(se.light.assembly64.Support.readList) List(java.util.List) Response(javax.ws.rs.core.Response) Entry(java.security.KeyStore.Entry) Optional(java.util.Optional) StringKeys(se.light.assembly64.model.StringKeys) PlaylistEntry(se.light.assembly64.model.PlaylistEntry) StringKeys(se.light.assembly64.model.StringKeys)

Aggregations

File (java.io.File)1 Entry (java.security.KeyStore.Entry)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Executors (java.util.concurrent.Executors)1 Collectors (java.util.stream.Collectors)1 Entity (javax.ws.rs.client.Entity)1 GenericType (javax.ws.rs.core.GenericType)1 Response (javax.ws.rs.core.Response)1 MD5Method (libsidplay.sidtune.MD5Method)1 SidTune (libsidplay.sidtune.SidTune)1 FileUtils (org.apache.commons.io.FileUtils)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Analytics (se.light.assembly64.Analytics)1