Show more informative messages while streaming

When streaming, log messages now show the URL and IP of the originating
request, so that it's easier to determine what client is listening to
something on the server.
master
François-Xavier Thomas 6 years ago
parent 417583ccaa
commit ec96b9711d
  1. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java
  2. 2
      airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java

@ -108,7 +108,7 @@ public class StreamController {
playQueue.addFiles(false, playlistService.getFilesInPlaylist(playlistId)); playQueue.addFiles(false, playlistService.getFilesInPlaylist(playlistId));
player.setPlayQueue(playQueue); player.setPlayQueue(playQueue);
Util.setContentLength(response, playQueue.length()); Util.setContentLength(response, playQueue.length());
LOG.info("Incoming Podcast request for playlist " + playlistId); LOG.info("{}: Incoming Podcast request for playlist {}", request.getRemoteAddr(), playlistId);
} }
response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*");
@ -165,7 +165,7 @@ public class StreamController {
range = getRange(request, file); range = getRange(request, file);
if (settingsService.isEnableSeek() && range != null && !file.isVideo()) { if (settingsService.isEnableSeek() && range != null && !file.isVideo()) {
LOG.info("Got HTTP range: " + range); LOG.info("{}: Got HTTP range: {}", request.getRemoteAddr(), range);
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
Util.setContentLength(response, range.isClosed() ? range.size() : fileLength - range.getFirstBytePos()); Util.setContentLength(response, range.isClosed() ? range.size() : fileLength - range.getFirstBytePos());
long lastBytePos = range.getLastBytePos() != null ? range.getLastBytePos() : fileLength - 1; long lastBytePos = range.getLastBytePos() != null ? range.getLastBytePos() : fileLength - 1;

@ -117,7 +117,7 @@ public class PlayQueueInputStream extends InputStream {
close(); close();
} else if (!file.equals(currentFile)) { } else if (!file.equals(currentFile)) {
close(); close();
LOG.info(player.getUsername() + " listening to \"" + FileUtil.getShortPath(file.getFile()) + "\""); LOG.info("{}: {} listening to {}", player.getIpAddress(), player.getUsername(), FileUtil.getShortPath(file.getFile()));
mediaFileService.incrementPlayCount(file); mediaFileService.incrementPlayCount(file);
// Don't scrobble REST players (except Sonos) // Don't scrobble REST players (except Sonos)

Loading…
Cancel
Save