Fix problem with Cam4 edge URLs

The edge URLs are already abosulte, so the base URL does not have to be
prepended
This commit is contained in:
0xb00bface 2021-01-12 20:42:08 +01:00
parent df37f4a61c
commit 3d4bd6f331
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,7 @@
3.12.2
========================
* Fix: Some Cam4 URLs where broken
3.12.1
========================
* Fix: "Resume all" started the recordings of models marked for later recording

View File

@ -191,9 +191,13 @@ public class Cam4Model extends AbstractModel {
StreamSource src = new StreamSource();
src.bandwidth = playlist.getStreamInfo().getBandwidth();
src.height = Optional.ofNullable(playlist.getStreamInfo()).map(StreamInfo::getResolution).map(res -> res.height).orElse(0);
String masterUrl = getPlaylistUrl();
String baseUrl = masterUrl.substring(0, masterUrl.lastIndexOf('/') + 1);
src.mediaPlaylistUrl = baseUrl + playlist.getUri();
if (playlist.getUri().startsWith("http")) {
src.mediaPlaylistUrl = playlist.getUri();
} else {
String masterUrl = getPlaylistUrl();
String baseUrl = masterUrl.substring(0, masterUrl.lastIndexOf('/') + 1);
src.mediaPlaylistUrl = baseUrl + playlist.getUri();
}
LOG.trace("Media playlist {}", src.mediaPlaylistUrl);
sources.add(src);
}