FimFiction: Fix tags and chapter handling fanfix-1.5.3
authorNiki Roo <niki@nikiroo.be>
Sun, 18 Jun 2017 18:49:13 +0000 (20:49 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 18 Jun 2017 18:49:13 +0000 (20:49 +0200)
VERSION
changelog.md
src/be/nikiroo/fanfix/Library.java
src/be/nikiroo/fanfix/supported/Fimfiction.java

diff --git a/VERSION b/VERSION
index 4cda8f19edc7ffa01ba13d5dbe4909a6dc2ce3c8..8af85beb5159909f7df13705826e8c937f2b050b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.5.2
+1.5.3
index 8c7e65873e50d814f47c5ec9edd2c54f43c7f296..f399defa426c51c6bf878da54f230a43feb005ec 100644 (file)
@@ -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
 
index f1f7121385faeab1bae5ba686dbdcf2fce993ae5..80a9e8c54231d995a8ff89ed2e6a2a1628b409af 100644 (file)
@@ -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
         */
index 45455b610f2a05193746e4e8bffcf0163d10e55a..08d1712e9f4aa2ccebb8f8e07e1bb49085340bc4 100644 (file)
@@ -83,13 +83,23 @@ class Fimfiction extends BasicSupport {
                                        break; // end of *this story* tags
                                }
 
-                               String tab[] = line.split("<li>");
-                               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("<a href=")) {
+                               if (line.startsWith("<a href=")
+                                               || line.contains("class=\"chapter-title\"")) {
                                        // Chapter name
                                        String name = line;
                                        int pos = name.indexOf('>');