separate support name and BasicSupport
[fanfix.git] / src / be / nikiroo / fanfix / supported / YiffStar.java
index 2996ce993770993d18460bcfe4b10c9ddcb8e470..a17253a5762b4199a0f2997361da63f92dd009f1 100644 (file)
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -25,12 +26,6 @@ import be.nikiroo.utils.StringUtils;
  * @author niki
  */
 class YiffStar extends BasicSupport_Deprecated {
-
-       @Override
-       public String getSourceName() {
-               return "YiffStar";
-       }
-
        @Override
        protected MetaData getMeta(URL source, InputStream in) throws IOException {
                MetaData meta = new MetaData();
@@ -39,9 +34,9 @@ class YiffStar extends BasicSupport_Deprecated {
                meta.setAuthor(getAuthor(reset(in)));
                meta.setDate("");
                meta.setTags(getTags(reset(in)));
-               meta.setSource(getSourceName());
+               meta.setSource(getType().getSourceName());
                meta.setUrl(source.toString());
-               meta.setPublisher(getSourceName());
+               meta.setPublisher(getType().getSourceName());
                meta.setUuid(source.toString());
                meta.setLuid("");
                meta.setLang("en");
@@ -206,24 +201,8 @@ class YiffStar extends BasicSupport_Deprecated {
                                                link = source.getProtocol() + "://" + source.getHost()
                                                                + link;
                                        }
-                                       final URL value = guest(link);
-                                       final String key = StringUtils.unhtml(line).trim();
-                                       urls.add(new Entry<String, URL>() {
-                                               @Override
-                                               public URL setValue(URL value) {
-                                                       return null;
-                                               }
-
-                                               @Override
-                                               public URL getValue() {
-                                                       return value;
-                                               }
-
-                                               @Override
-                                               public String getKey() {
-                                                       return key;
-                                               }
-                                       });
+                                       urls.add(new AbstractMap.SimpleEntry<String, URL>(
+                                                       StringUtils.unhtml(line).trim(), guest(link)));
                                }
                        }
                }