X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FInfoText.java;h=786e771a40c2f8c6cee016c7f0aeb14c2bd365f8;hb=fd25eddc49559d6b0edcc4e2ed5b9bf7869978da;hp=9ede84483aadbae697d2c04b19980fa682fbc945;hpb=62c63b0724f4bc45999cb2e7186b4b3ada479a0a;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/InfoText.java b/src/be/nikiroo/fanfix/supported/InfoText.java index 9ede844..786e771 100644 --- a/src/be/nikiroo/fanfix/supported/InfoText.java +++ b/src/be/nikiroo/fanfix/supported/InfoText.java @@ -6,7 +6,6 @@ import java.io.InputStream; import java.net.URISyntaxException; import java.net.URL; -import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.data.MetaData; /** @@ -27,9 +26,11 @@ class InfoText extends Text { @Override protected MetaData getMeta(URL source, InputStream in) throws IOException { try { - MetaData meta = InfoReader.readMeta( - new File(new File(source.toURI()).getPath() + ".info"), - true); + File sourceFile = new File(source.toURI()); + sourceFile = assureNoTxt(sourceFile); + + MetaData meta = InfoReader.readMeta(new File(sourceFile.getPath() + + ".info"), true); // Some old .info files don't have those now required fields... String test = meta.getTitle() == null ? "" : meta.getTitle(); @@ -53,7 +54,6 @@ class InfoText extends Text { } return meta; - } catch (URISyntaxException e) { throw new IOException("Cannot parse URL to file: " + source, e); } @@ -61,19 +61,6 @@ class InfoText extends Text { @Override protected boolean supports(URL url) { - if ("file".equals(url.getProtocol())) { - File file; - try { - file = new File(url.toURI()); - file = new File(file.getPath() + ".info"); - } catch (URISyntaxException e) { - Instance.getTraceHandler().error(e); - file = null; - } - - return file != null && file.exists(); - } - - return false; + return supports(url, true); } }