forked from j62/ctbrec
Code cleanup
This commit is contained in:
parent
3ca1d715a7
commit
505e641eb9
|
@ -1,11 +1,6 @@
|
||||||
package ctbrec.ui.sites.myfreecams;
|
package ctbrec.ui.sites.myfreecams;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import ctbrec.Model;
|
import ctbrec.Model;
|
||||||
import ctbrec.sites.mfc.MyFreeCamsClient;
|
import ctbrec.sites.mfc.MyFreeCamsClient;
|
||||||
import ctbrec.sites.mfc.SessionState;
|
import ctbrec.sites.mfc.SessionState;
|
||||||
|
@ -13,13 +8,16 @@ import ctbrec.sites.mfc.User;
|
||||||
import ctbrec.ui.tabs.PaginatedScheduledService;
|
import ctbrec.ui.tabs.PaginatedScheduledService;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class HDCamsUpdateService extends PaginatedScheduledService {
|
public class HDCamsUpdateService 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() {
|
||||||
var client = MyFreeCamsClient.getInstance();
|
var client = MyFreeCamsClient.getInstance();
|
||||||
var modelsPerPage = 50;
|
var modelsPerPage = 50;
|
||||||
|
|
||||||
|
@ -40,10 +38,11 @@ public class HDCamsUpdateService extends PaginatedScheduledService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.sorted((m1,m2) -> (int)(m2.getCamScore() - m1.getCamScore()))
|
.sorted((m1, m2) -> (int) (m2.getCamScore() - m1.getCamScore()))
|
||||||
.skip( (page-1l) * modelsPerPage)
|
.skip((page - 1L) * modelsPerPage)
|
||||||
.limit(modelsPerPage)
|
.limit(modelsPerPage)
|
||||||
.collect(Collectors.toList());
|
.map(Model.class::cast)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue