X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FInfoText.java;fp=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FInfoText.java;h=a627714a057eadf781c52558f249664756360912;hp=0000000000000000000000000000000000000000;hb=08fe2e33007063e30fe22dc1d290f8afaa18eb1d;hpb=ed48062ebfb0d611b74834e313bfb0a2b81416e6 diff --git a/src/be/nikiroo/fanfix/supported/InfoText.java b/src/be/nikiroo/fanfix/supported/InfoText.java new file mode 100644 index 0000000..a627714 --- /dev/null +++ b/src/be/nikiroo/fanfix/supported/InfoText.java @@ -0,0 +1,248 @@ +package be.nikiroo.fanfix.supported; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.List; + +import be.nikiroo.fanfix.Instance; + +/** + * 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 {
+ @Override
+ public String getSourceName() {
+ return "info-text";
+ }
+
+ @Override
+ protected String getTitle(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "TITLE");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getTitle(source, in);
+ }
+
+ @Override
+ protected String getAuthor(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "AUTHOR");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getAuthor(source, in);
+ }
+
+ @Override
+ protected String getDate(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "DATE");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getDate(source, in);
+ }
+
+ @Override
+ protected String getSubject(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "SUBJECT");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getSubject(source, in);
+ }
+
+ @Override
+ protected String getLang(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "LANG");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getLang(source, in);
+ }
+
+ @Override
+ protected String getPublisher(URL source, InputStream in)
+ throws IOException {
+ String tag = getInfoTag(source, "PUBLISHER");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getPublisher(source, in);
+ }
+
+ @Override
+ protected String getUuid(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "UUID");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getUuid(source, in);
+ }
+
+ @Override
+ protected String getLuid(URL source, InputStream in) throws IOException {
+ String tag = getInfoTag(source, "LUID");
+ if (tag != null) {
+ return tag;
+ }
+
+ return super.getLuid(source, in);
+ }
+
+ @Override
+ protected List