import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
}
for (int i = 1; i <= last; i++) {
- final String key = Integer.toString(i);
- final URL value = new URL(source.toString() + "?page=" + i);
- urls.add(new Entry<String, URL>() {
- @Override
- public URL setValue(URL value) {
- return null;
- }
-
- @Override
- public URL getValue() {
- return value;
- }
-
- @Override
- public String getKey() {
- return key;
- }
- });
+ urls.add(new AbstractMap.SimpleEntry<String, URL>(Integer
+ .toString(i), new URL(source.toString() + "?page=" + i)));
}
return urls;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
}
for (int i = 0; i <= last; i++) {
- final String key = Integer.toString(i + 1);
- final URL value = new URL(source.toString() + "?p=" + i);
- urls.add(new Entry<String, URL>() {
- @Override
- public URL setValue(URL value) {
- return null;
- }
-
- @Override
- public URL getValue() {
- return value;
- }
-
- @Override
- public String getKey() {
- return key;
- }
- });
+ urls.add(new AbstractMap.SimpleEntry<String, URL>(Integer
+ .toString(i + 1), new URL(source.toString() + "?p=" + i)));
}
return urls;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
meta.setPublisher(getSourceName());
meta.setUuid(source.toString());
meta.setLuid("");
- meta.setLang("en"); //TODO!
+ meta.setLang("en"); // TODO!
meta.setSubject(getSubject(reset(in)));
meta.setType(getType().toString());
meta.setImageDocument(false);
}
try {
- 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;
- }
-
- @Override
- public URL getValue() {
- return chapURL;
- }
-
- @Override
- public String getKey() {
- return chapName;
- }
- });
+ urls.add(new AbstractMap.SimpleEntry<String, URL>(
+ name.trim(), new URL(base + i + suffix)));
} catch (MalformedURLException e) {
Instance.getTraceHandler()
.error(new IOException(
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
}
try {
- final String key = name;
- final URL value = new URL("http://www.fimfiction.net"
- + line);
- urls.add(new Entry<String, URL>() {
- @Override
- public URL setValue(URL value) {
- return null;
- }
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public URL getValue() {
- return value;
- }
- });
+ urls.add(new AbstractMap.SimpleEntry<String, URL>(name,
+ new URL("http://www.fimfiction.net" + line)));
} catch (MalformedURLException e) {
Instance.getTraceHandler().error(e);
}
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.TreeMap;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.Config;
meta.setSubject("MLP");
meta.setType(getType().toString());
meta.setImageDocument(false);
-
- String coverImageLink =
- getKeyJson(json, 0, "type", "story", "cover_image", "full");
+
+ String coverImageLink = getKeyJson(json, 0, "type", "story",
+ "cover_image", "full");
if (!coverImageLink.trim().isEmpty()) {
meta.setCover(getImage(this, null, coverImageLink.trim()));
}
@Override
protected List<Entry<String, URL>> getChapters(URL source, InputStream in,
Progress pg) {
- List<Entry<String, URL>> urls = new ArrayList<Entry<String, URL>>();
-
- chapterNames = new HashMap<Integer, String>();
- chapterContents = new HashMap<Integer, String>();
+ chapterNames = new TreeMap<Integer, String>();
+ chapterContents = new TreeMap<Integer, String>();
int pos = 0;
while (pos >= 0) {
final String title = getKeyJson(json, pos, "title");
String notes = getKeyJson(json, pos, "authors_note_html");
String content = getKeyJson(json, pos, "content_html");
-
+
if (!notes.trim().isEmpty()) {
notes = "<br/>* * *<br/>" + notes;
}
-
+
chapterNames.put(number, title);
- chapterContents
- .put(number, content + notes);
-
- urls.add(new Entry<String, URL>() {
- @Override
- public URL setValue(URL value) {
- return null;
- }
-
- @Override
- public String getKey() {
- return title;
- }
-
- @Override
- public URL getValue() {
- return null;
- }
- });
+ chapterContents.put(number, content + notes);
}
}
+ List<Entry<String, URL>> urls = new ArrayList<Entry<String, URL>>();
+ for (String title : chapterNames.values()) {
+ urls.add(new AbstractMap.SimpleEntry(title, null));
+ }
+
return urls;
}
result = wip.substring(0, pos);
}
}
-
- result = result.replace("\\t", "\t")
- .replace("\\\"", "\"");
-
+
+ result = result.replace("\\t", "\t").replace("\\\"", "\"");
+
return result;
}
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
link = source.getProtocol() + "://" + source.getHost()
+ link;
}
- final URL value = guest(link);
- final String key = StringUtils.unhtml(line).trim();
- urls.add(new Entry<String, URL>() {
- @Override
- public URL setValue(URL value) {
- return null;
- }
-
- @Override
- public URL getValue() {
- return value;
- }
-
- @Override
- public String getKey() {
- return key;
- }
- });
+ urls.add(new AbstractMap.SimpleEntry<String, URL>(
+ StringUtils.unhtml(line).trim(), guest(link)));
}
}
}