X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=inline;f=supported%2FInfoText.java;h=771d5102e8a10fb416747eaa18cb2339a75fc321;hb=HEAD;hp=42e2c13b6f75a1e32afa10f560361c1670ea9572;hpb=2e1300b9580ae1b6dded5a734c617a66a116c16d;p=fanfix.git diff --git a/supported/InfoText.java b/supported/InfoText.java deleted file mode 100644 index 42e2c13..0000000 --- a/supported/InfoText.java +++ /dev/null @@ -1,55 +0,0 @@ -package be.nikiroo.fanfix.supported; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -import be.nikiroo.fanfix.data.MetaData; - -/** - * Support class for .info text files ({@link Text} files with a - * .info metadata file next to them). - *
- * The .info file is supposed to be written by this program, or - * compatible. - * - * @author niki - */ -class InfoText extends Text { - protected File getInfoFile() { - return new File(assureNoTxt(getSourceFile()).getPath() + ".info"); - } - - @Override - protected MetaData getMeta() throws IOException { - MetaData meta = InfoReader.readMeta(getInfoFile(), true); - - // Some old .info files don't have those now required fields... - String test = meta.getTitle() == null ? "" : meta.getTitle(); - test += meta.getAuthor() == null ? "" : meta.getAuthor(); - test += meta.getDate() == null ? "" : meta.getDate(); - test += meta.getUrl() == null ? "" : meta.getUrl(); - if (test.isEmpty()) { - MetaData superMeta = super.getMeta(); - if (meta.getTitle() == null || meta.getTitle().isEmpty()) { - meta.setTitle(superMeta.getTitle()); - } - if (meta.getAuthor() == null || meta.getAuthor().isEmpty()) { - meta.setAuthor(superMeta.getAuthor()); - } - if (meta.getDate() == null || meta.getDate().isEmpty()) { - meta.setDate(superMeta.getDate()); - } - if (meta.getUrl() == null || meta.getUrl().isEmpty()) { - meta.setUrl(superMeta.getUrl()); - } - } - - return meta; - } - - @Override - protected boolean supports(URL url) { - return supports(url, true); - } -}