Update nikiroo-utils, remove Instance.syserr/trace
[fanfix.git] / src / be / nikiroo / fanfix / supported / Epub.java
index 6819ec29e272f1ee319fdf69da893b8d20855a77..ad4d65f5a4c180b8d68db15e4d0d0a860e72cfdd 100644 (file)
@@ -6,6 +6,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map.Entry;
@@ -127,7 +128,7 @@ class Epub extends InfoText {
                                                try {
                                                        cover = ImageUtils.fromStream(zipIn);
                                                } catch (Exception e) {
-                                                       Instance.syserr(e);
+                                                       Instance.getTraceHandler().error(e);
                                                }
                                        }
                                } else if (entry.getName().equals(getDataPrefix() + "URL")) {
@@ -180,6 +181,14 @@ class Epub extends InfoText {
                        }
                        tmpInfo.delete();
                } else {
+                       if (title == null || title.isEmpty()) {
+                               title = new File(source.getPath()).getName();
+                               if (title.toLowerCase().endsWith(".cbz")) {
+                                       title = title.substring(0, title.length() - 4);
+                               }
+                               title = URLDecoder.decode(title, "UTF-8").trim();
+                       }
+
                        meta = new MetaData();
                        meta.setLang("EN");
                        meta.setTags(new ArrayList<String>());