show grouped total model count

(cherry picked from commit 7c1b366340662489d3e85e9a443b8c00a2bbf205)
This commit is contained in:
reusedname 2024-12-18 21:48:17 +05:00
parent 7fe7d005d9
commit 1e590d5641
4 changed files with 30 additions and 1 deletions

View File

@ -510,7 +510,7 @@ public class CamrecApplication extends Application {
bytesPerSecond = 0;
}
String humanReadable = ByteUnitFormatter.format(bytesPerSecond);
var status = String.format("Recording %s / %s models @ %s/s", activeRecordings, recorder.getModelCount(), humanReadable);
var status = String.format("Recording %s / %s models (%s grouped) @ %s/s", activeRecordings, recorder.getModelCount(), recorder.getGroupedModelCount(), humanReadable);
Platform.runLater(() -> statusLabel.setText(status));
}

View File

@ -174,6 +174,13 @@ public interface Recorder {
* @return
*/
int getModelCount();
/**
* Returns the number of model groups + ungrouped models
*
* @return
*/
int getGroupedModelCount();
Set<ModelGroup> getModelGroups();

View File

@ -672,6 +672,17 @@ public class RemoteRecorder implements Recorder {
return (int) models.stream().filter(m -> !m.isMarkedForLaterRecording()).count();
}
@Override
public int getGroupedModelCount() {
Map<String, String> urlToGroup = new HashMap<>();
for (var group : getModelGroups()) {
for (var url : group.getModelUrls()) {
urlToGroup.putIfAbsent(url, group.getName());
}
}
return (int) models.stream().filter(m -> !m.isMarkedForLaterRecording()).map(m -> urlToGroup.getOrDefault(m.getUrl(), m.getName())).distinct().count();
}
@Override
public Set<ModelGroup> getModelGroups() {
modelGroupLock.lock();

View File

@ -918,6 +918,17 @@ public class SimplifiedLocalRecorder implements Recorder {
return (int) models.stream().filter(m -> !m.isMarkedForLaterRecording()).count();
}
@Override
public int getGroupedModelCount() {
Map<String, String> urlToGroup = new HashMap<>();
for (var group : getModelGroups()) {
for (var url : group.getModelUrls()) {
urlToGroup.putIfAbsent(url, group.getName());
}
}
return (int) models.stream().filter(m -> !m.isMarkedForLaterRecording()).map(m -> urlToGroup.getOrDefault(m.getUrl(), m.getName())).distinct().count();
}
@Override
public Set<ModelGroup> getModelGroups() {
modelGroupLock.lock();