forked from j62/ctbrec
Remove apollo client again
This commit is contained in:
parent
8fca82613e
commit
ef7e109d71
|
@ -1,9 +1,7 @@
|
||||||
package ctbrec.ui.sites.cherrytv;
|
package ctbrec.ui.sites.cherrytv;
|
||||||
|
|
||||||
import com.apollographql.apollo.ApolloClient;
|
|
||||||
import ctbrec.Config;
|
import ctbrec.Config;
|
||||||
import ctbrec.Model;
|
import ctbrec.Model;
|
||||||
import ctbrec.io.HtmlParser;
|
|
||||||
import ctbrec.io.HttpException;
|
import ctbrec.io.HttpException;
|
||||||
import ctbrec.sites.cherrytv.CherryTv;
|
import ctbrec.sites.cherrytv.CherryTv;
|
||||||
import ctbrec.sites.cherrytv.CherryTvModel;
|
import ctbrec.sites.cherrytv.CherryTvModel;
|
||||||
|
@ -13,7 +11,6 @@ import okhttp3.Request;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -25,7 +22,8 @@ import java.util.Objects;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import static ctbrec.Model.State.*;
|
import static ctbrec.Model.State.OFFLINE;
|
||||||
|
import static ctbrec.Model.State.ONLINE;
|
||||||
import static ctbrec.io.HttpConstants.ACCEPT_LANGUAGE;
|
import static ctbrec.io.HttpConstants.ACCEPT_LANGUAGE;
|
||||||
import static ctbrec.io.HttpConstants.USER_AGENT;
|
import static ctbrec.io.HttpConstants.USER_AGENT;
|
||||||
|
|
||||||
|
@ -34,7 +32,6 @@ public class CherryTvUpdateService extends PaginatedScheduledService {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(CherryTvUpdateService.class);
|
private static final Logger LOG = LoggerFactory.getLogger(CherryTvUpdateService.class);
|
||||||
private String url;
|
private String url;
|
||||||
private final CherryTv site;
|
private final CherryTv site;
|
||||||
private ApolloClient apolloClient;
|
|
||||||
|
|
||||||
public CherryTvUpdateService(String url, CherryTv site) {
|
public CherryTvUpdateService(String url, CherryTv site) {
|
||||||
this.site = site;
|
this.site = site;
|
||||||
|
@ -47,10 +44,6 @@ public class CherryTvUpdateService extends PaginatedScheduledService {
|
||||||
return t;
|
return t;
|
||||||
});
|
});
|
||||||
setExecutor(executor);
|
setExecutor(executor);
|
||||||
|
|
||||||
apolloClient = ApolloClient.builder()
|
|
||||||
.serverUrl(site.getBaseUrl() + "/graphql")
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,7 +53,6 @@ public class CherryTvUpdateService extends PaginatedScheduledService {
|
||||||
public List<Model> call() throws IOException {
|
public List<Model> call() throws IOException {
|
||||||
String pageUrl = CherryTvUpdateService.this.url;
|
String pageUrl = CherryTvUpdateService.this.url;
|
||||||
LOG.debug("Fetching page {}", pageUrl);
|
LOG.debug("Fetching page {}", pageUrl);
|
||||||
apolloClient.
|
|
||||||
|
|
||||||
var request = new Request.Builder()
|
var request = new Request.Builder()
|
||||||
.url(pageUrl)
|
.url(pageUrl)
|
||||||
|
@ -80,7 +72,6 @@ public class CherryTvUpdateService extends PaginatedScheduledService {
|
||||||
|
|
||||||
private List<Model> parseModels(String body) {
|
private List<Model> parseModels(String body) {
|
||||||
var json = new JSONObject(body);
|
var json = new JSONObject(body);
|
||||||
// LOG.debug(json.toString(2));
|
|
||||||
List<Model> models = new ArrayList<>();
|
List<Model> models = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
JSONArray broadcasts = json.getJSONObject("data").getJSONObject("broadcasts").getJSONArray("broadcasts");
|
JSONArray broadcasts = json.getJSONObject("data").getJSONObject("broadcasts").getJSONArray("broadcasts");
|
||||||
|
|
|
@ -50,11 +50,6 @@
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.apollographql.apollo</groupId>
|
|
||||||
<artifactId>apollo-runtime</artifactId>
|
|
||||||
<version>2.5.9</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue