use of se.light.assembly64.model.PlaylistEntry in project assembly64fx by freabemania.
the class SidifyMainContoller method downloadPlaylistOffline.
private void downloadPlaylistOffline(PlaylistInfo playlist, boolean showPopup) {
for (PlaylistEntry entry : playListService.getSongsForPlaylist(playlist)) {
File sid = new File(pathService.getSidFolderAsString() + resolveFilename(entry.getId(), entry.getCategory(), entry.getName()));
if (!sid.exists()) {
try {
downloadService.downloadTo(sid, entry.getId(), entry.getCategory(), entry.getFileId());
Platform.runLater(() -> {
// update downloaded status
songlist.getColumns().get(0).setVisible(false);
songlist.getColumns().get(0).setVisible(true);
});
} catch (Exception e) {
LOGGER.info("Unable to download " + entry.getName());
}
}
}
if (showPopup) {
GenericMessageDialogController.withInfoProps("Sidify", "Playlist was downloaded", true).showAndWait();
}
playListService.makePlaylistAvailableOffline(playlist, Boolean.TRUE);
Platform.runLater(() -> {
populateLeftList();
});
}
use of se.light.assembly64.model.PlaylistEntry in project assembly64fx by freabemania.
the class SidifyMainContoller method refreshCurrentSongList.
private void refreshCurrentSongList(PlaylistInfo playlist) {
songs.clear();
for (PlaylistEntry entry : playListService.getSongsForPlaylist(playlist)) {
songs.add(entry);
}
songlist.setItems(songs);
if (activePlaylist != null && (playlist.getId().equals(activePlaylist.getId()))) {
// songlist.getSelectionModel().select(getActiveSongInList());
clearAndSelect(getActiveSongInList());
}
}
use of se.light.assembly64.model.PlaylistEntry in project assembly64fx by freabemania.
the class SidifyMainContoller method refreshPlaylistIfNeeded.
private void refreshPlaylistIfNeeded(PlaylistInfo playlistOperatedOn) {
if (playlistOperatedOn != null) {
clearSongList();
for (PlaylistEntry entry : playListService.getSongsForPlaylist(playlistOperatedOn)) {
songs.add(entry);
}
// songlist.getSelectionModel().select(getActiveSongInList());
clearAndSelect(getActiveSongInList());
songlist.getSelectionModel().focus(songlist.getSelectionModel().getSelectedIndex());
}
}
use of se.light.assembly64.model.PlaylistEntry in project assembly64fx by freabemania.
the class SidifyViewPublicPlaylistController method init.
public void init(List<PlaylistEntry> entries) {
Analytics.sendEvent("sidify", "view_playlist");
name.setCellValueFactory(new PropertyValueFactory<PlaylistEntry, String>("name"));
songs.clear();
for (PlaylistEntry item : entries) {
songs.add(item);
}
songlist.setItems(songs);
}
use of se.light.assembly64.model.PlaylistEntry in project assembly64fx by freabemania.
the class Support method flattenAndEnrichEntries.
public static List<ContentEntry> flattenAndEnrichEntries(List<PlaylistEntry> selectedItems, List<List<ContentEntry>> contentEntries) {
if (selectedItems.size() != contentEntries.size()) {
throw new IllegalStateException("?!?!?!?");
}
Iterator<PlaylistEntry> items = selectedItems.iterator();
Iterator<List<ContentEntry>> contentItems = contentEntries.iterator();
while (items.hasNext()) {
PlaylistEntry currEntry = items.next();
List<ContentEntry> currContentsForEntry = contentItems.next();
for (ContentEntry entry : currContentsForEntry) {
entry.setFullPlaylistInfo(currEntry);
}
}
return contentEntries.stream().flatMap(item -> item.stream()).collect(Collectors.toList());
}
Aggregations