* i2psnark:

- Show comment metadata on details page
   - Fix rar icon
   - Escape [] in URLs, chrome doesn't do it for us
   - Tweak column spacing
This commit is contained in:
zzz
2013-06-28 12:19:56 +00:00
parent eb5a23fc5b
commit 726eb58724
5 changed files with 100 additions and 5 deletions

View File

@@ -62,6 +62,9 @@ public class MetaInfo
private final long length;
private final boolean privateTorrent;
private final List<List<String>> announce_list;
private final String comment;
private final String created_by;
private final long creation_date;
private Map<String, BEValue> infoMap;
/**
@@ -87,6 +90,9 @@ public class MetaInfo
this.length = length;
this.privateTorrent = privateTorrent;
this.announce_list = announce_list;
this.comment = null;
this.created_by = null;
this.creation_date = 0;
// TODO if we add a parameter for other keys
//if (other != null) {
@@ -162,6 +168,32 @@ public class MetaInfo
}
}
// misc. optional top-level stuff
val = m.get("comment");
String st = null;
if (val != null) {
try {
st = val.getString();
} catch (InvalidBEncodingException ibee) {}
}
this.comment = st;
val = m.get("created by");
st = null;
if (val != null) {
try {
st = val.getString();
} catch (InvalidBEncodingException ibee) {}
}
this.created_by = st;
val = m.get("creation date");
long time = 0;
if (val != null) {
try {
time = val.getLong() * 1000;
} catch (InvalidBEncodingException ibee) {}
}
this.creation_date = time;
val = m.get("info");
if (val == null)
throw new InvalidBEncodingException("Missing info map");
@@ -381,6 +413,33 @@ public class MetaInfo
return lengths;
}
/**
* The comment string or null.
* Not available for locally-created torrents.
* @since 0.9.7
*/
public String getComment() {
return this.comment;
}
/**
* The created-by string or null.
* Not available for locally-created torrents.
* @since 0.9.7
*/
public String getCreatedBy() {
return this.created_by;
}
/**
* The creation date (ms) or zero.
* Not available for locally-created torrents.
* @since 0.9.7
*/
public long getCreationDate() {
return this.creation_date;
}
/**
* Returns the number of pieces.
*/