Fix display of resolution tag for amateur.tv
This commit is contained in:
parent
fc7bb1362c
commit
d44fc58bf2
|
@ -727,7 +727,7 @@ public class ThumbCell extends StackPane {
|
||||||
try {
|
try {
|
||||||
return model.getStreamResolution(false);
|
return model.getStreamResolution(false);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
LOG.warn("Error loading stream resolution for model {}", model, e);
|
LOG.debug("Error loading stream resolution for model {}: {}", model, e.getLocalizedMessage());
|
||||||
return new int[2];
|
return new int[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,15 @@ public interface Model extends Comparable<Model>, Serializable {
|
||||||
|
|
||||||
public boolean isOnline() throws IOException, ExecutionException, InterruptedException;
|
public boolean isOnline() throws IOException, ExecutionException, InterruptedException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param failFast
|
||||||
|
* If set to true, the method returns immediately and might return false even if the model actually is online
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
* @throws ExecutionException
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException;
|
public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException;
|
||||||
|
|
||||||
public State getOnlineState(boolean failFast) throws IOException, ExecutionException;
|
public State getOnlineState(boolean failFast) throws IOException, ExecutionException;
|
||||||
|
@ -98,7 +107,7 @@ public interface Model extends Comparable<Model>, Serializable {
|
||||||
* Determines the stream resolution for this model
|
* Determines the stream resolution for this model
|
||||||
*
|
*
|
||||||
* @param failFast
|
* @param failFast
|
||||||
* If set to true, the method returns emmediately, even if the resolution is unknown. If
|
* If set to true, the method returns immediately, even if the resolution is unknown. If
|
||||||
* the resolution is unknown, the array contains 0,0
|
* the resolution is unknown, the array contains 0,0
|
||||||
*
|
*
|
||||||
* @return a tupel of width and height represented by an int[2]
|
* @return a tupel of width and height represented by an int[2]
|
||||||
|
|
|
@ -6,17 +6,12 @@ import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import ctbrec.Model;
|
import ctbrec.Model;
|
||||||
import ctbrec.io.HttpClient;
|
import ctbrec.io.HttpClient;
|
||||||
import ctbrec.sites.AbstractSite;
|
import ctbrec.sites.AbstractSite;
|
||||||
|
|
||||||
public class AmateurTv extends AbstractSite {
|
public class AmateurTv extends AbstractSite {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmateurTv.class);
|
|
||||||
|
|
||||||
public static String baseUrl = "https://www.amateur.tv";
|
public static String baseUrl = "https://www.amateur.tv";
|
||||||
|
|
||||||
private AmateurTvHttpClient httpClient;
|
private AmateurTvHttpClient httpClient;
|
||||||
|
@ -79,22 +74,22 @@ public class AmateurTv extends AbstractSite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsTips() {
|
public boolean supportsTips() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsFollow() {
|
public boolean supportsFollow() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsSearch() {
|
public boolean supportsSearch() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean searchRequiresLogin() {
|
public boolean searchRequiresLogin() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,7 +111,7 @@ public class AmateurTv extends AbstractSite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model createModelFromUrl(String url) {
|
public Model createModelFromUrl(String url) {
|
||||||
Matcher m = Pattern.compile("https?://.*?amateur.tv/.*").matcher(url);
|
Matcher m = Pattern.compile("https?://.*?amateur.tv/(.*)").matcher(url);
|
||||||
if(m.matches()) {
|
if(m.matches()) {
|
||||||
String modelName = m.group(1);
|
String modelName = m.group(1);
|
||||||
return createModel(modelName);
|
return createModel(modelName);
|
||||||
|
|
|
@ -13,8 +13,6 @@ import javax.xml.bind.JAXBException;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.iheartradio.m3u8.Encoding;
|
import com.iheartradio.m3u8.Encoding;
|
||||||
import com.iheartradio.m3u8.Format;
|
import com.iheartradio.m3u8.Format;
|
||||||
|
@ -37,8 +35,6 @@ import okhttp3.Response;
|
||||||
|
|
||||||
public class AmateurTvModel extends AbstractModel {
|
public class AmateurTvModel extends AbstractModel {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AmateurTvModel.class);
|
|
||||||
|
|
||||||
private boolean online = false;
|
private boolean online = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,11 +49,11 @@ public class AmateurTvModel extends AbstractModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public State getOnlineState(boolean failFast) throws IOException, ExecutionException {
|
public State getOnlineState(boolean failFast) throws IOException, ExecutionException {
|
||||||
if (failFast) {
|
if (failFast && onlineState != UNKNOWN) {
|
||||||
return onlineState;
|
return onlineState;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
isOnline(true);
|
onlineState = isOnline(true) ? ONLINE : OFFLINE;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
onlineState = OFFLINE;
|
onlineState = OFFLINE;
|
||||||
|
|
Loading…
Reference in New Issue