Fix name of imported cbz, fix library check
[fanfix.git] / src / be / nikiroo / fanfix / supported / Epub.java
index 6819ec29e272f1ee319fdf69da893b8d20855a77..b8c4af073805e5be8866213d4036936696bb334d 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;
@@ -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>());