Tweak logging for internet radio playlists
This commit is contained in:
@@ -28,9 +28,15 @@ public class InternetRadioService {
|
|||||||
public List<InternetRadioSource> getInternetRadioSources(InternetRadio radio) throws Exception {
|
public List<InternetRadioSource> getInternetRadioSources(InternetRadio radio) throws Exception {
|
||||||
List<InternetRadioSource> sources;
|
List<InternetRadioSource> sources;
|
||||||
if (cachedSources.containsKey(radio.getId())) {
|
if (cachedSources.containsKey(radio.getId())) {
|
||||||
|
LOG.debug("Got cached sources for internet radio {}!", radio.getStreamUrl());
|
||||||
sources = cachedSources.get(radio.getId());
|
sources = cachedSources.get(radio.getId());
|
||||||
} else {
|
} else {
|
||||||
|
LOG.debug("Retrieving sources for internet radio {}...", radio.getStreamUrl());
|
||||||
sources = retrieveInternetRadioSources(radio);
|
sources = retrieveInternetRadioSources(radio);
|
||||||
|
if (sources.isEmpty()) {
|
||||||
|
LOG.warn("No entries found when parsing external playlist.");
|
||||||
|
}
|
||||||
|
LOG.info("Retrieved playlist for internet radio {}, got {} sources.", radio.getStreamUrl(), sources.size());
|
||||||
cachedSources.put(radio.getId(), sources);
|
cachedSources.put(radio.getId(), sources);
|
||||||
}
|
}
|
||||||
return sources;
|
return sources;
|
||||||
@@ -41,10 +47,10 @@ public class InternetRadioService {
|
|||||||
URL playlistUrl = new URL(radio.getStreamUrl());
|
URL playlistUrl = new URL(radio.getStreamUrl());
|
||||||
SpecificPlaylist inputPlaylist = null;
|
SpecificPlaylist inputPlaylist = null;
|
||||||
try {
|
try {
|
||||||
LOG.info("Parsing playlist at {}...", playlistUrl.toString());
|
LOG.debug("Parsing internet radio playlist at {}...", playlistUrl.toString());
|
||||||
inputPlaylist = SpecificPlaylistFactory.getInstance().readFrom(playlistUrl);
|
inputPlaylist = SpecificPlaylistFactory.getInstance().readFrom(playlistUrl);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Unable to parse playlist: {}", playlistUrl.toString(), e);
|
LOG.error("Unable to parse internet radio playlist: {}", playlistUrl.toString(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
if (inputPlaylist == null) {
|
if (inputPlaylist == null) {
|
||||||
@@ -88,7 +94,7 @@ public class InternetRadioService {
|
|||||||
@Override
|
@Override
|
||||||
public void beginVisitMedia(Media media) throws Exception {
|
public void beginVisitMedia(Media media) throws Exception {
|
||||||
String streamUrl = media.getSource().getURI().toString();
|
String streamUrl = media.getSource().getURI().toString();
|
||||||
LOG.info("Got source media at {}...", streamUrl);
|
LOG.debug("Got source media at {}", streamUrl);
|
||||||
entries.add(new InternetRadioSource(
|
entries.add(new InternetRadioSource(
|
||||||
streamUrl
|
streamUrl
|
||||||
));
|
));
|
||||||
@@ -100,10 +106,6 @@ public class InternetRadioService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (entries.isEmpty()) {
|
|
||||||
LOG.warn("No entries found when parsing external playlist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user