git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add test files
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
supported
/
Fanfiction.java
diff --git
a/src/be/nikiroo/fanfix/supported/Fanfiction.java
b/src/be/nikiroo/fanfix/supported/Fanfiction.java
index a73f7dee497142ee3af31212ca04b5c1f52c2211..0feb9641be2f2ea85f896c9b21da2511c6d3a8b5 100644
(file)
--- a/
src/be/nikiroo/fanfix/supported/Fanfiction.java
+++ b/
src/be/nikiroo/fanfix/supported/Fanfiction.java
@@
-1,6
+1,5
@@
package be.nikiroo.fanfix.supported;
package be.nikiroo.fanfix.supported;
-import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@
-15,6
+14,8
@@
import java.util.Scanner;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.data.MetaData;
+import be.nikiroo.utils.Image;
+import be.nikiroo.utils.Progress;
import be.nikiroo.utils.StringUtils;
/**
import be.nikiroo.utils.StringUtils;
/**
@@
-24,7
+25,7
@@
import be.nikiroo.utils.StringUtils;
*
* @author niki
*/
*
* @author niki
*/
-class Fanfiction extends BasicSupport {
+class Fanfiction extends BasicSupport
_Deprecated
{
@Override
protected boolean isHtml() {
return true;
@Override
protected boolean isHtml() {
return true;
@@
-73,7
+74,7
@@
class Fanfiction extends BasicSupport {
return null;
}
return null;
}
- private List<String> getTags(InputStream in)
throws IOException
{
+ private List<String> getTags(InputStream in) {
List<String> tags = new ArrayList<String>();
String key = "title=\"Send Private Message\"";
List<String> tags = new ArrayList<String>();
String key = "title=\"Send Private Message\"";
@@
-141,7
+142,7
@@
class Fanfiction extends BasicSupport {
}
}
}
}
- return fixAuthor(author);
+ return
BasicSupportHelper.
fixAuthor(author);
}
private String getDate(InputStream in) {
}
private String getDate(InputStream in) {
@@
-160,8
+161,10
@@
class Fanfiction extends BasicSupport {
return sdf
.format(new Date(1000 * Long.parseLong(line)));
} catch (NumberFormatException e) {
return sdf
.format(new Date(1000 * Long.parseLong(line)));
} catch (NumberFormatException e) {
- Instance.syserr(new IOException(
- "Cannot convert publication date: " + line, e));
+ Instance.getTraceHandler().error(
+ new IOException(
+ "Cannot convert publication date: "
+ + line, e));
}
}
}
}
}
}
@@
-175,7
+178,7
@@
class Fanfiction extends BasicSupport {
return getLine(in, "title=\"Send Private Message\"", 1);
}
return getLine(in, "title=\"Send Private Message\"", 1);
}
- private
Buffered
Image getCover(URL url, InputStream in) {
+ private Image getCover(URL url, InputStream in) {
String key = "class='cimage";
String line = getLine(in, key, 0);
if (line != null) {
String key = "class='cimage";
String line = getLine(in, key, 0);
if (line != null) {
@@
-210,7
+213,8
@@
class Fanfiction extends BasicSupport {
}
@Override
}
@Override
- protected List<Entry<String, URL>> getChapters(URL source, InputStream in) {
+ protected List<Entry<String, URL>> getChapters(URL source, InputStream in,
+ Progress pg) {
List<Entry<String, URL>> urls = new ArrayList<Entry<String, URL>>();
String base = source.toString();
List<Entry<String, URL>> urls = new ArrayList<Entry<String, URL>>();
String base = source.toString();
@@
-243,22
+247,27
@@
class Fanfiction extends BasicSupport {
final String chapName = name.trim();
final URL chapURL = new URL(base + i + suffix);
urls.add(new Entry<String, URL>() {
final String chapName = name.trim();
final URL chapURL = new URL(base + i + suffix);
urls.add(new Entry<String, URL>() {
+ @Override
public URL setValue(URL value) {
return null;
}
public URL setValue(URL value) {
return null;
}
+ @Override
public URL getValue() {
return chapURL;
}
public URL getValue() {
return chapURL;
}
+ @Override
public String getKey() {
return chapName;
}
});
} catch (MalformedURLException e) {
public String getKey() {
return chapName;
}
});
} catch (MalformedURLException e) {
- Instance.syserr(new IOException(
- "Cannot parse chapter " + i + " url: "
- + (base + i + suffix), e));
+ Instance.getTraceHandler()
+ .error(new IOException(
+ "Cannot parse chapter " + i
+ + " url: "
+ + (base + i + suffix), e));
}
}
}
}
}
}
@@
-268,14
+277,17
@@
class Fanfiction extends BasicSupport {
final String chapName = getTitle(reset(in));
final URL chapURL = source;
urls.add(new Entry<String, URL>() {
final String chapName = getTitle(reset(in));
final URL chapURL = source;
urls.add(new Entry<String, URL>() {
+ @Override
public URL setValue(URL value) {
return null;
}
public URL setValue(URL value) {
return null;
}
+ @Override
public URL getValue() {
return chapURL;
}
public URL getValue() {
return chapURL;
}
+ @Override
public String getKey() {
return chapName;
}
public String getKey() {
return chapName;
}
@@
-286,7
+298,8
@@
class Fanfiction extends BasicSupport {
}
@Override
}
@Override
- protected String getChapterContent(URL source, InputStream in, int number) {
+ protected String getChapterContent(URL source, InputStream in, int number,
+ Progress pg) {
StringBuilder builder = new StringBuilder();
String startAt = "class='storytext ";
String endAt1 = "function review_init";
StringBuilder builder = new StringBuilder();
String startAt = "class='storytext ";
String endAt1 = "function review_init";
@@
-329,6
+342,7
@@
class Fanfiction extends BasicSupport {
}
builder.append(line);
}
builder.append(line);
+ builder.append(' ');
}
}
}
}