mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
[IMPL] Default Kernel
This commit is contained in:
@@ -1,12 +1,30 @@
|
|||||||
package at.pcgamingfreaks.mkvaudiosubtitlechanger;
|
package at.pcgamingfreaks.mkvaudiosubtitlechanger;
|
||||||
|
|
||||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.config.AttributeConfig;
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.config.AttributeConfig;
|
||||||
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.intimpl.MkvFileCollector;
|
||||||
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.FileAttribute;
|
||||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.util.ConfigUtil;
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.util.ConfigUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class AttributeUpdaterKernel {
|
public class AttributeUpdaterKernel {
|
||||||
|
MkvFileCollector collector = new MkvFileCollector();
|
||||||
public void execute() {
|
public void execute() {
|
||||||
List<AttributeConfig> list = ConfigUtil.loadConfig();
|
List<AttributeConfig> configPattern = ConfigUtil.loadConfig();
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
System.out.println("Please enter the path to the files which should be updated: ");
|
||||||
|
List<File> allValidPaths = collector.loadFiles(scanner.nextLine());
|
||||||
|
|
||||||
|
for(File file: allValidPaths) {
|
||||||
|
List<FileAttribute> attributes = collector.loadAttributes(file);
|
||||||
|
for(AttributeConfig config: configPattern) {
|
||||||
|
boolean fileIsChanged = config.processConfig(file, attributes);
|
||||||
|
if(fileIsChanged) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package at.pcgamingfreaks.mkvaudiosubtitlechanger.config;
|
package at.pcgamingfreaks.mkvaudiosubtitlechanger.config;
|
||||||
|
|
||||||
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.FileAttribute;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -13,4 +15,17 @@ public class AttributeConfig {
|
|||||||
this.audio = audio;
|
this.audio = audio;
|
||||||
this.subtitle = subtitle;
|
this.subtitle = subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes the config lists and apply the changes if the combination matches
|
||||||
|
* @return If the current configuration matched and changes applied or not
|
||||||
|
*/
|
||||||
|
public boolean processConfig(File file, List<FileAttribute> attributes) {
|
||||||
|
// check if size is bigger or equal 2 to make sure that there is at least one audio and subtitle line
|
||||||
|
// TODO: implement empty audio or subtitle line
|
||||||
|
if(attributes.size() >= 2) {
|
||||||
|
// TODO: Update queryBuilder:updateAttributes here
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user