From: Niki Roo Date: Tue, 18 Apr 2017 18:34:49 +0000 (+0200) Subject: Fix date/language meta data on e-hentai X-Git-Tag: fanfix-1.5.1~4 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=416ed13fcf2416c118402fa00a5e46a7f9c44927;p=fanfix.git Fix date/language meta data on e-hentai --- diff --git a/changelog.md b/changelog.md index 53fa25e..09b457c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Fanfix +## Version WIP +- fix some meta data that were missing on e-Hentai + ## Version 1.5.0 - New website supported following a request: e-hentai.org - Library: perf improvement when retrieving the stories (cover not loaded when not needed) diff --git a/src/be/nikiroo/fanfix/supported/EHentai.java b/src/be/nikiroo/fanfix/supported/EHentai.java index eae377c..3636354 100644 --- a/src/be/nikiroo/fanfix/supported/EHentai.java +++ b/src/be/nikiroo/fanfix/supported/EHentai.java @@ -35,15 +35,15 @@ class EHentai extends BasicSupport { meta.setTitle(getTitle(reset(in))); meta.setAuthor(getAuthor(reset(in))); - meta.setDate(""); + meta.setDate(getDate(reset(in))); meta.setTags(getTags(reset(in))); meta.setSource(getSourceName()); meta.setUrl(source.toString()); meta.setPublisher(getSourceName()); meta.setUuid(source.toString()); meta.setLuid(""); - meta.setLang("EN"); - meta.setSubject("Furry"); + meta.setLang(getLang(reset(in))); + meta.setSubject("Hentai"); meta.setType(getType().toString()); meta.setImageDocument(true); meta.setCover(getCover(source, reset(in))); @@ -101,6 +101,45 @@ class EHentai extends BasicSupport { return author; } + private String getLang(InputStream in) { + String lang = null; + + String langLine = getKeyLine(in, "class=\"gdt1\">Language", + "class=\"gdt2\"", ""); + if (langLine != null) { + langLine = StringUtils.unhtml(langLine).trim(); + if (langLine.equalsIgnoreCase("English")) { + lang = "EN"; + } else if (langLine.equalsIgnoreCase("Japanese")) { + lang = "JP"; + } else if (langLine.equalsIgnoreCase("French")) { + lang = "FR"; + } else { + // TODO find the code? + lang = langLine; + } + } + + return lang; + } + + private String getDate(InputStream in) { + String date = null; + + String dateLine = getKeyLine(in, "class=\"gdt1\">Posted", + "class=\"gdt2\"", ""); + if (dateLine != null) { + dateLine = StringUtils.unhtml(dateLine).trim(); + if (dateLine.length() > 10) { + dateLine = dateLine.substring(0, 10).trim(); + } + + date = dateLine; + } + + return date; + } + private List getTags(InputStream in) { List tags = new ArrayList(); List tagsAuthor = getTagsAuthor(in);