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();
|
statistic.stopTimer();
|
||||||
System.out.println(statistic);
|
System.out.println(statistic);
|
||||||
|
log.info(statistic);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(File file, ProgressBar progressBar) {
|
private void process(File file, ProgressBar progressBar) {
|
||||||
@@ -67,12 +68,16 @@ public class AttributeUpdaterKernel {
|
|||||||
processor.update(file, fileInfo);
|
processor.update(file, fileInfo);
|
||||||
statistic.success();
|
statistic.success();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
statistic.failure();
|
statistic.failedChanging();
|
||||||
log.warn("File couldn't be updated: {}", file.getAbsoluteFile());
|
log.warn("File couldn't be updated: {}", file.getAbsoluteFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (fileInfo.isUnableToApplyConfig()) {
|
||||||
|
statistic.noSuitableConfigFound();
|
||||||
|
} else if (fileInfo.isAlreadySuitable()){
|
||||||
|
statistic.alreadyFits();
|
||||||
} else {
|
} else {
|
||||||
statistic.fits();
|
statistic.failure();
|
||||||
}
|
}
|
||||||
progressBar.step();
|
progressBar.step();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ public class FileInfoDto {
|
|||||||
private FileAttribute desiredAudioLane;
|
private FileAttribute desiredAudioLane;
|
||||||
private FileAttribute desiredSubtitleLane;
|
private FileAttribute desiredSubtitleLane;
|
||||||
|
|
||||||
|
public boolean isUnableToApplyConfig() {
|
||||||
|
return desiredAudioLane == null && desiredSubtitleLane == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAlreadySuitable() {
|
||||||
|
return desiredAudioLane == defaultAudioLane && desiredSubtitleLane == defaultSubtitleLane;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isChangeNecessary() {
|
public boolean isChangeNecessary() {
|
||||||
return isAudioDifferent() || isSubtitleDifferent() || areForcedTracksDifferent();
|
return isAudioDifferent() || isSubtitleDifferent() || areForcedTracksDifferent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,27 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.model;
|
|||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class ResultStatistic {
|
public class ResultStatistic {
|
||||||
private static final String result = "Total files: %s%n" +
|
private static final String result = "Total files: %s%n" +
|
||||||
"├─ Should change: %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" +
|
"├─ Already fit config: %s%n" +
|
||||||
"└─ Failed: %s%n" +
|
"└─ Failed: %s%n" +
|
||||||
"Runtime: %ss";
|
"Runtime: %ss";
|
||||||
|
|
||||||
private int filesTotal = 0;
|
private int filesTotal = 0;
|
||||||
private int filesShouldChange = 0;
|
|
||||||
private int filesSuccessfullyChanged = 0;
|
private int shouldChange = 0;
|
||||||
private int filesFailed = 0;
|
private int failedChanging = 0;
|
||||||
private int filesAlreadyFit = 0;
|
private int successfullyChanged = 0;
|
||||||
|
|
||||||
|
private int noSuitableConfigFound = 0;
|
||||||
|
private int alreadyFits = 0;
|
||||||
|
private int failed = 0;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
private long startTime = 0;
|
private long startTime = 0;
|
||||||
private long runtime = 0;
|
private long runtime = 0;
|
||||||
@@ -28,19 +33,27 @@ public class ResultStatistic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void shouldChange() {
|
public synchronized void shouldChange() {
|
||||||
filesShouldChange++;
|
shouldChange++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void success() {
|
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() {
|
public synchronized void failure() {
|
||||||
filesFailed++;
|
failed++;
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void fits() {
|
|
||||||
filesAlreadyFit++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startTimer() {
|
public void startTimer() {
|
||||||
@@ -53,7 +66,7 @@ public class ResultStatistic {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format(result, filesTotal, filesShouldChange, filesSuccessfullyChanged, filesAlreadyFit,
|
return String.format(result, filesTotal, shouldChange, failedChanging, successfullyChanged,
|
||||||
filesFailed, runtime / 1000);
|
noSuitableConfigFound, alreadyFits, failed, runtime / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user