Skip to content

Commit

Permalink
1.4.3 <=> IMDB ID cleaning to minimize amount of non-matches
Browse files Browse the repository at this point in the history
  • Loading branch information
mynttt committed Aug 25, 2020
1 parent 74a26bc commit 394a1ec
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.4.3
- IMDB id cleaning to minimize the amount of non matches after having an id resolved

## 1.4.2
- tmdb resolve bug fixed

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.1
1.4.3
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'com.github.spotbugs' version '2.0.1'
}

version = '1.4.2'
version = '1.4.3'
sourceCompatibility = '11'

new File(projectDir, "VERSION").text = version;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/updatetool/imdb/ImdbPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void accumulateMetadata(ImdbJob job) throws Exception {
@Override
public void transformMetadata(ImdbJob job) throws Exception {
var map = new HashMap<ImdbMetadataResult, ExportedRating>();
job.items.forEach(i -> map.put(i, dataset.getRatingFor(i.imdbId)));
job.items.forEach(i -> map.put(i, dataset.getRatingFor(ImdbTransformer.clean(i.imdbId))));
var noUpdate = map.entrySet().stream().filter(Predicate.not(ImdbTransformer::needsUpdate)).collect(Collectors.toSet());
if(!noUpdate.isEmpty()) {
Logger.info(noUpdate.size() + " item(s) need no update.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class ImdbRatingDataset {
private HashMap<String, String> data = new HashMap<>();

public ExportedRating getRatingFor(String imdbId) {
final String rating = data.get(imdbId);
String rating = data.get(imdbId);
return () -> rating;
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/updatetool/imdb/ImdbTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ public static void updateMetadata(Map.Entry<ImdbMetadataResult, ExportedRating>

meta.extraData = extra.toURI();
}

// Cleaning required because of interesting data from TVDB
public static String clean(String imdbId) {
if(imdbId == null)
return null;
String numbers = ImdbUtility.extractId(ImdbUtility.NUMERIC, imdbId);
return "tt"+numbers;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.1
1.4.3

0 comments on commit 394a1ec

Please sign in to comment.