Browse Source

Uses real 'time added' with rTorrent if user has the seedingtime plugin. (Thanks Tom Briden\!)

pull/11/head
Eric Kok 12 years ago
parent
commit
7712d8229d
  1. 23
      lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java
  2. 2
      lib/src/org/transdroid/daemon/Torrent.java

23
lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

@ -86,7 +86,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
switch (task.getMethod()) { switch (task.getMethod()) {
case Retrieve: case Retrieve:
Object result = makeRtorrentCall("d.multicall", new String[] { "main", "d.get_hash=", "d.get_name=", "d.get_state=", "d.get_down_rate=", "d.get_up_rate=", "d.get_peers_connected=", "d.get_peers_not_connected=", "d.get_peers_accounted=", "d.get_bytes_done=", "d.get_up_total=", "d.get_size_bytes=", "d.get_creation_date=", "d.get_left_bytes=", "d.get_complete=", "d.is_active=", "d.is_hash_checking=", "d.get_base_path=", "d.get_base_filename=", "d.get_message=" }); Object result = makeRtorrentCall("d.multicall", new String[] { "main", "d.get_hash=", "d.get_name=", "d.get_state=", "d.get_down_rate=", "d.get_up_rate=", "d.get_peers_connected=", "d.get_peers_not_connected=", "d.get_peers_accounted=", "d.get_bytes_done=", "d.get_up_total=", "d.get_size_bytes=", "d.get_creation_date=", "d.get_left_bytes=", "d.get_complete=", "d.is_active=", "d.is_hash_checking=", "d.get_base_path=", "d.get_base_filename=", "d.get_message=", "d.get_custom=addtime", "d.get_custom=seedingtime" });
return new RetrieveTaskSuccessResult((RetrieveTask) task, onTorrentsRetrieved(result),null); return new RetrieveTaskSuccessResult((RetrieveTask) task, onTorrentsRetrieved(result),null);
case GetTorrentDetails: case GetTorrentDetails:
@ -278,6 +278,19 @@ public class RtorrentAdapter implements IDaemonAdapter {
Object[] info = (Object[]) responseList[i]; Object[] info = (Object[]) responseList[i];
String error = (String)info[18]; String error = (String)info[18];
error = error.equals("")? null: error; error = error.equals("")? null: error;
Date added = null;
Date finished = null;
if(!((String)info[19]).equals(""))
added = new Date(Long.valueOf(((String)info[19]).trim()));
else
added = new Date((Long)info[11]);
if(!((String)info[20]).equals(""))
finished = new Date(Long.valueOf(((String)info[20]).trim()));
if (info[3] instanceof Long) { if (info[3] instanceof Long) {
// rTorrent uses the i8 dialect which returns 64-bit integers // rTorrent uses the i8 dialect which returns 64-bit integers
@ -303,8 +316,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
((Long)info[8]).floatValue() / ((Long)info[10]).floatValue(), // partDone ((Long)info[8]).floatValue() / ((Long)info[10]).floatValue(), // partDone
0f, // TODO: Add availability data 0f, // TODO: Add availability data
null, // See remark on rTorrent/groups above null, // See remark on rTorrent/groups above
new Date((Long)info[11]), added,
null, finished,
error)); error));
} else { } else {
@ -332,8 +345,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
((Integer)info[8]).floatValue() / ((Integer)info[10]).floatValue(), // partDone ((Integer)info[8]).floatValue() / ((Integer)info[10]).floatValue(), // partDone
0f, // TODO: Add availability data 0f, // TODO: Add availability data
null, // See remark on rTorrent/groups above null, // See remark on rTorrent/groups above
new Date((Integer)info[11]), added,
null, finished,
error)); error));
} }

2
lib/src/org/transdroid/daemon/Torrent.java

@ -142,7 +142,7 @@ public final class Torrent implements Parcelable, Comparable<Torrent> {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
if (eta == -1 || eta == -2) { if (eta == -1 || eta == -2) {
cal.clear(); cal.clear();
cal.set(9999, 12, 31); cal.set(1900, 12, 31);
} else { } else {
cal.add(Calendar.SECOND, eta); cal.add(Calendar.SECOND, eta);
} }

Loading…
Cancel
Save