X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FHtml.java;h=900fa0a1772f0ffd5ecfcaf2fecfbd8b248168a0;hb=d66deb8d8b30cff6b54db352eef34a3508939f84;hp=1e960bf84978bf1125aececd6d59a47eff38f9f9;hpb=41c3bba7f6fc6f5ec1fa7fe35643c6aace94240d;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/supported/Html.java b/src/be/nikiroo/fanfix/supported/Html.java index 1e960bf..900fa0a 100644 --- a/src/be/nikiroo/fanfix/supported/Html.java +++ b/src/be/nikiroo/fanfix/supported/Html.java @@ -15,14 +15,33 @@ import be.nikiroo.fanfix.Instance; */ class Html extends InfoText { @Override - public String getSourceName() { - return "html"; + protected boolean supports(URL url) { + try { + File txt = getTxt(url); + if (txt != null) { + return super.supports(txt.toURI().toURL()); + } + } catch (MalformedURLException e) { + } + + return false; } @Override - protected boolean supports(URL url) { - File txt = getTxt(url); - return txt != null && txt.exists(); + protected File getInfoFile() { + File source = getSourceFile(); + if ("index.html".equals(source.getName())) { + source = source.getParentFile(); + } + + String src = source.getPath(); + File infoFile = new File(src + ".info"); + if (!infoFile.exists() && src.endsWith(".txt")) { + infoFile = new File( + src.substring(0, src.length() - ".txt".length()) + ".info"); + } + + return infoFile; } @Override @@ -32,13 +51,9 @@ class Html extends InfoText { try { source = txt.toURI().toURL(); } catch (MalformedURLException e) { - Instance.getTraceHandler().error( - new IOException("Cannot convert the right URL for " - + source, e)); + Instance.getInstance().getTraceHandler() + .error(new IOException("Cannot convert the right URL for " + source, e)); } - } else { - Instance.getTraceHandler().error( - new IOException("Cannot find the right URL for " + source)); } return source;