forked from j62/ctbrec
1
0
Fork 0

Remove a few code smells

This commit is contained in:
0xb00bface 2021-01-01 17:23:53 +01:00
parent 1ae3743bed
commit 62602b552f
7 changed files with 9 additions and 18 deletions

View File

@ -562,9 +562,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
if (getClass() != obj.getClass())
return false;
SplitBiggerThanOption other = (SplitBiggerThanOption) obj;
if (value != other.value)
return false;
return true;
return value != other.value;
}
public static ValueConverter converter() {

View File

@ -76,7 +76,7 @@ public class Fc2UpdateService extends PaginatedScheduledService {
}
return models.stream()
.sorted((m1, m2) -> m2.getViewerCount() - m1.getViewerCount())
.skip( (page - 1) * modelsPerPage)
.skip( (long)(page - 1) * modelsPerPage)
.limit(modelsPerPage)
.collect(Collectors.toList());
} else {

View File

@ -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_HTTP_STATUS = "Couldn't synchronize with server. HTTP status: {} - {}";
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() {
setName("RemoteRecorder SyncThread");
@ -375,11 +375,8 @@ public class RemoteRecorder implements Recorder {
for (Site site : sites) {
for (Recording recording : recordings) {
Model m = recording.getModel();
if (m.getSite() == null) {
if (site.isSiteForModel(m)) {
if (m.getSite() == null && site.isSiteForModel(m)) {
m.setSite(site);
continue;
}
}
}
}

View File

@ -35,7 +35,6 @@ import ctbrec.recorder.download.ProcessExitedUncleanException;
public class FFmpegDownload extends AbstractHlsDownload {
private static final transient Logger LOG = LoggerFactory.getLogger(FFmpegDownload.class);
private transient Config config;
private transient Process ffmpeg;
private File targetFile;
@ -44,10 +43,8 @@ public class FFmpegDownload extends AbstractHlsDownload {
}
@Override
public void init(Config config, Model model, Instant startTime, ExecutorService executorService) {
this.config = config;
this.model = model;
this.startTime = startTime;
public void init(Config config, Model model, Instant startTime, ExecutorService executorService) throws IOException {
super.init(config, model, startTime, executorService);
String suffix = config.getSettings().ffmpegFileSuffix;
targetFile = config.getFileForRecording(model, suffix, startTime);
}
@ -122,6 +119,7 @@ public class FFmpegDownload extends AbstractHlsDownload {
@Override
public void postprocess(Recording recording) {
// nothing to here for now
}
@Override

View File

@ -116,7 +116,6 @@ public class StreamateHttpClient extends HttpClient {
String content = response.body().string();
if(response.isSuccessful()) {
JSONObject json = new JSONObject(content);
//LOG.debug(json.toString(2));
loggedIn = json.has(SAKEY_KEY);
saKey = json.optString(SAKEY_KEY);
JSONObject account = json.getJSONObject("account");

View File

@ -93,7 +93,6 @@ public class StreamateModel extends AbstractModel {
try (Response response = site.getHttpClient().execute(req)) {
if (response.isSuccessful()) {
JSONObject json = new JSONObject(response.body().string());
//LOG.debug(json.toString(2));
JSONObject formats = json.getJSONObject("formats");
JSONObject hls = formats.getJSONObject("mp4-hls");

View File

@ -117,7 +117,7 @@ public class StripchatHttpClient extends HttpClient {
* @throws IOException
*/
public boolean checkLoginSuccess() throws IOException {
long userId = getUserId();
userId = getUserId();
String url = Stripchat.baseUri + "/api/front/users/" + userId + "/favorites";
Request request = new Request.Builder()
.url(url)