Merge branch 'subtree'
authorNiki Roo <niki@nikiroo.be>
Fri, 1 May 2020 11:29:33 +0000 (13:29 +0200)
committerNiki Roo <niki@nikiroo.be>
Fri, 1 May 2020 11:29:33 +0000 (13:29 +0200)
src/be/nikiroo/fanfix/library/CacheLibrary.java
src/be/nikiroo/fanfix/supported/E621.java

index 92e4ae7a9951ec9715dc5faa9271bae362412dbf..a3c3b5e3b7bb6f5a61962e8837158e28692feb56 100644 (file)
@@ -67,6 +67,7 @@ public class CacheLibrary extends BasicLibrary {
                        pg = new Progress();
                }
 
+               List<MetaData> copy;
                synchronized (metasLock) {
                        // We make sure that cached metas have precedence
                        if (metasMixed == null) {
@@ -86,10 +87,12 @@ public class CacheLibrary extends BasicLibrary {
                                        }
                                }
                        }
+
+                       copy = new ArrayList<MetaData>(metasMixed);
                }
 
                pg.done();
-               return new ArrayList<MetaData>(metasMixed);
+               return copy;
        }
 
        @Override
@@ -404,9 +407,7 @@ public class CacheLibrary extends BasicLibrary {
 
                MetaData meta = lib.imprt(url, pgImprt);
                updateMetaCache(metasReal, meta);
-               synchronized (metasLock) {
-                       metasMixed = null;
-               }
+               metasMixed = null;
 
                clearFromCache(meta.getLuid());
 
index 602cd36309250e03de7291c4f46784b7171ccc93..c0125fb3f107087f170f8d2d8e6c718cb5253e87 100644 (file)
@@ -292,6 +292,22 @@ class E621 extends BasicSupport {
                                        builder.append(" ").append(tab[i]);
                                }
                        }
+
+                       if (builder.length() == 0) {
+                               String url = "https://e621.net/" + getSource().getPath()
+                                               + "?page=1";
+                               Document page1 = DataUtil.load(Instance.getInstance().getCache()
+                                               .open(getSource(), this, false), "UTF-8",
+                                               url.toString());
+                               for (Element el : page1.getElementsByClass("search-tag")) {
+                                       if (el.attr("itemprop").equals("author")) {
+                                               if (builder.length() > 0) {
+                                                       builder.append(", ");
+                                               }
+                                               builder.append(el.text().trim());
+                                       }
+                               }
+                       }
                }
 
                return builder.toString();