mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Differentiate between already fits config and no suitable config found
This commit is contained in:
@@ -54,6 +54,7 @@ public class AttributeUpdaterKernel {
|
||||
|
||||
statistic.stopTimer();
|
||||
System.out.println(statistic);
|
||||
log.info(statistic);
|
||||
}
|
||||
|
||||
private void process(File file, ProgressBar progressBar) {
|
||||
@@ -67,12 +68,16 @@ public class AttributeUpdaterKernel {
|
||||
processor.update(file, fileInfo);
|
||||
statistic.success();
|
||||
} catch (IOException e) {
|
||||
statistic.failure();
|
||||
statistic.failedChanging();
|
||||
log.warn("File couldn't be updated: {}", file.getAbsoluteFile());
|
||||
}
|
||||
}
|
||||
} else if (fileInfo.isUnableToApplyConfig()) {
|
||||
statistic.noSuitableConfigFound();
|
||||
} else if (fileInfo.isAlreadySuitable()){
|
||||
statistic.alreadyFits();
|
||||
} else {
|
||||
statistic.fits();
|
||||
statistic.failure();
|
||||
}
|
||||
progressBar.step();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,14 @@ public class FileInfoDto {
|
||||
private FileAttribute desiredAudioLane;
|
||||
private FileAttribute desiredSubtitleLane;
|
||||
|
||||
public boolean isUnableToApplyConfig() {
|
||||
return desiredAudioLane == null && desiredSubtitleLane == null;
|
||||
}
|
||||
|
||||
public boolean isAlreadySuitable() {
|
||||
return desiredAudioLane == defaultAudioLane && desiredSubtitleLane == defaultSubtitleLane;
|
||||
}
|
||||
|
||||
public boolean isChangeNecessary() {
|
||||
return isAudioDifferent() || isSubtitleDifferent() || areForcedTracksDifferent();
|
||||
}
|
||||
|
||||
@@ -3,22 +3,27 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.model;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Getter
|
||||
public class ResultStatistic {
|
||||
private static final String result = "Total files: %s%n" +
|
||||
"├─ Should change: %s%n" +
|
||||
"├─ Successfully changed: %s%n" +
|
||||
"│ ├─ Failed changing: %s%n" +
|
||||
"│ └─ Successfully changed: %s%n" +
|
||||
"├─ No suitable config found: %s%n" +
|
||||
"├─ Already fit config: %s%n" +
|
||||
"└─ Failed: %s%n" +
|
||||
"Runtime: %ss";
|
||||
|
||||
private int filesTotal = 0;
|
||||
private int filesShouldChange = 0;
|
||||
private int filesSuccessfullyChanged = 0;
|
||||
private int filesFailed = 0;
|
||||
private int filesAlreadyFit = 0;
|
||||
|
||||
private int shouldChange = 0;
|
||||
private int failedChanging = 0;
|
||||
private int successfullyChanged = 0;
|
||||
|
||||
private int noSuitableConfigFound = 0;
|
||||
private int alreadyFits = 0;
|
||||
private int failed = 0;
|
||||
|
||||
@Getter(AccessLevel.NONE)
|
||||
private long startTime = 0;
|
||||
private long runtime = 0;
|
||||
@@ -28,19 +33,27 @@ public class ResultStatistic {
|
||||
}
|
||||
|
||||
public synchronized void shouldChange() {
|
||||
filesShouldChange++;
|
||||
shouldChange++;
|
||||
}
|
||||
|
||||
public synchronized void success() {
|
||||
filesSuccessfullyChanged++;
|
||||
successfullyChanged++;
|
||||
}
|
||||
|
||||
public synchronized void failedChanging() {
|
||||
failedChanging++;
|
||||
}
|
||||
|
||||
public synchronized void noSuitableConfigFound() {
|
||||
noSuitableConfigFound++;
|
||||
}
|
||||
|
||||
public synchronized void alreadyFits() {
|
||||
alreadyFits++;
|
||||
}
|
||||
|
||||
public synchronized void failure() {
|
||||
filesFailed++;
|
||||
}
|
||||
|
||||
public synchronized void fits() {
|
||||
filesAlreadyFit++;
|
||||
failed++;
|
||||
}
|
||||
|
||||
public void startTimer() {
|
||||
@@ -53,7 +66,7 @@ public class ResultStatistic {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(result, filesTotal, filesShouldChange, filesSuccessfullyChanged, filesAlreadyFit,
|
||||
filesFailed, runtime / 1000);
|
||||
return String.format(result, filesTotal, shouldChange, failedChanging, successfullyChanged,
|
||||
noSuitableConfigFound, alreadyFits, failed, runtime / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user