integrated the torrent parser

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6547 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent bd32f8b8cb
commit fbd24c2d84

@ -56,6 +56,7 @@ import net.yacy.document.parser.rtfParser;
import net.yacy.document.parser.sevenzipParser;
import net.yacy.document.parser.swfParser;
import net.yacy.document.parser.tarParser;
import net.yacy.document.parser.torrentParser;
import net.yacy.document.parser.vcfParser;
import net.yacy.document.parser.vsdParser;
import net.yacy.document.parser.xlsParser;
@ -101,6 +102,7 @@ public final class TextParser {
initParser(new sevenzipParser());
initParser(new swfParser());
initParser(new tarParser());
initParser(new torrentParser());
initParser(new vcfParser());
initParser(new vsdParser());
initParser(new xlsParser());
@ -109,6 +111,7 @@ public final class TextParser {
public static Set<Idiom> idioms() {
Set<Idiom> c = new HashSet<Idiom>();
c.addAll(ext2parser.values());
c.addAll(mime2parser.values());
return c;
}

@ -59,8 +59,9 @@ public class torrentParser extends AbstractParser implements Idiom {
public static final Set<String> SUPPORTED_EXTENSIONS = new HashSet<String>();
static {
SUPPORTED_EXTENSIONS.add("torrent");
SUPPORTED_MIME_TYPES.add("application/x-bittorrent");
}
public torrentParser() {
super("Torrent Metadata Parser");
}
@ -92,7 +93,8 @@ public class torrentParser extends AbstractParser implements Idiom {
List<BObject> filelist = info.get("files").getList();
StringBuilder filenames = new StringBuilder(40 * filelist.size());
for (BObject fo: filelist) {
filenames.append(fo.getMap().get("path").getList().get(0).toString()).append(" ");
List<BObject> l = fo.getMap().get("path").getList(); // one file may have several names
for (BObject fl: l) filenames.append(fl.toString()).append(" ");
}
String name = info.get("name").getString();
try {

Loading…
Cancel
Save