Display only online models in popular models tab

This commit is contained in:
0xboobface 2018-10-24 18:00:10 +02:00
parent a4fd3034a8
commit 306f07cf63
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,13 @@ public class PopularModelService extends PaginatedScheduledService {
return client.getModels().stream()
.filter(m -> m.getPreview() != null)
.filter(m -> m.getStreamUrl() != null)
.filter(m -> {
try {
return m.isOnline();
} catch (Exception e) {
return false;
}
})
.sorted((m1, m2) -> m2.getViewerCount() - m1.getViewerCount())
.skip( (page-1) * modelsPerPage)
.limit(modelsPerPage)