From 18f582bf98ae3957f1ba55a024961c1519eed54e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 25 Feb 2013 06:55:11 +0100 Subject: [PATCH] Add a method to comic filters to allow extracting image comments. This will be used by the upcoming xkcd filter. --- .../net/pterodactylus/rhynodge/filters/ComicSiteFilter.java | 12 ++++++++++++ .../rhynodge/filters/comics/SinfestComicFilter.java | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java index fb01349..fec856c 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java @@ -86,4 +86,16 @@ public abstract class ComicSiteFilter implements Filter { */ protected abstract List extractImageUrls(Document document); + /** + * Extracts the image comments from the given document. The elements of this + * last and of the list returned by {@link #extractImageUrls(org.jsoup.nodes.Document)} + * are paired up and added as {@link Strip}s. If the list returned by this + * method has less elements, an empty string is used for the remaining images. + * + * @param document + * The document to extract the image comments from + * @return The extracted image comments + */ + protected abstract List extractImageComments(Document document); + } diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java index 600257f..76089e3 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java @@ -67,4 +67,9 @@ public class SinfestComicFilter extends ComicSiteFilter { }).toList() : Collections.emptyList(); } + @Override + protected List extractImageComments(Document document) { + return Collections.emptyList(); + } + } -- 2.7.4