diff --git a/ComicReader/assets/classes.json b/ComicReader/assets/classes.json index bbd2f25..c5d3f44 100755 --- a/ComicReader/assets/classes.json +++ b/ComicReader/assets/classes.json @@ -22,6 +22,8 @@ {"class":"Dinosaur", "name":"Dinosaur", "pref":"dinosaurPref"}, {"class":"DogHouseDiaries", "name":"Doghouse Diaries", "pref":"doghousediariesPref"}, {"class":"DumbingofAge", "name":"Dumbing of Age", "pref":"dumbingofagePref"}, + {"class":"EdmundFinney", "name":"Edmund Finney's Quest to Find the Meaning of Life", "pref":"edmundfinneyPref", "new":"1"}, + {"class":"ElGoonishShive","name":"El Goonish Shive", "pref":"elgoonishshivePref", "new":"1"}, {"class":"FeyWinds", "name":"Fey Winds", "pref":"feywindsPref"}, {"class":"FreeFall", "name":"Free Fall", "pref":"freefallPref"}, {"class":"GeekAndPoke", "name":"Geek And Poke", "pref":"geeknpokePref"}, diff --git a/ComicReader/src/com/blogspot/applications4android/comicreader/comics/EdmundFinney.java b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/EdmundFinney.java new file mode 100644 index 0000000..93c60dd --- /dev/null +++ b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/EdmundFinney.java @@ -0,0 +1,94 @@ +package com.blogspot.applications4android.comicreader.comics; + +import java.io.BufferedReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import android.util.Log; + +import com.blogspot.applications4android.comicreader.comictypes.ArchivedComic; +import com.blogspot.applications4android.comicreader.core.Strip; + +public class EdmundFinney extends ArchivedComic { + + @Override + protected String[] getAllComicUrls(BufferedReader reader) + throws IOException { + + ArrayList strips = new ArrayList(); + String line = reader.readLine(); + + Pattern archiveStripPattern = Pattern.compile("http://eqcomics.com/..../../../.*?/"); + + while((line != null)) { + + Matcher lineMatcher = archiveStripPattern.matcher(line); + if(line.contains("") && lineMatcher.find()) { + strips.add(lineMatcher.group(0)); + //Log.d("edmundfinney", "added strip url: "+lineMatcher.group(0)); + } + + line = reader.readLine(); + } + + Collections.reverse(strips); + + return strips.toArray(new String[strips.size()]); + } + + @Override + protected String getArchiveUrl() { + return "http://eqcomics.com/archive"; + } + + @Override + public String getComicWebPageUrl() { + return "http://eqcomics.com"; + } + + @Override + protected boolean htmlNeeded() { + return true; + } + + @Override + protected String parse(String url, BufferedReader reader, Strip strip) + throws IOException { + + String line = reader.readLine(); + String imgUrl = null; + String title = null; + + Pattern imgPattern = Pattern.compile("http://eqcomics.com/comics/.*(jpg|png|gif)"); + + Log.d("edmundfinney","parsing url: "+url); + + while((line != null)) { + + Matcher urlMatcher = imgPattern.matcher(line); + + if(urlMatcher.find()) { + imgUrl = urlMatcher.group(0); + //Log.d("edmundfinney", "found img url:"+imgUrl); + } + + if(line.matches(".*.*")) { + title = line.replaceAll(".*<title>", ""); + title = title.replaceAll("", ""); + title = title.replaceAll("Edmund Finney's Quest to Find the Meaning of Life - ", ""); + Log.d("edmundfinney", "found strip title: "+title); + } + + line = reader.readLine(); + } + + strip.setText(""); + strip.setTitle(title); + + return imgUrl; + } + +} diff --git a/ComicReader/src/com/blogspot/applications4android/comicreader/comics/ElGoonishShive.java b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/ElGoonishShive.java new file mode 100644 index 0000000..e74a0df --- /dev/null +++ b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/ElGoonishShive.java @@ -0,0 +1,100 @@ +//Added by Crespyl + +package com.blogspot.applications4android.comicreader.comics; + +import java.io.BufferedReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import android.util.Log; + +import com.blogspot.applications4android.comicreader.comictypes.DailyComic; +import com.blogspot.applications4android.comicreader.comictypes.YearlyArchivedComic; +import com.blogspot.applications4android.comicreader.core.Strip; + +public class ElGoonishShive extends YearlyArchivedComic { + + @Override + public String getComicWebPageUrl() { + return "http://www.egscomics.com/"; + } + + @Override + protected boolean htmlNeeded() { + return true; + } + + @Override + protected String parse(String url, BufferedReader reader, Strip strip) + throws IOException { + String line = reader.readLine(); + String imgUrl = null; + String title = null; + + Pattern imgPattern = Pattern.compile("comics/.*(jpg|png|gif)"); + + while((line != null)) { + + Matcher urlMatcher = imgPattern.matcher(line); + + if(urlMatcher.find()) { + imgUrl = "http://www.egscomics.com/"+urlMatcher.group(0); + } + + if(line.matches(".*.*")) { + title = line.replaceAll(".*<title>", ""); + title = title.replaceAll("", ""); + } + + line = reader.readLine(); + } + + strip.setText(""); + strip.setTitle(title); + + return imgUrl; + } + + @Override + protected ArrayList getAllComicUrls(BufferedReader reader, int year) + throws IOException { + + ArrayList urls = new ArrayList(); + Pattern comicUrlPattern = Pattern.compile("date=.........."); + + String line = null; + while((line = reader.readLine()) != null) { + Matcher urlMatcher = comicUrlPattern.matcher(line); + + if(line.contains("index.php?date=")) { + + while(urlMatcher.find()) { + urls.add("http://www.egscomics.com/index.php?"+urlMatcher.group()); + } + } + } + + return urls; + + } + + @Override + protected int getFirstYear() { + return 2002; + } + + @Override + protected String getArchiveUrl(int year) { + return String.format("http://www.egscomics.com/archives.php?year=%04d&start=0&displaymode=cal", + year); + } + + @Override + protected boolean neededReversal() { + return false; + } + +}