Added DMFA comic

This commit is contained in:
Tejaswi 2013-01-19 17:02:03 +05:30
parent e0fec99fdf
commit 9ce79d215e
4 changed files with 101 additions and 5 deletions

View File

@ -49,6 +49,7 @@
{"class":"Sheldon", "name":"Sheldon", "pref":"sheldonPref"},
{"class":"Sinfest", "name":"Sinfest", "pref":"sinfestPref"},
{"class":"SluggyFreelance", "name":"Sluggy Freelance", "pref":"sluggyfreelancePref", "new":"1"},
{"class":"DMFA", "name":"DMFA", "pref":"dmfaPref", "new":"1"},
{"class":"SomethingofthatIlk", "name":"Something Of That Ilk", "pref":"somethingofthatilkPref"},
@ -78,6 +79,8 @@
{"class":"IrregularWebComic", "name":"Irregular Web Comic", "pref":"irregularWebComicPref"},
{"class":"PbfComics", "name":"PBF Comics", "pref":"pbfComicsPref"},
{"class":"AgentXComics", "name":"Agent X Comics", "pref":"agentXComicsPref"},
{"class":"DailyKingFeatures.Zits", "name":"Zits", "pref":"zitsComicsPref"},
{"class":"DailyKingFeatures.BeetleBailey", "name":"Beetle Bailey", "pref":"beetleBaileyComicsPref"},
{"class":"DailyKingFeatures.BrilliantMindOfEdisonLee", "name":"Brilliant Mind Of Edison Lee", "pref":"edisonLeeComicsPref"},
@ -90,6 +93,7 @@
{"class":"DailyKingFeatures.ArcticCircle", "name":"Arctic Circle", "pref":"arcticCircleComicsPref"},
{"class":"DailyKingFeatures.PajamaDiaries", "name":"Pajama Diaries", "pref":"pajamaDiariesComicsPref"},
{"class":"GoComics.TwoCowsandaChicken", "name":"2 Cows and a Chicken", "pref":"2cowsandachickenPref"},
{"class":"GoComics.NineChickweedLane", "name":"9 Chickweed Lane", "pref":"9chickweedlanePref"},
{"class":"GoComics.NinetoFive", "name":"9 to 5", "pref":"9to5Pref"},

View File

@ -0,0 +1,97 @@
package com.blogspot.applications4android.comicreader.comics;
import java.io.BufferedReader;
import java.io.IOException;
import com.blogspot.applications4android.comicreader.comictypes.IndexedComic;
import com.blogspot.applications4android.comicreader.core.Strip;
import com.blogspot.applications4android.comicreader.exceptions.ComicLatestException;
public class DMFA extends IndexedComic {
@Override
protected String getFrontPageUrl() {
return "http://www.missmab.com/";
}
@Override
public String getComicWebPageUrl() {
return "http://www.missmab.com/";
}
@Override
protected int parseForLatestId(BufferedReader reader) throws ComicLatestException, IOException {
String str;
String final_str = null;
while ((str = reader.readLine()) != null) {
if(str.indexOf("Images/comicprev.gif") != -1) {
final_str = str;
}
}
if(final_str == null) {
String msg = "Failed to get the latest id for " + getName();
ComicLatestException e = new ComicLatestException(msg);
throw e;
}
// using prev-id to get to the latest id.
final_str = final_str.replaceAll(".*<A HREF=\"Comics/Vol_","");
final_str = final_str.replaceAll(".php.*", "");
return (Integer.parseInt(final_str) + 1);
}
@Override
public String getStripUrlFromId(int num) {
String numStr;
if(num < 100) {
numStr = String.format("%03d", num);
}
else {
numStr = "" + num;
}
return "http://www.missmab.com/Comics/Vol_" + numStr + ".php";
}
@Override
protected int getIdFromStripUrl(String url) {
url = url.replace("http://www.missmab.com/Comics/Vol_", "");
url = url.replace(".php", "");
return Integer.parseInt(url);
}
@Override
protected boolean htmlNeeded() {
return true;
}
@Override
protected String parse(String url, BufferedReader reader, Strip strip) throws IOException {
String str;
String final_str = getImageUrlFromStripUrl(url);
String final_itext = null;
while ((str = reader.readLine()) != null) {
if(str.indexOf("<TITLE>") != -1) {
final_itext = str;
}
}
final_itext = final_itext.replaceAll(".*<TITLE>", "");
final_itext = final_itext.replaceAll("</TITLE>.*", "");
strip.setTitle("DMFA: #" + getIdFromStripUrl(url));
strip.setText(final_itext);
return final_str;
}
private String getImageUrlFromStripUrl(String url) {
int id = getIdFromStripUrl(url);
String idStr;
if(id < 10) {
idStr = "0" + id;
}
else {
idStr = "" + id;
}
return "http://www.missmab.com/Comics/Vol" + idStr + ".jpg";
}
}

View File

@ -5,13 +5,9 @@ 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;

View File

@ -1,6 +1,5 @@
package com.blogspot.applications4android.comicreader.comics;
import android.util.Log;
import com.blogspot.applications4android.comicreader.comictypes.YearlyArchivedComic;
import com.blogspot.applications4android.comicreader.core.Strip;
import java.io.BufferedReader;