Skip to content

Commit

Permalink
Search(Show|Movie)Parser: do not set aside videos with missing air da…
Browse files Browse the repository at this point in the history
  • Loading branch information
courville committed Feb 16, 2024
1 parent 5dbb96d commit 0012f8c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
28 changes: 14 additions & 14 deletions src/com/archos/mediascraper/themoviedb3/SearchMovieParser2.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,26 @@ public int compare(final BaseMovie bm1, final BaseMovie bm2) {
levenshteinDistanceOriginalTitle = levenshteinDistance.apply(movieNameLC, result.getOriginalTitle().toLowerCase());
log.debug("getSearchMovieParserResult: between " + movieNameLC + " and " + result.getOriginalTitle().toLowerCase() + "/" + result.getTitle().toLowerCase() + " levenshteinDistanceTitle=" + levenshteinDistanceTitle + ", levenshteinDistanceOriginalTitle=" + levenshteinDistanceOriginalTitle);

if (! isReleaseDateKnown) {
log.debug("getSearchMovieParserResult: set aside " + movie.title + " because release date is missing");
searchMovieParserResult.resultsNoAirDate.add(new Pair<>(result,
if (movie.poster_path == null || movie.poster_path.endsWith("missing/series.jpg") || movie.poster_path.endsWith("missing/movie.jpg") || movie.poster_path == "") {
log.debug("getSearchMovieParserResult: set aside " + movie.title + " because poster missing i.e. image=" + movie.poster_path);
searchMovieParserResult.resultsNoPoster.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
} else {
if (movie.poster_path == null || movie.poster_path.endsWith("missing/series.jpg") || movie.poster_path.endsWith("missing/movie.jpg") || movie.poster_path == "") {
log.debug("getSearchMovieParserResult: set aside " + movie.title + " because poster missing i.e. image=" + movie.poster_path);
searchMovieParserResult.resultsNoPoster.add(new Pair<>(result,
log.debug("getSearchMovieParserResult: " + movie.title + " has poster_path " + ScraperImage.TMPL + movie.poster_path);
result.setPosterPath(movie.poster_path);
if (movie.backdrop_path == null || movie.backdrop_path.endsWith("missing/series.jpg") || movie.backdrop_path.endsWith("missing/movie.jpg") || movie.backdrop_path == "") {
log.debug("getSearchMovieParserResult: set aside " + movie.title + " because banner missing i.e. banner=" + movie.backdrop_path);
searchMovieParserResult.resultsNoBanner.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
} else {
log.debug("getSearchMovieParserResult: " + movie.title + " has poster_path " + ScraperImage.TMPL + movie.poster_path);
result.setPosterPath(movie.poster_path);
if (movie.backdrop_path == null || movie.backdrop_path.endsWith("missing/series.jpg") || movie.backdrop_path.endsWith("missing/movie.jpg") || movie.backdrop_path == "") {
log.debug("getSearchMovieParserResult: set aside " + movie.title + " because banner missing i.e. banner=" + movie.backdrop_path);
searchMovieParserResult.resultsNoBanner.add(new Pair<>(result,
log.debug("getSearchMovieParserResult: " + movie.title + " has backdrop_path " + ScraperImage.TMBL + movie.backdrop_path);
// TODO MARC: this generates the thumb by resizing the large image: pass the two
result.setBackdropPath(movie.backdrop_path);
if (! isReleaseDateKnown) {
log.debug("getSearchMovieParserResult: set aside " + movie.title + " because release date is missing");
searchMovieParserResult.resultsNoAirDate.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
} else {
log.debug("getSearchMovieParserResult: " + movie.title + " has backdrop_path " + ScraperImage.TMBL + movie.backdrop_path);
// TODO MARC: this generates the thumb by resizing the large image: pass the two
result.setBackdropPath(movie.backdrop_path);
// get the min of the levenshtein distance between cleaned file based show name and title and original title identified
searchMovieParserResult.resultsProbable.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ public class SearchParserResult {
List<Pair<SearchResult,Integer>> resultsNoBanner;

public SearchParserResult() {
// contains list of results without air date
this.resultsNoAirDate = new LinkedList<>();
// contains list of results without banner
this.resultsNoBanner = new LinkedList<>();
// contains list of results without poster
this.resultsNoPoster = new LinkedList<>();
// contains list of probable results (i.e. with banner and non numeric slug) with its Levenshtein distance to cleaned filename
// contains list of probable results (i.e. with banner, poster, air date etc.) with its Levenshtein distance to cleaned filename
this.resultsProbable = new LinkedList<>();
}

Expand All @@ -53,6 +54,11 @@ public List<SearchResult> getResults(int maxItems) {
for (Pair<SearchResult,Integer> pair : resultsProbable)
if (maxItems < 0 || results.size() < maxItems)
results.add(pair.first);
// skip videos without an air date only if resultsProbable is empty
if (resultsNoAirDate.size()>0 && resultsProbable.size() == 0)
for (Pair<SearchResult,Integer> pair : resultsNoAirDate)
if (maxItems < 0 || results.size() < maxItems)
results.add(pair.first);
// do NOT skip videos without a banner but with a poster (otherwise shows like The Wrong Mans not found)
if (resultsNoBanner.size()>0)
for (Pair<SearchResult,Integer> pair : resultsNoBanner)
Expand Down
29 changes: 15 additions & 14 deletions src/com/archos/mediascraper/themoviedb3/SearchShowParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,26 +134,27 @@ public int compare(final BaseTvShow btvs1, final BaseTvShow btvs2) {
levenshteinDistanceOriginalTitle = levenshteinDistance.apply(showNameLC, result.getOriginalTitle().toLowerCase());
log.debug("getSearchShowParserResult: between " + showNameLC + " and " + result.getOriginalTitle().toLowerCase() + "/" + result.getTitle().toLowerCase() + " levenshteinDistanceTitle=" + levenshteinDistanceTitle + ", levenshteinDistanceOriginalTitle=" + levenshteinDistanceOriginalTitle);

if (! isAirDateKnown) {
log.debug("getSearchShowParserResult: set aside " + series.name + " because air date is missing");
searchShowParserResult.resultsNoAirDate.add(new Pair<>(result,

if (series.poster_path == null || series.poster_path.endsWith("missing/series.jpg") || series.poster_path.endsWith("missing/movie.jpg") || series.poster_path == "") {
log.debug("getSearchShowParserResult: set aside " + series.name + " because poster missing i.e. image=" + series.poster_path);
searchShowParserResult.resultsNoPoster.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
} else {
if (series.poster_path == null || series.poster_path.endsWith("missing/series.jpg") || series.poster_path.endsWith("missing/movie.jpg") || series.poster_path == "") {
log.debug("getSearchShowParserResult: set aside " + series.name + " because poster missing i.e. image=" + series.poster_path);
searchShowParserResult.resultsNoPoster.add(new Pair<>(result,
log.debug("getSearchShowParserResult: " + series.name + " has poster_path " + ScraperImage.TMPL + series.poster_path);
result.setPosterPath(series.poster_path);
if (series.backdrop_path == null || series.backdrop_path.endsWith("missing/series.jpg") || series.backdrop_path.endsWith("missing/movie.jpg") || series.backdrop_path == "") {
log.debug("getSearchShowParserResult: set aside " + series.name + " because banner missing i.e. banner=" + series.backdrop_path);
searchShowParserResult.resultsNoBanner.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
} else {
log.debug("getSearchShowParserResult: " + series.name + " has poster_path " + ScraperImage.TMPL + series.poster_path);
result.setPosterPath(series.poster_path);
if (series.backdrop_path == null || series.backdrop_path.endsWith("missing/series.jpg") || series.backdrop_path.endsWith("missing/movie.jpg") || series.backdrop_path == "") {
log.debug("getSearchShowParserResult: set aside " + series.name + " because banner missing i.e. banner=" + series.backdrop_path);
searchShowParserResult.resultsNoBanner.add(new Pair<>(result,
log.debug("getSearchShowParserResult: " + series.name + " has backdrop_path " + ScraperImage.TMBL + series.backdrop_path + " -> taking into account " + series.name + " because banner/image exists and known airdate");
// TODO MARC: this generates the thumb by resizing the large image: pass the two
result.setBackdropPath(series.backdrop_path);
if (! isAirDateKnown) {
log.debug("getSearchShowParserResult: set aside " + series.name + " because air date is missing");
searchShowParserResult.resultsNoAirDate.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
} else {
log.debug("getSearchShowParserResult: " + series.name + " has backdrop_path " + ScraperImage.TMBL + series.backdrop_path + " -> taking into account " + series.name + " because banner/image exists and known airdate");
// TODO MARC: this generates the thumb by resizing the large image: pass the two
result.setBackdropPath(series.backdrop_path);
searchShowParserResult.resultsProbable.add(new Pair<>(result,
Math.min(levenshteinDistanceTitle, levenshteinDistanceOriginalTitle)));
}
Expand Down

0 comments on commit 0012f8c

Please sign in to comment.