Remove redundant code
This commit is contained in:
parent
113417c166
commit
ae6f36ffda
|
@ -75,46 +75,6 @@ public class Player {
|
||||||
return play(model, true);
|
return play(model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Precompile VR suffix regex
|
|
||||||
// private static final Pattern VR_SUFFIX = Pattern.compile("(_vr)$");
|
|
||||||
|
|
||||||
// Map of host replacements for non-VR streams
|
|
||||||
/* private static final Map<String, String> HOST_REPLACEMENTS = Map.of(
|
|
||||||
"media-hls.doppiocdn.com", "media-hls.saawsedge.com"
|
|
||||||
); */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rewrites non-VR doppiocdn.com URLs:
|
|
||||||
* - swaps host
|
|
||||||
* - strips _vr from directory if present
|
|
||||||
* - forces _480p resolution
|
|
||||||
*/
|
|
||||||
/* private static String rewriteNonVrStripchatUrl(String url) {
|
|
||||||
try {
|
|
||||||
URI u = URI.create(url);
|
|
||||||
String host = u.getHost();
|
|
||||||
|
|
||||||
if (host != null && host.contains("doppiocdn.com")) {
|
|
||||||
String newHost = HOST_REPLACEMENTS.getOrDefault(host, host);
|
|
||||||
|
|
||||||
// Split the path: /b-hls-02/89673378/89673378_720p60.m3u8
|
|
||||||
String[] parts = u.getPath().split("/");
|
|
||||||
if (parts.length >= 4) {
|
|
||||||
String dir1 = parts[1]; // e.g., b-hls-02
|
|
||||||
String dir2 = VR_SUFFIX.matcher(parts[2]).replaceAll(""); // strip _vr if present
|
|
||||||
String newFile = dir2 + "_480p.m3u8"; // force 480p
|
|
||||||
|
|
||||||
String rewritten = String.format("https://%s/%s/%s/%s", newHost, dir1, dir2, newFile);
|
|
||||||
log.trace("Rewrote non-VR Stripchat URL: {} -> {}", url, rewritten);
|
|
||||||
return rewritten;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
log.warn("Failed to rewrite Stripchat URL {}: {}", url, ex.toString());
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
} */
|
|
||||||
|
|
||||||
public static boolean play(Model model, boolean async) {
|
public static boolean play(Model model, boolean async) {
|
||||||
try {
|
try {
|
||||||
if (model.isOnline(true)) {
|
if (model.isOnline(true)) {
|
||||||
|
@ -239,14 +199,9 @@ public class Player {
|
||||||
|
|
||||||
String mediaUrlForPlayer = upstreamUrl;
|
String mediaUrlForPlayer = upstreamUrl;
|
||||||
if (looksLikeStripchatM3u8(upstreamUrl)) {
|
if (looksLikeStripchatM3u8(upstreamUrl)) {
|
||||||
// if (isVrStripchatStream(upstreamUrl)) {
|
|
||||||
// VR stream -> use proxy
|
|
||||||
proxy = new LocalHlsProxy(model, upstreamUrl);
|
proxy = new LocalHlsProxy(model, upstreamUrl);
|
||||||
proxy.start();
|
proxy.start();
|
||||||
mediaUrlForPlayer = proxy.localUrl();
|
mediaUrlForPlayer = proxy.localUrl();
|
||||||
// } else if (upstreamUrl.contains("doppiocdn.com")) {
|
|
||||||
// Non-VR -> rewrite host + resolution
|
|
||||||
// mediaUrlForPlayer = rewriteNonVrStripchatUrl(upstreamUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] cmdline = createCmdline(mediaUrlForPlayer, model);
|
Object[] cmdline = createCmdline(mediaUrlForPlayer, model);
|
||||||
|
@ -314,24 +269,6 @@ public class Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the URL is a VR doppiocdn.com stream (.m3u8 + _vr)
|
|
||||||
*/
|
|
||||||
private boolean isVrStripchatStream(String url) {
|
|
||||||
try {
|
|
||||||
URI u = URI.create(url);
|
|
||||||
String host = u.getHost();
|
|
||||||
String path = u.getPath().toLowerCase(Locale.ROOT);
|
|
||||||
|
|
||||||
return host != null
|
|
||||||
&& host.contains("doppiocdn.com")
|
|
||||||
&& path.endsWith(".m3u8")
|
|
||||||
&& path.contains("_vr");
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean looksLikeStripchatM3u8(String url) {
|
private boolean looksLikeStripchatM3u8(String url) {
|
||||||
try {
|
try {
|
||||||
URL u = new URL(url);
|
URL u = new URL(url);
|
||||||
|
|
Loading…
Reference in New Issue