9 Commits
1.0 ... 1.1

Author SHA1 Message Date
bba612476b Update dependencies & fix null pointer exception when file has missing properties or none at all 2022-02-23 00:16:14 +01:00
Michael
097499a916 Merge pull request #8 from RatzzFatzz/dependabot/maven/org.apache.logging.log4j-log4j-api-2.15.0
Bump log4j-api from 2.12.0 to 2.15.0
2021-12-12 14:45:27 +01:00
Michael
3617d84b3e Merge pull request #9 from RatzzFatzz/dependabot/maven/org.apache.logging.log4j-log4j-core-2.15.0
Bump log4j-core from 2.13.2 to 2.15.0
2021-12-12 14:45:12 +01:00
dependabot[bot]
ecbfc77da0 Bump log4j-core from 2.13.2 to 2.15.0
Bumps log4j-core from 2.13.2 to 2.15.0.

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-10 01:26:51 +00:00
dependabot[bot]
1ed1b6e057 Bump log4j-api from 2.12.0 to 2.15.0
Bumps log4j-api from 2.12.0 to 2.15.0.

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-api
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-10 00:59:52 +00:00
Michael
013c46d940 Merge pull request #7 from RatzzFatzz/dependabot/maven/org.apache.logging.log4j-log4j-core-2.13.2
Bump log4j-core from 2.12.0 to 2.13.2
2020-09-08 09:38:56 +02:00
dependabot[bot]
a41895df1b Bump log4j-core from 2.12.0 to 2.13.2
Bumps log4j-core from 2.12.0 to 2.13.2.

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-01 19:23:34 +00:00
Michael
6ba5064ca9 Merge pull request #6 from RatzzFatzz/dependabot/maven/com.fasterxml.jackson.core-jackson-databind-2.10.0.pr1
Bump jackson-databind from 2.9.10.4 to 2.10.0.pr1
2020-06-24 20:12:44 +02:00
dependabot[bot]
9775be153b Bump jackson-databind from 2.9.10.4 to 2.10.0.pr1
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.10.4 to 2.10.0.pr1.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-18 16:58:21 +00:00
3 changed files with 25 additions and 18 deletions

10
pom.xml
View File

@@ -106,17 +106,17 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.0</version>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.0</version>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.12.0</version>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -137,12 +137,12 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.9.9</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10.4</version>
<version>2.13.1</version>
</dependency>
<!-- endregion -->
<!-- region unit-tests -->

View File

@@ -21,6 +21,9 @@ public class AttributeUpdaterKernel {
if(allValidPaths != null && configPattern != null){
for(File file : allValidPaths){
List<FileAttribute> attributes = collector.loadAttributes(file);
if (attributes.isEmpty()) {
continue;
}
boolean fileHasChanged = false;
for(AttributeConfig config : configPattern){
/*

View File

@@ -28,22 +28,22 @@ public class MkvFileCollector implements FileCollector {
@Override
public List<File> loadFiles(String path) {
File file = new File(path);
if(file.isFile() && file.getAbsolutePath().endsWith(".mkv")){
if (file.isFile() && file.getAbsolutePath().endsWith(".mkv")) {
return new ArrayList<File>() {{
add(file);
}};
}else if(file.isDirectory()){
try(Stream<Path> paths = Files.walk(Paths.get(path))){
} else if (file.isDirectory()) {
try (Stream<Path> paths = Files.walk(Paths.get(path))) {
return paths
.filter(Files::isRegularFile)
.map(Path::toFile)
.filter(f -> f.getAbsolutePath().endsWith(".mkv"))
.collect(Collectors.toList());
}catch(IOException e){
} catch (IOException e) {
log.error("Couldn't find file or directory!", e);
return null;
}
}else{
} else {
return null;
}
}
@@ -56,11 +56,11 @@ public class MkvFileCollector implements FileCollector {
public List<FileAttribute> loadAttributes(File file) {
Map<String, Object> jsonMap;
List<FileAttribute> fileAttributes = new ArrayList<>();
try{
try {
String command = "";
if(System.getProperty("os.name").toLowerCase().contains("windows")){
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
command = "\"" + MKVToolProperties.getInstance().getMkvmergePath() + "\"";
}else{
} else {
command = MKVToolProperties.getInstance().getMkvmergePath();
}
String[] array = new String[]{
@@ -74,19 +74,23 @@ public class MkvFileCollector implements FileCollector {
InputStream inputStream = Runtime.getRuntime().exec(array).getInputStream();
jsonMap = mapper.readValue(inputStream, Map.class);
List<Map<String, Object>> tracks = (List<Map<String, Object>>) jsonMap.get("tracks");
for(Map<String, Object> attribute : tracks){
if(! "video".equals(attribute.get("type"))){
if (tracks == null) {
log.warn("Couldn't retrieve information of {}", file.getAbsoluteFile().toString());
return new ArrayList<>();
}
for (Map<String, Object> attribute : tracks) {
if (!"video".equals(attribute.get("type"))) {
Map<String, Object> properties = (Map<String, Object>) attribute.get("properties");
fileAttributes.add(new FileAttribute(
(int) properties.get("number"),
(String) properties.get("language"),
(String) properties.get("track_name"),
(Boolean) properties.get("default_track"),
(Boolean) properties.get("forced_track"),
(Boolean) properties.getOrDefault("default_track", false),
(Boolean) properties.getOrDefault("forced_track", false),
(String) attribute.get("type")));
}
}
}catch(IOException e){
} catch (IOException e) {
e.printStackTrace();
log.error("File could not be found or loaded!");
}