From: David ‘Bombe’ Roden Date: Thu, 11 Jul 2013 20:45:32 +0000 (+0200) Subject: Ignore albums without inserted images when calculating the fingerprint. X-Git-Tag: 0.8.7^2~35 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d412e05eaa6268d648469536ac8a77a7184959fa;p=Sone.git Ignore albums without inserted images when calculating the fingerprint. --- diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index aa14ede..c47d83f 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -86,11 +86,19 @@ public class Album implements Fingerprintable { @Override public boolean apply(Album album) { + /* so, we flatten all albums below the given one and check whether at least one album… */ return FluentIterable.from(asList(album)).transformAndConcat(FLATTENER).anyMatch(new Predicate() { @Override public boolean apply(Album album) { - return !album.getImages().isEmpty(); + /* …contains any inserted images. */ + return !album.getImages().isEmpty() && FluentIterable.from(album.getImages()).allMatch(new Predicate() { + + @Override + public boolean apply(Image input) { + return input.isInserted(); + } + }); } }); } diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 22dc593..eb52860 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -832,7 +832,10 @@ public class Sone implements Fingerprintable, Comparable { hash.putString(")"); hash.putString("Albums("); - for (Album album : albums) { + for (Album album : rootAlbum.getAlbums()) { + if (!Album.NOT_EMPTY.apply(album)) { + continue; + } hash.putString(album.getFingerprint()); } hash.putString(")");