forked from j62/ctbrec
Fix Cam4 stackvaults streams
This commit is contained in:
parent
4e5287c177
commit
dd67df7445
common/src/main/java/ctbrec/sites/cam4
|
@ -1,40 +1,13 @@
|
|||
package ctbrec.sites.cam4;
|
||||
|
||||
import static ctbrec.Model.State.*;
|
||||
import static ctbrec.io.HttpClient.*;
|
||||
import static ctbrec.io.HttpConstants.*;
|
||||
import static java.util.regex.Pattern.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.iheartradio.m3u8.Encoding;
|
||||
import com.iheartradio.m3u8.Format;
|
||||
import com.iheartradio.m3u8.ParseException;
|
||||
import com.iheartradio.m3u8.ParsingMode;
|
||||
import com.iheartradio.m3u8.PlaylistException;
|
||||
import com.iheartradio.m3u8.PlaylistParser;
|
||||
import com.iheartradio.m3u8.*;
|
||||
import com.iheartradio.m3u8.data.MasterPlaylist;
|
||||
import com.iheartradio.m3u8.data.Playlist;
|
||||
import com.iheartradio.m3u8.data.PlaylistData;
|
||||
import com.iheartradio.m3u8.data.StreamInfo;
|
||||
|
||||
import ctbrec.AbstractModel;
|
||||
import ctbrec.Config;
|
||||
import ctbrec.NotImplementedExcetion;
|
||||
import ctbrec.StringUtil;
|
||||
import ctbrec.io.HttpException;
|
||||
import ctbrec.recorder.download.HttpHeaderFactory;
|
||||
|
@ -42,6 +15,22 @@ import ctbrec.recorder.download.HttpHeaderFactoryImpl;
|
|||
import ctbrec.recorder.download.StreamSource;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static ctbrec.Model.State.*;
|
||||
import static ctbrec.io.HttpClient.bodyToJsonObject;
|
||||
import static ctbrec.io.HttpConstants.*;
|
||||
import static java.util.regex.Pattern.DOTALL;
|
||||
import static java.util.regex.Pattern.MULTILINE;
|
||||
|
||||
public class Cam4Model extends AbstractModel {
|
||||
|
||||
|
@ -74,32 +63,17 @@ public class Cam4Model extends AbstractModel {
|
|||
|
||||
public void setOnlineStateByShowType(String showType) {
|
||||
switch (showType) {
|
||||
case "NORMAL":
|
||||
case "ACCEPTING":
|
||||
case "GROUP_SHOW_SELLING_TICKETS":
|
||||
case "GS_SELLING_TICKETS":
|
||||
case "GS_SELLING_TICKETS_UNSUCCESSFUL":
|
||||
case "GS_GOAL_REACHED":
|
||||
case "NORMAL", "ACCEPTING", "GROUP_SHOW_SELLING_TICKETS", "GS_SELLING_TICKETS", "GS_SELLING_TICKETS_UNSUCCESSFUL", "GS_GOAL_REACHED" ->
|
||||
onlineState = ONLINE;
|
||||
break;
|
||||
case "PRIVATE_SHOW":
|
||||
case "INSIDE_PS":
|
||||
onlineState = PRIVATE;
|
||||
break;
|
||||
case "INSIDE_GS":
|
||||
case "GROUP_SHOW":
|
||||
onlineState = GROUP;
|
||||
break;
|
||||
case "PAUSED":
|
||||
onlineState = AWAY;
|
||||
break;
|
||||
case "OFFLINE":
|
||||
onlineState = OFFLINE;
|
||||
break;
|
||||
default:
|
||||
case "PRIVATE_SHOW", "INSIDE_PS" -> onlineState = PRIVATE;
|
||||
case "INSIDE_GS", "GROUP_SHOW" -> onlineState = GROUP;
|
||||
case "PAUSED" -> onlineState = AWAY;
|
||||
case "OFFLINE" -> onlineState = OFFLINE;
|
||||
default -> {
|
||||
LOG.debug("############################## Unknown show type [{} {}]", this, showType);
|
||||
onlineState = UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -131,7 +105,7 @@ public class Cam4Model extends AbstractModel {
|
|||
}
|
||||
|
||||
private void getPlaylistUrlFromStreamUrl() throws IOException {
|
||||
String url = getSite().getBaseUrl() + "/_profile/streamURL?username=" + getName();
|
||||
String url = getSite().getBaseUrl() + "/rest/v1.0/profile/" + getName() + "/streamInfo";
|
||||
LOG.trace("Getting playlist url from {}", url);
|
||||
Request req = new Request.Builder() // @formatter:off
|
||||
.url(url)
|
||||
|
@ -228,7 +202,7 @@ public class Cam4Model extends AbstractModel {
|
|||
|
||||
@Override
|
||||
public void receiveTip(Double tokens) throws IOException {
|
||||
throw new RuntimeException("Not implemented for Cam4, yet");
|
||||
throw new NotImplementedExcetion("Tipping is not implemented for Cam4, yet");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -253,10 +227,8 @@ public class Cam4Model extends AbstractModel {
|
|||
LOG.warn("Couldn't determine stream resolution for {} - {}", getName(), e.getMessage());
|
||||
resolution = new int[2];
|
||||
}
|
||||
return resolution;
|
||||
} else {
|
||||
return resolution;
|
||||
}
|
||||
return resolution;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue