Fix display of resolution tag for amateur.tv

This commit is contained in:
0xb00bface 2021-05-23 16:56:14 +02:00
parent fc7bb1362c
commit d44fc58bf2
4 changed files with 18 additions and 18 deletions

View File

@ -727,7 +727,7 @@ public class ThumbCell extends StackPane {
try {
return model.getStreamResolution(false);
} 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];
}
}

View File

@ -76,6 +76,15 @@ public interface Model extends Comparable<Model>, Serializable {
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 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
*
* @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
*
* @return a tupel of width and height represented by an int[2]

View File

@ -6,17 +6,12 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ctbrec.Model;
import ctbrec.io.HttpClient;
import ctbrec.sites.AbstractSite;
public class AmateurTv extends AbstractSite {
private static final Logger LOG = LoggerFactory.getLogger(AmateurTv.class);
public static String baseUrl = "https://www.amateur.tv";
private AmateurTvHttpClient httpClient;
@ -79,22 +74,22 @@ public class AmateurTv extends AbstractSite {
@Override
public boolean supportsTips() {
return true;
return false;
}
@Override
public boolean supportsFollow() {
return true;
return false;
}
@Override
public boolean supportsSearch() {
return true;
return false;
}
@Override
public boolean searchRequiresLogin() {
return true;
return false;
}
@Override
@ -116,7 +111,7 @@ public class AmateurTv extends AbstractSite {
@Override
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()) {
String modelName = m.group(1);
return createModel(modelName);

View File

@ -13,8 +13,6 @@ import javax.xml.bind.JAXBException;
import org.json.JSONObject;
import org.jsoup.nodes.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.iheartradio.m3u8.Encoding;
import com.iheartradio.m3u8.Format;
@ -37,8 +35,6 @@ import okhttp3.Response;
public class AmateurTvModel extends AbstractModel {
private static final Logger LOG = LoggerFactory.getLogger(AmateurTvModel.class);
private boolean online = false;
@Override
@ -53,11 +49,11 @@ public class AmateurTvModel extends AbstractModel {
@Override
public State getOnlineState(boolean failFast) throws IOException, ExecutionException {
if (failFast) {
if (failFast && onlineState != UNKNOWN) {
return onlineState;
} else {
try {
isOnline(true);
onlineState = isOnline(true) ? ONLINE : OFFLINE;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
onlineState = OFFLINE;