forked from j62/ctbrec
Add a column, which shows, if a model uses webrtc
This commit is contained in:
parent
424d046b67
commit
e14296bc1b
|
@ -5,6 +5,7 @@ import static java.nio.file.StandardOpenOption.*;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
@ -17,19 +18,25 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.iheartradio.m3u8.ParseException;
|
||||
import com.iheartradio.m3u8.PlaylistException;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Model;
|
||||
import ctbrec.StringUtil;
|
||||
import ctbrec.recorder.download.StreamSource;
|
||||
import ctbrec.sites.mfc.MyFreeCams;
|
||||
import ctbrec.sites.mfc.MyFreeCamsClient;
|
||||
import ctbrec.sites.mfc.MyFreeCamsModel;
|
||||
import ctbrec.sites.mfc.SessionState;
|
||||
import ctbrec.sites.mfc.User;
|
||||
|
@ -223,6 +230,10 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
|
|||
hd.setCellValueFactory(cdf -> cdf.getValue().hdProperty());
|
||||
addTableColumnIfEnabled(hd);
|
||||
|
||||
TableColumn<ModelTableRow, Boolean> webrtc = createTableColumn("webrtc", 130, idx++);
|
||||
webrtc.setCellValueFactory(cdf -> cdf.getValue().webrtcProperty());
|
||||
addTableColumnIfEnabled(webrtc);
|
||||
|
||||
TableColumn<ModelTableRow, Number> flags = createTableColumn("Flags", 75, idx++);
|
||||
flags.setCellValueFactory(cdf -> cdf.getValue().flagsProperty());
|
||||
addTableColumnIfEnabled(flags);
|
||||
|
@ -321,9 +332,21 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
|
|||
openInBrowser.setDisable(true);
|
||||
}
|
||||
|
||||
if(Objects.equals(System.getenv("CTBREC_DEV"), "1")) {
|
||||
if (Objects.equals(System.getenv("CTBREC_DEV"), "1")) {
|
||||
MenuItem debug = new MenuItem("debug");
|
||||
debug.setOnAction(e -> MyFreeCamsClient.getInstance().getSessionState(selectedModels.get(0)));
|
||||
debug.setOnAction(e -> new Thread(() -> {
|
||||
for (Model m : selectedModels) {
|
||||
try {
|
||||
List<StreamSource> sources = m.getStreamSources();
|
||||
for (StreamSource src : sources) {
|
||||
LOG.info("{} {} {}", m.getUrl(), src.bandwidth, src.height);
|
||||
}
|
||||
LOG.info("===============");
|
||||
} catch (IOException | ExecutionException | ParseException | PlaylistException | JAXBException e1) {
|
||||
LOG.error("Couldn't get stream sources", e1);
|
||||
}
|
||||
}
|
||||
}).start());
|
||||
menu.getItems().add(debug);
|
||||
}
|
||||
|
||||
|
@ -604,6 +627,7 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
|
|||
private StringProperty blurp = new SimpleStringProperty();
|
||||
private StringProperty topic = new SimpleStringProperty();
|
||||
private BooleanProperty isHd = new SimpleBooleanProperty();
|
||||
private BooleanProperty isWebrtc = new SimpleBooleanProperty();
|
||||
private SimpleIntegerProperty uidProperty = new SimpleIntegerProperty();
|
||||
private SimpleIntegerProperty flagsProperty = new SimpleIntegerProperty();
|
||||
|
||||
|
@ -630,6 +654,7 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
|
|||
setProperty(occupation, Optional.ofNullable(st.getU()).map(User::getOccupation));
|
||||
int flags = Optional.ofNullable(st.getM()).map(ctbrec.sites.mfc.Model::getFlags).orElse(0);
|
||||
//isHd.set((flags & 1024) == 1024);
|
||||
isWebrtc.set((flags & 524288) == 524288);
|
||||
isHd.set(Optional.ofNullable(st.getU()).map(User::getPhase).orElse("z").equalsIgnoreCase("a"));
|
||||
flagsProperty.setValue(flags);
|
||||
Set<String> tagSet = Optional.ofNullable(st.getM()).map(ctbrec.sites.mfc.Model::getTags).orElse(Collections.emptySet());
|
||||
|
@ -704,6 +729,10 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
|
|||
return isHd;
|
||||
}
|
||||
|
||||
public BooleanProperty webrtcProperty() {
|
||||
return isWebrtc;
|
||||
}
|
||||
|
||||
public IntegerProperty flagsProperty() {
|
||||
return flagsProperty;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue