diff --git a/ComicReader/assets/classes.json b/ComicReader/assets/classes.json index c5d3f44..e0ff294 100755 --- a/ComicReader/assets/classes.json +++ b/ComicReader/assets/classes.json @@ -32,8 +32,11 @@ {"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", "new":"1"}, {"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"}, + {"class":"MenageA3", "name":"Menage a 3", "pref":"menagea3Pref", "new":"1"}, {"class":"Misfile", "name":"Misfile", "pref":"misfilePref"}, {"class":"MotherGooseandGrimm", "name":"Mother Goose & Grimm", "pref":"mothergooseandgrimmPref"}, {"class":"OOTS", "name":"Order of the Stick", "pref":"ootsPref"}, @@ -62,7 +65,6 @@ {"class":"Wondermark", "name":"Wondermark", "pref":"wondermarkPref"}, {"class":"Wulffmorgenthaler", "name":"Wulffmorgenthaler", "pref":"wulffmorgenthalerPref"}, {"class":"Xkcd", "name":"Xkcd", "pref":"xkcdPref"}, - {"class":"MegaTokyo", "name":"MegaTokyo", "pref":"megatokyoPref", "new":"1"}, {"class":"Yafgc", "name":"Yet Another Fantasy Gamer Comic", "pref":"yafgcPref"}, {"class":"Zap", "name":"Zap!", "pref":"zapPref"}, {"class":"Channelate", "name":"Channelate", "pref":"channelatePref"}, diff --git a/ComicReader/res/xml/preferences.xml b/ComicReader/res/xml/preferences.xml index 62123a0..15a7912 100755 --- a/ComicReader/res/xml/preferences.xml +++ b/ComicReader/res/xml/preferences.xml @@ -1,6 +1,7 @@ + + "",""); + final_title = final_title.replaceAll("".*",""); + strip.setTitle("Kevin and Kell: " + final_title); + strip.setText("-NA-"); + return surl; + } + +} diff --git a/ComicReader/src/com/blogspot/applications4android/comicreader/comics/MegaTokyo.java b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/MegaTokyo.java index 27b8ce7..7da9f8f 100644 --- a/ComicReader/src/com/blogspot/applications4android/comicreader/comics/MegaTokyo.java +++ b/ComicReader/src/com/blogspot/applications4android/comicreader/comics/MegaTokyo.java @@ -63,7 +63,6 @@ public class MegaTokyo extends IndexedComic { String str; String final_str = null; String final_title = null; - String final_title1 = null; String final_itext = null; while ((str = reader.readLine()) != null) { int index1 = str.indexOf(" m_com = new ArrayList(); + String str, str_temp; + String search = "http://www.ma3comic.com/strips-ma3"; + int i; + while ((str = reader.readLine()) != null) { + i = str.indexOf(search); + if (i != -1) { + //remove the html surrounding the URL + if (!str.contains("ARCHIVE")) { + str_temp = str; + str_temp = str_temp.replaceAll(".*?href=\"", ""); + str_temp = str_temp.replaceAll("\".*$", ""); + m_com.add(str_temp); + } + } + } + String[] m_com_urls = new String[m_com.size()]; + m_com.toArray(m_com_urls); + return m_com_urls; + } + + @Override + protected void fetchAllComicUrls() { + if (mComicUrls == null) { + try { + ArrayList all_vols = new ArrayList(); + // Archive has volumes that update no according to calendar + // So find number of archives first. + ArrayList vol_urls = getVolURL(); + + for (String currentVol : vol_urls) { + URI u = null; + try { + u = new URI(currentVol); + } catch (Exception e) { + } // This should never occur!! + BufferedReader reader = Downloader.openConnection(u); + String[] urls = getAllComicUrls(reader); + for (int i = 0; i <= urls.length - 1; i++) { + all_vols.add(urls[i]); + } + reader.close(); + } + mComicUrls = new String[all_vols.size()]; + all_vols.toArray(mComicUrls); + } catch (Exception e) { + e.printStackTrace(); + return; + } + } + mBound = new Bound(0, (long) (mComicUrls.length - 1)); + } + + //Finds the urls for volumes. This number can be updated. + private ArrayList getVolURL() { + String str; + String search = "http://www.menagea3.net/archive/volume"; + String mArchiveStr = "http://www.ma3comic.com/archive"; + //We use an arraylist because the website does not do a great job on its design. + //They have duplicate urls and I use contains to check that there are no duplicates + ArrayList vol_urls = new ArrayList(); + Pattern p = Pattern.compile(search + "\\d"); + + try { + URI u = null; + try { + u = new URI(mArchiveStr); + } catch (Exception e) { + } // This should never occur!! + + BufferedReader reader = Downloader.openConnection(u); + int i; + while ((str = reader.readLine()) != null) { + i = str.indexOf(search); + if (i != -1) { + //Find the patter of the volume and add to the Arraylist + Matcher m = p.matcher(str); + while (m.find()) { + if (!vol_urls.contains(m.group())) { + vol_urls.add(m.group()); + } + } + } + } + reader.close(); + + } catch (Exception e) { + e.printStackTrace(); + return vol_urls; + } + + return vol_urls; + } + + @Override + protected String getLatestStripUrl() { + fetchAllComicUrls(); + return getStripUrlFromId(mComicUrls.length - 1); + } + + @Override + protected String getArchiveUrl() { + return "http://www.ma3comic.com/archive/volume"; + } + + @Override + protected boolean htmlNeeded() { + return true; + } + + @Override + protected String parse(String url, BufferedReader reader, Strip strip) + throws IOException { + String str; + String final_str = null; + String final_title = null; + while ((str = reader.readLine()) != null) { + // This gets the location of the image + int index1 = str.indexOf("comics/mat"); + if (index1 != -1) { + final_str = str; + } + // This gets the title of the commic + int index2 = str.indexOf("Ménage"); + if (index2 != -1) { + final_title = str; + } + } + // Pattern matching to remove unwanted characters. + final_str = final_str.replaceAll(".*img src=\"", ""); + final_str = final_str.replaceAll("\".*", ""); + final_title = final_title.replaceAll(".*.::", ""); + final_title = final_title.replaceAll(".*", ""); + strip.setTitle("Ménage à 3 :" + final_title); + return final_str; + } + +}