Code cleanup

This commit is contained in:
0xb00bface 2022-11-26 18:49:01 +01:00
parent 505e641eb9
commit 97b4aa992f
1 changed files with 16 additions and 17 deletions

View File

@ -1,17 +1,5 @@
package ctbrec.ui.sites.bonga; package ctbrec.ui.sites.bonga;
import static ctbrec.io.HttpConstants.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ctbrec.Config; import ctbrec.Config;
import ctbrec.Model; import ctbrec.Model;
import ctbrec.sites.bonga.BongaCams; import ctbrec.sites.bonga.BongaCams;
@ -20,14 +8,25 @@ import ctbrec.ui.SiteUiFactory;
import ctbrec.ui.tabs.PaginatedScheduledService; import ctbrec.ui.tabs.PaginatedScheduledService;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import okhttp3.Request; import okhttp3.Request;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static ctbrec.io.HttpConstants.*;
public class BongaCamsUpdateService extends PaginatedScheduledService { public class BongaCamsUpdateService extends PaginatedScheduledService {
private static final Logger LOG = LoggerFactory.getLogger(BongaCamsUpdateService.class); private static final Logger LOG = LoggerFactory.getLogger(BongaCamsUpdateService.class);
private BongaCams bongaCams; private final BongaCams bongaCams;
private String url; private final String url;
private boolean requiresLogin; private final boolean requiresLogin;
public BongaCamsUpdateService(BongaCams bongaCams, String url) { public BongaCamsUpdateService(BongaCams bongaCams, String url) {
this(bongaCams, url, false); this(bongaCams, url, false);
@ -41,7 +40,7 @@ public class BongaCamsUpdateService extends PaginatedScheduledService {
@Override @Override
protected Task<List<Model>> createTask() { protected Task<List<Model>> createTask() {
return new Task<List<Model>>() { return new Task<>() {
@Override @Override
public List<Model> call() throws IOException { public List<Model> call() throws IOException {
if (requiresLogin) { if (requiresLogin) {
@ -54,7 +53,7 @@ public class BongaCamsUpdateService extends PaginatedScheduledService {
} }
private List<Model> loadModelList() throws IOException { private List<Model> loadModelList() throws IOException {
String pageUrl = url + ((page-1) * 36); String pageUrl = url + ((page - 1) * 36);
LOG.debug("Fetching page {}", pageUrl); LOG.debug("Fetching page {}", pageUrl);
var request = new Request.Builder() var request = new Request.Builder()
.url(pageUrl) .url(pageUrl)