diff --git a/ComicReader/assets/classes.json b/ComicReader/assets/classes.json index 3336341..22b5fae 100755 --- a/ComicReader/assets/classes.json +++ b/ComicReader/assets/classes.json @@ -32,6 +32,7 @@ {"class":"GuComics", "name":"Gu Comics", "pref":"gucomicsPref"}, {"class":"GunnerkriggCourt", "name":"Gunnerkrigg Court", "pref":"gunnerkriggcourtPref"}, {"class":"JoeAndMonkey", "name":"Joe And Monkey", "pref":"joeandmonkeyPref"}, + {"class":"KevinAndKell", "name":"Kevin And Kell", "pref":"kevinandkellPref"}, {"class":"LeastICouldDo", "name":"Least I Could Do", "pref":"leasticoulddoPref"}, {"class":"LookingForGroup", "name":"Looking For Group", "pref":"lookingforgroupPref"}, {"class":"MegaTokyo", "name":"MegaTokyo", "pref":"megatokyoPref", "new":"1"}, diff --git a/ComicReader/src/com/blogspot/applications4android/comicreader/comics/KevinAndKell.java b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/KevinAndKell.java new file mode 100644 index 0000000..33445d2 --- /dev/null +++ b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/KevinAndKell.java @@ -0,0 +1,79 @@ +package com.blogspot.applications4android.comicreader.comics; + +import java.io.BufferedReader; +import java.io.IOException; +import java.util.Calendar; + +import com.blogspot.applications4android.comicreader.comictypes.DailyComic; +import com.blogspot.applications4android.comicreader.core.Strip; + +public class KevinAndKell extends DailyComic { + + @Override + public String getComicWebPageUrl() { + return "http://www.kevinandkell.com/"; + } + + + @Override + protected Calendar getFirstCalendar() { + Calendar first = Calendar.getInstance(); + first.set(1995, 8, 3); // 1995,Sept,3 + return first; + } + + @Override + protected Calendar getLatestCalendar() { + return Calendar.getInstance(m_zone); + } + + @Override + protected Calendar getTimeFromUrl(String url) { + String str = url.replace("http://www.kevinandkell.com/", ""); + String[] time = str.split("/"); + int year = Integer.parseInt(time[0]); + int month = Integer.parseInt(time[1].substring(2,4))- 1; + int day = Integer.parseInt(time[1].substring(4,6)); + Calendar date = Calendar.getInstance(); + date.set(year, month, day); + return date; + } + + @Override + public String getUrlFromTime(Calendar cal) { + String surl = String.format("http://www.kevinandkell.com/%4d/kk%02d%02d.html", + cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH)); + + return surl; + } + + + @Override + protected boolean htmlNeeded() { + return true; + } + + @Override + protected String parse(String url, BufferedReader reader, Strip strip) throws IOException { + + //Get URL + Calendar cal = getTimeFromUrl(url); + String surl = String.format("http://www.kevinandkell.com/%4d/strips/kk%4d%02d%02d.gif", + cal.get(Calendar.YEAR), cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH)); + //Get Title + String str; + String final_title = null; + while((str = reader.readLine()) != null) { + int index1 = str.indexOf("\"caption\""); + if (index1 != -1) { + final_title = str; + } + } + final_title = final_title.replaceAll(".*.>"",""); + final_title = final_title.replaceAll("".*",""); + strip.setTitle("Kevin and Kell: " + final_title); + strip.setText("-NA-"); + return surl; + } + +}