forked from j62/ctbrec
Remove a few code smells
This commit is contained in:
parent
1ae3743bed
commit
62602b552f
|
@ -562,9 +562,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
SplitBiggerThanOption other = (SplitBiggerThanOption) obj;
|
SplitBiggerThanOption other = (SplitBiggerThanOption) obj;
|
||||||
if (value != other.value)
|
return value != other.value;
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValueConverter converter() {
|
public static ValueConverter converter() {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class Fc2UpdateService extends PaginatedScheduledService {
|
||||||
}
|
}
|
||||||
return models.stream()
|
return models.stream()
|
||||||
.sorted((m1, m2) -> m2.getViewerCount() - m1.getViewerCount())
|
.sorted((m1, m2) -> m2.getViewerCount() - m1.getViewerCount())
|
||||||
.skip( (page - 1) * modelsPerPage)
|
.skip( (long)(page - 1) * modelsPerPage)
|
||||||
.limit(modelsPerPage)
|
.limit(modelsPerPage)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class RemoteRecorder implements Recorder {
|
||||||
private static final String COULDNT_SYNCHRONIZE_WITH_SERVER = "Couldn't synchronize with server";
|
private static final String COULDNT_SYNCHRONIZE_WITH_SERVER = "Couldn't synchronize with server";
|
||||||
private static final String COULDNT_SYNCHRONIZE_WITH_SERVER_HTTP_STATUS = "Couldn't synchronize with server. HTTP status: {} - {}";
|
private static final String COULDNT_SYNCHRONIZE_WITH_SERVER_HTTP_STATUS = "Couldn't synchronize with server. HTTP status: {} - {}";
|
||||||
private volatile boolean running = false;
|
private volatile boolean running = false;
|
||||||
private static final long ONE_HUNDRED_MIB = 100 * 1024 * 1024;
|
private static final long ONE_HUNDRED_MIB = 100 * 1024 * 1024L;
|
||||||
|
|
||||||
public SyncThread() {
|
public SyncThread() {
|
||||||
setName("RemoteRecorder SyncThread");
|
setName("RemoteRecorder SyncThread");
|
||||||
|
@ -375,11 +375,8 @@ public class RemoteRecorder implements Recorder {
|
||||||
for (Site site : sites) {
|
for (Site site : sites) {
|
||||||
for (Recording recording : recordings) {
|
for (Recording recording : recordings) {
|
||||||
Model m = recording.getModel();
|
Model m = recording.getModel();
|
||||||
if (m.getSite() == null) {
|
if (m.getSite() == null && site.isSiteForModel(m)) {
|
||||||
if (site.isSiteForModel(m)) {
|
m.setSite(site);
|
||||||
m.setSite(site);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import ctbrec.recorder.download.ProcessExitedUncleanException;
|
||||||
public class FFmpegDownload extends AbstractHlsDownload {
|
public class FFmpegDownload extends AbstractHlsDownload {
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(FFmpegDownload.class);
|
private static final transient Logger LOG = LoggerFactory.getLogger(FFmpegDownload.class);
|
||||||
|
|
||||||
private transient Config config;
|
|
||||||
private transient Process ffmpeg;
|
private transient Process ffmpeg;
|
||||||
private File targetFile;
|
private File targetFile;
|
||||||
|
|
||||||
|
@ -44,10 +43,8 @@ public class FFmpegDownload extends AbstractHlsDownload {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Config config, Model model, Instant startTime, ExecutorService executorService) {
|
public void init(Config config, Model model, Instant startTime, ExecutorService executorService) throws IOException {
|
||||||
this.config = config;
|
super.init(config, model, startTime, executorService);
|
||||||
this.model = model;
|
|
||||||
this.startTime = startTime;
|
|
||||||
String suffix = config.getSettings().ffmpegFileSuffix;
|
String suffix = config.getSettings().ffmpegFileSuffix;
|
||||||
targetFile = config.getFileForRecording(model, suffix, startTime);
|
targetFile = config.getFileForRecording(model, suffix, startTime);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +119,7 @@ public class FFmpegDownload extends AbstractHlsDownload {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postprocess(Recording recording) {
|
public void postprocess(Recording recording) {
|
||||||
|
// nothing to here for now
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -116,7 +116,6 @@ public class StreamateHttpClient extends HttpClient {
|
||||||
String content = response.body().string();
|
String content = response.body().string();
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
JSONObject json = new JSONObject(content);
|
JSONObject json = new JSONObject(content);
|
||||||
//LOG.debug(json.toString(2));
|
|
||||||
loggedIn = json.has(SAKEY_KEY);
|
loggedIn = json.has(SAKEY_KEY);
|
||||||
saKey = json.optString(SAKEY_KEY);
|
saKey = json.optString(SAKEY_KEY);
|
||||||
JSONObject account = json.getJSONObject("account");
|
JSONObject account = json.getJSONObject("account");
|
||||||
|
|
|
@ -93,7 +93,6 @@ public class StreamateModel extends AbstractModel {
|
||||||
try (Response response = site.getHttpClient().execute(req)) {
|
try (Response response = site.getHttpClient().execute(req)) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
//LOG.debug(json.toString(2));
|
|
||||||
JSONObject formats = json.getJSONObject("formats");
|
JSONObject formats = json.getJSONObject("formats");
|
||||||
JSONObject hls = formats.getJSONObject("mp4-hls");
|
JSONObject hls = formats.getJSONObject("mp4-hls");
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class StripchatHttpClient extends HttpClient {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public boolean checkLoginSuccess() throws IOException {
|
public boolean checkLoginSuccess() throws IOException {
|
||||||
long userId = getUserId();
|
userId = getUserId();
|
||||||
String url = Stripchat.baseUri + "/api/front/users/" + userId + "/favorites";
|
String url = Stripchat.baseUri + "/api/front/users/" + userId + "/favorites";
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
|
|
Loading…
Reference in New Issue