Fix faulty track attribute collection

This commit is contained in:
RatzzFatzz
2025-12-11 17:56:56 +01:00
parent 37cedecea7
commit 363492be43
5 changed files with 76 additions and 42 deletions

View File

@@ -67,7 +67,7 @@ public abstract class AttributeUpdaterKernel {
executor.awaitTermination(1, TimeUnit.DAYS);
}
writeLastExecutionDate();
// writeLastExecutionDate();
statistic.stopTimer();
statistic.printResult();
@@ -88,7 +88,7 @@ public abstract class AttributeUpdaterKernel {
return;
}
attributeProcessor.findDefaultMatchAndApplyChanges(fileInfo);
attributeProcessor.findDefaultMatchAndApplyChanges(fileInfo, config.getAttributeConfig());
attributeProcessor.findForcedTracksAndApplyChanges(fileInfo, config.isOverwriteForced());
attributeProcessor.findCommentaryTracksAndApplyChanges(fileInfo);
attributeProcessor.findHearingImpairedTracksAndApplyChanges(fileInfo);
@@ -134,25 +134,25 @@ public abstract class AttributeUpdaterKernel {
}
// should this be here?
protected void writeLastExecutionDate() {
if (config.isSafeMode()) {
return;
}
try {
String filePath = AppDirsFactory.getInstance().getUserConfigDir(ProjectUtil.getProjectName(), null, null);
File configDir = Path.of(filePath).toFile();
if (!configDir.exists()) configDir.mkdirs();
File lastExecutionFile = Path.of(filePath + "/last-execution.yml").toFile();
if (!lastExecutionFile.exists()) lastExecutionFile.createNewFile();
YAML yaml = new YAML(lastExecutionFile);
yaml.set(config.getNormalizedLibraryPath(), DateUtils.convert(new Date()));
yaml.save(lastExecutionFile);
} catch (IOException | YamlInvalidContentException e) {
log.error("last-execution.yml could not be created or read.", e);
}
}
// protected void writeLastExecutionDate() {
// if (config.isSafeMode()) {
// return;
// }
//
// try {
// String filePath = AppDirsFactory.getInstance().getUserConfigDir(ProjectUtil.getProjectName(), null, null);
//
// File configDir = Path.of(filePath).toFile();
// if (!configDir.exists()) configDir.mkdirs();
//
// File lastExecutionFile = Path.of(filePath + "/last-execution.yml").toFile();
// if (!lastExecutionFile.exists()) lastExecutionFile.createNewFile();
//
// YAML yaml = new YAML(lastExecutionFile);
// yaml.set(config.getNormalizedLibraryPath(), DateUtils.convert(new Date()));
// yaml.save(lastExecutionFile);
// } catch (IOException | YamlInvalidContentException e) {
// log.error("last-execution.yml could not be created or read.", e);
// }
// }
}

View File

@@ -91,7 +91,7 @@ public class MkvFileProcessor implements FileProcessor {
for (Map<String, Object> attribute : tracks) {
if (!"video".equals(attribute.get("type"))) {
Map<String, Object> properties = (Map<String, Object>) attribute.get("properties");
fileInfo.getTracks().add(new TrackAttributes(
fileInfo.addTrack(new TrackAttributes(
(int) properties.get("number"),
(String) properties.get("language"),
(String) properties.get("track_name"),