From 10301cf2db4b0b391b88ba066930b5b32825ebc4 Mon Sep 17 00:00:00 2001 From: whitecat Date: Fri, 15 Feb 2013 20:52:57 -0800 Subject: [PATCH] added Awkward zombie image text is just date --- ComicReader/assets/classes.json | 1 + .../comicreader/comics/AwkwardZombie.java | 92 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 ComicReader/src/com/blogspot/applications4android/comicreader/comics/AwkwardZombie.java diff --git a/ComicReader/assets/classes.json b/ComicReader/assets/classes.json index 110f2b6..9fd6a33 100755 --- a/ComicReader/assets/classes.json +++ b/ComicReader/assets/classes.json @@ -6,6 +6,7 @@ {"class":"ASofterWorld", "name":"A Softer World", "pref":"asofterworldPref"}, {"class":"AbstruseGoose", "name":"Abstruse Goose", "pref":"abstrusegoosePref"}, {"class":"AmazingSuperpowers", "name":"Amazing Superpowers", "pref":"amazingsuperpowersPref"}, + {"class":"AwkwardZombie", "name":"Awkward Zombie", "pref":"awkwardzombiePref", "new":"1"}, {"class":"Blondie", "name":"Blondie", "pref":"blondiePref"}, {"class":"BugComic", "name":"Bug Comic", "pref":"bugcomicPref"}, {"class":"Bunbuns", "name":"Bunbuns", "pref":"bunbunPref"}, diff --git a/ComicReader/src/com/blogspot/applications4android/comicreader/comics/AwkwardZombie.java b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/AwkwardZombie.java new file mode 100644 index 0000000..4a5923c --- /dev/null +++ b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/AwkwardZombie.java @@ -0,0 +1,92 @@ +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 com.blogspot.applications4android.comicreader.comictypes.ArchivedComic; +import com.blogspot.applications4android.comicreader.core.Strip; + +public class AwkwardZombie extends ArchivedComic { + @Override + public String getComicWebPageUrl() { + return "http://awkwardzombie.com"; + } + + @Override + protected String[] getAllComicUrls(BufferedReader reader) throws IOException { + int idx = 0; + ArrayList m_com = new ArrayList(); + String str,str_temp; + Pattern p = Pattern.compile("index\\.php\\?page=0&comic=\\d{6}"); + while((str = reader.readLine()) != null) { + + Matcher m = p.matcher(str); + while (m.find()) { + str_temp = "http://awkwardzombie.com/" + m.group(); + m_com.add(str_temp); + idx++; + } + } + Collections.reverse(m_com); + + String[] m_com_urls = new String[idx]; + m_com.toArray(m_com_urls); + return m_com_urls; + } + + @Override + protected String getArchiveUrl() { + return "http://awkwardzombie.com/index.php?page=1"; + } + + @Override + protected boolean htmlNeeded() { + return true; + } + + @Override + protected String parse(String url, BufferedReader reader, Strip strip) + throws IOException { + boolean flag = false; + String str = null; + String final_url = null; + String final_title = null; + String final_itext = null; + while ((str = reader.readLine()) != null) { + int index1 = str.indexOf("http://i49.photobucket.com/albums/"); + if (index1 != -1) { + final_url = str; + + } + int index2 = str.indexOf("
"); + if (index2 != -1) { + final_title = reader.readLine(); + } + int index3 = str.indexOf(""); + if (index3 != -1) { + flag = true; + } + if (flag && str.length()>20 ){ + final_itext = android.text.Html.fromHtml(str).toString(); + flag = false; + } + + + } + + + final_url = final_url.replaceAll(".*src=\"",""); + final_url = final_url.replaceAll("\".*",""); + final_title = final_title.replaceAll("<.*",""); + strip.setTitle("Awkward Zombie " + final_title); + strip.setText(final_itext); + return final_url; + + + } + +}