use of org.libresonic.player.domain.PlayStatus in project libresonic by Libresonic.
the class StatusService method getPlayStatuses.
public synchronized List<PlayStatus> getPlayStatuses() {
Map<String, PlayStatus> result = new LinkedHashMap<String, PlayStatus>();
for (PlayStatus remotePlay : remotePlays) {
if (!remotePlay.isExpired()) {
result.put(remotePlay.getPlayer().getId(), remotePlay);
}
}
List<TransferStatus> statuses = new ArrayList<TransferStatus>();
statuses.addAll(inactiveStreamStatuses.values());
statuses.addAll(streamStatuses);
for (TransferStatus streamStatus : statuses) {
Player player = streamStatus.getPlayer();
File file = streamStatus.getFile();
if (file == null) {
continue;
}
MediaFile mediaFile = mediaFileService.getMediaFile(file);
if (player == null || mediaFile == null) {
continue;
}
Date time = new Date(System.currentTimeMillis() - streamStatus.getMillisSinceLastUpdate());
result.put(player.getId(), new PlayStatus(mediaFile, player, time));
}
return new ArrayList<PlayStatus>(result.values());
}
use of org.libresonic.player.domain.PlayStatus in project libresonic by Libresonic.
the class StatusService method addRemotePlay.
public synchronized void addRemotePlay(PlayStatus playStatus) {
Iterator<PlayStatus> iterator = remotePlays.iterator();
while (iterator.hasNext()) {
PlayStatus rp = iterator.next();
if (rp.isExpired()) {
iterator.remove();
}
}
remotePlays.add(playStatus);
}
Aggregations