1 package be
.nikiroo
.fanfix
.supported
;
4 import java
.io
.IOException
;
7 import be
.nikiroo
.fanfix
.data
.MetaData
;
10 * Support class for <tt>.info</tt> text files ({@link Text} files with a
11 * <tt>.info</tt> metadata file next to them).
13 * The <tt>.info</tt> file is supposed to be written by this program, or
18 class InfoText
extends Text
{
20 public String
getSourceName() {
24 protected File
getInfoFile() {
25 return new File(assureNoTxt(getSourceFile()).getPath() + ".info");
29 protected MetaData
getMeta() throws IOException
{
30 MetaData meta
= InfoReader
.readMeta(getInfoFile(), true);
32 // Some old .info files don't have those now required fields...
33 String test
= meta
.getTitle() == null ?
"" : meta
.getTitle();
34 test
+= meta
.getAuthor() == null ?
"" : meta
.getAuthor();
35 test
+= meta
.getDate() == null ?
"" : meta
.getDate();
36 test
+= meta
.getUrl() == null ?
"" : meta
.getUrl();
38 MetaData superMeta
= super.getMeta();
39 if (meta
.getTitle() == null || meta
.getTitle().isEmpty()) {
40 meta
.setTitle(superMeta
.getTitle());
42 if (meta
.getAuthor() == null || meta
.getAuthor().isEmpty()) {
43 meta
.setAuthor(superMeta
.getAuthor());
45 if (meta
.getDate() == null || meta
.getDate().isEmpty()) {
46 meta
.setDate(superMeta
.getDate());
48 if (meta
.getUrl() == null || meta
.getUrl().isEmpty()) {
49 meta
.setUrl(superMeta
.getUrl());
57 protected boolean supports(URL url
) {
58 return supports(url
, true);