From: Niki Roo Date: Sun, 18 Jun 2017 18:49:13 +0000 (+0200) Subject: FimFiction: Fix tags and chapter handling X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=e1168b3cca916ab8adccfac1a3bce0f98e25bb07;p=nikiroo-utils.git FimFiction: Fix tags and chapter handling --- diff --git a/VERSION b/VERSION index 4cda8f1..8af85be 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.2 +1.5.3 diff --git a/changelog.md b/changelog.md index 8c7e658..f399def 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Fanfix +## Version 1.5.3 +- FimFiction: Fix tags and chapter handling for some stories + ## Version 1.5.2 - Fix tags metadata on FimFiction 4 diff --git a/src/be/nikiroo/fanfix/Library.java b/src/be/nikiroo/fanfix/Library.java index f1f7121..80a9e8c 100644 --- a/src/be/nikiroo/fanfix/Library.java +++ b/src/be/nikiroo/fanfix/Library.java @@ -430,8 +430,8 @@ public class Library { * * @param luid * the {@link Story} LUID - * @param newSourcethe - * new source + * @param newType + * the new type * * @return TRUE if the {@link Story} was found */ diff --git a/src/be/nikiroo/fanfix/supported/Fimfiction.java b/src/be/nikiroo/fanfix/supported/Fimfiction.java index 45455b6..08d1712 100644 --- a/src/be/nikiroo/fanfix/supported/Fimfiction.java +++ b/src/be/nikiroo/fanfix/supported/Fimfiction.java @@ -83,13 +83,23 @@ class Fimfiction extends BasicSupport { break; // end of *this story* tags } - String tab[] = line.split("
  • "); - for (String subline : tab) { - subline = StringUtils.unhtml(subline).trim(); - if (!subline.isEmpty() && !tags.contains(subline)) { - tags.add(subline); + String keyword = "title=\""; + Scanner tagScanner = new Scanner(line); + tagScanner.useDelimiter(keyword); + if (tagScanner.hasNext()) { + tagScanner.next();// Ignore first one + } + while (tagScanner.hasNext()) { + String tag = tagScanner.next(); + if (tag.contains("\"")) { + tag = tag.split("\"")[0]; + tag = StringUtils.unhtml(tag).trim(); + if (!tag.isEmpty() && !tags.contains(tag)) { + tags.add(tag); + } } } + tagScanner.close(); } } @@ -198,7 +208,8 @@ class Fimfiction extends BasicSupport { break; } - if (line.startsWith("');