- protected String getLang(URL source, InputStream in) throws IOException {
- @SuppressWarnings("resource")
- Scanner scan = new Scanner(in, "UTF-8");
+ protected MetaData getMeta() throws IOException {
+ MetaData meta = new MetaData();
+
+ meta.setTitle(getTitle());
+ meta.setAuthor(getAuthor());
+ meta.setDate(bsHelper.formatDate(getDate()));
+ meta.setTags(new ArrayList<String>());
+ meta.setSource(getType().getSourceName());
+ meta.setUrl(getSourceFile().toURI().toURL().toString());
+ meta.setPublisher("");
+ meta.setUuid(getSourceFile().toString());
+ meta.setLuid("");
+ meta.setLang(getLang()); // default is EN
+ meta.setSubject(getSourceFile().getParentFile().getName());
+ meta.setType(getType().toString());
+ meta.setImageDocument(false);
+ meta.setCover(getCover(getSourceFile()));
+
+ return meta;
+ }
+
+ private String getLang() {
+ @SuppressWarnings("resource") // cannot close, or we loose getInput()!
+ Scanner scan = new Scanner(getInput(), "UTF-8");