@ -85,11 +85,10 @@ public class TorrentDetailsView extends RelativeLayout {
@@ -85,11 +85,10 @@ public class TorrentDetailsView extends RelativeLayout {
@ -467,10 +467,10 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -467,10 +467,10 @@ public class BitCometAdapter implements IDaemonAdapter {
null,
rateDown,
rateUp,
leechers,
seeders,
knownLeechers,
knownSeeders,
leechers,
knownLeechers,
(rateDown==0?-1:(int)((size-sizeDone)/rateDown)),
sizeDone,
sizeUp,
@ -545,10 +545,10 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -545,10 +545,10 @@ public class BitCometAdapter implements IDaemonAdapter {
null,
rateDown,
rateUp,
leechers,
seeders,
seeders+leechers,
seedersTotal+leechersTotal,
seedersTotal,
leechers,
leechersTotal,
(int)((status==TorrentStatus.Downloading&&rateDown!=0)?(totalSize-sizeDone)/rateDown:-1),// eta (in seconds) = (total_size_in_btes - bytes_already_downloaded) / bytes_per_second
@ -107,26 +105,28 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -107,26 +105,28 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -136,40 +136,41 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -136,40 +136,41 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -179,20 +180,21 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -179,20 +180,21 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -200,10 +202,10 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -200,10 +202,10 @@ public class BitfluAdapter implements IDaemonAdapter {
"/"+settings.getOS().getPathSeperator(),
tor.getInt("speed_download"),
tor.getInt("speed_upload"),
0,// 'uploading to'
tor.getInt("active_clients"),
tor.getInt("clients"),
tor.getInt("active_clients"),
tor.getInt("active_clients"),// Bitflu doesn't distinguish between seeders and leechers
tor.getInt("clients"),
tor.getInt("clients"),// Bitflu doesn't distinguish between seeders and leechers
tor.getInt("eta"),
done_bytes,
tor.getLong("uploaded_bytes"),
@ -215,27 +217,28 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -215,27 +217,28 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -245,19 +248,18 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -245,19 +248,18 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -74,74 +72,92 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -74,74 +72,92 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -153,7 +169,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -153,7 +169,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -175,12 +191,12 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -175,12 +191,12 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -194,7 +210,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -194,7 +210,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -211,20 +227,20 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -211,20 +227,20 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -233,9 +249,9 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -233,9 +249,9 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -245,21 +261,23 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -245,21 +261,23 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -268,10 +286,10 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -268,10 +286,10 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
null,
rateDown,
rateUp,
leechers,
leechers+seeders,
known,
known,
seedsConnected,
seedsTotal,
peersConnected,
peersTotal,
(rateDown==0?-1:(int)((size-sizeDone)/rateDown)),
sizeDone,
sizeUp,
@ -283,11 +301,12 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -283,11 +301,12 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -309,7 +328,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -309,7 +328,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -317,6 +336,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -317,6 +336,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
JSONObjectfile=all.getJSONObject(i);
longsize=file.getLong("size");
longsizeDone=file.getLong("done");
// @formatter:off
torrentfiles.add(newTorrentFile(
""+file.getInt("id"),
file.getString("name"),
@ -325,11 +345,12 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -325,11 +345,12 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
size,
sizeDone,
Priority.Normal));
// @formatter:on
}
// Return the list
returntorrentfiles;
}
@Override
@ -341,5 +362,5 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -341,5 +362,5 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -93,8 +93,8 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -93,8 +93,8 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -363,9 +363,9 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -363,9 +363,9 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -125,10 +125,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -125,10 +125,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@ -588,10 +588,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -588,10 +588,10 @@ public class DelugeAdapter implements IDaemonAdapter {
(int)(status==TorrentStatus.Downloading?(total-down)/downRate:-1),// eta (in seconds) = (total_size_in_btes - bytes_already_downloaded) / bytes_per_second
@ -374,9 +374,8 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -374,9 +374,8 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -387,8 +386,8 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -387,8 +386,8 @@ public class QbittorrentAdapter implements IDaemonAdapter {
// Date added is only available in /json/propertiesGeneral on a per-torrent basis, unfortunately
@ -439,41 +438,15 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -439,41 +438,15 @@ public class QbittorrentAdapter implements IDaemonAdapter {
return(long)number;
}
privateintparseKnown(Stringleechs,Stringseeds){
// Peers are given in the "num_leechs":"91 (449)","num_seeds":"6 (27)" strings
// Or sometimes just "num_leechs":"91","num_seeds":"6" strings
// Peers known are in the last () bit of the leechers and seeders
@ -91,34 +89,79 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -91,34 +89,79 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -130,19 +173,19 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -130,19 +173,19 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -150,17 +193,17 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -150,17 +193,17 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -168,35 +211,35 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -168,35 +211,35 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -206,22 +249,26 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -206,22 +249,26 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -229,9 +276,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -229,9 +276,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
task.getMethod()+" is not supported by "+getType()));
}
}catch(DaemonExceptione){
returnnewDaemonTaskFailureResult(task,e);
@ -241,18 +289,22 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -241,18 +289,22 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -260,9 +312,11 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -260,9 +312,11 @@ public class RtorrentAdapter implements IDaemonAdapter {
thrownewDaemonException(ExceptionType.ConnectionError,"Error making call to "+serverMethod+" with params ["+(params.length()>100?params.substring(0,100)+"...":params)+" ]: "+e.toString());
thrownewDaemonException(ExceptionType.ConnectionError,"Error making call to "+serverMethod
+" with params ["+(params.length()>100?params.substring(0,100)+"...":params)+" ]: "
+e.toString());
}
}
/**
@ -274,37 +328,42 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -274,37 +328,42 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -319,11 +378,11 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -319,11 +378,11 @@ public class RtorrentAdapter implements IDaemonAdapter {
else{
// rTorrent didn't have the addtime (missing plugin?): base it on creationtime instead
if(info[11]instanceofLong)
added=newDate((Long)info[11]*1000L);
added=newDate((Long)info[11]*1000L);
else
added=newDate((Integer)info[11]*1000L);
added=newDate((Integer)info[11]*1000L);
}
// Determine the seeding time
Datefinished=null;
Longseedingtime=null;
@ -335,26 +394,27 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -335,26 +394,27 @@ public class RtorrentAdapter implements IDaemonAdapter {
if(seedingtime!=null)
// Successfully received the seedingtime from rTorrent (which is a String like '1337089336\n')
// rTorrent uses the i8 dialect which returns 64-bit integers
longrateDownload=(Long)info[3];
StringbasePath=(String)info[16];
longrateDownload=(Long)info[3];
StringbasePath=(String)info[16];
// @formatter:off
torrents.add(newTorrent(
i,
(String)info[0],// hash
@ -363,10 +423,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -363,10 +423,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
(rateDownload>0?(int)(((Long)info[12])/rateDownload):-1),// eta (bytes left / rate download, if rate > 0)
(Long)info[8],// downloadedEver
(Long)info[9],// uploadedEver
@ -378,13 +438,15 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -378,13 +438,15 @@ public class RtorrentAdapter implements IDaemonAdapter {
finished,
error,
settings.getType()));
// @formatter:on
}else{
// rTorrent uses the default dialect with 32-bit integers
intrateDownload=(Integer)info[3];
StringbasePath=(String)info[16];
intrateDownload=(Integer)info[3];
StringbasePath=(String)info[16];
// @formatter:off
torrents.add(newTorrent(
i,
(String)info[0],// hash
@ -393,10 +455,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -393,10 +455,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
(rateDownload>0?(int)((Integer)info[12]/rateDownload):-1),// eta (bytes left / rate download, if rate > 0)
(Integer)info[8],// downloadedEver
(Integer)info[9],// uploadedEver
@ -408,7 +470,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -408,7 +470,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
finished,
error,
settings.getType()));
// @formatter:on
}
}
lastKnownLabels=newArrayList<Label>();
@ -417,34 +480,36 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -417,34 +480,36 @@ public class RtorrentAdapter implements IDaemonAdapter {
// rTorrent uses the i8 dialect which returns 64-bit integers
Longsize=(Long)info[1];
LongchunksDone=(Long)info[3];
LongchunksTotal=(Long)info[4];
Longpriority=(Long)info[5];
Longsize=(Long)info[1];
LongchunksDone=(Long)info[3];
LongchunksTotal=(Long)info[4];
Longpriority=(Long)info[5];
// @formatter:off
files.add(newTorrentFile(
""+i,
(String)info[0],// name
@ -453,16 +518,17 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -453,16 +518,17 @@ public class RtorrentAdapter implements IDaemonAdapter {
// rTorrent uses the default dialect with 32-bit integers
Integersize=(Integer)info[1];
IntegerchunksDone=(Integer)info[3];
IntegerchunksTotal=(Integer)info[4];
Integerpriority=(Integer)info[5];
Integersize=(Integer)info[1];
IntegerchunksDone=(Integer)info[3];
IntegerchunksTotal=(Integer)info[4];
Integerpriority=(Integer)info[5];
// @formatter:off
files.add(newTorrentFile(
""+i,
(String)info[0],// name
@ -471,14 +537,14 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -471,14 +537,14 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -522,29 +588,30 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -522,29 +588,30 @@ public class RtorrentAdapter implements IDaemonAdapter {
"Response on retrieveing trackers did not return a list of objects");
}else{
// Parse a torrent's trackers from response
// Formatted as Object[][], see http://libtorrent.rakshasa.no/wiki/RTorrentCommands#Download
List<String>trackers=newArrayList<String>();
Object[]responseList=(Object[])response;
try{
for(inti=0;i<responseList.length;i++){
Object[]info=(Object[])responseList[i];
trackers.add((String)info[0]);
}
for(inti=0;i<responseList.length;i++){
Object[]info=(Object[])responseList[i];
trackers.add((String)info[0]);
}
}catch(Exceptione){
DLog.e(LOG_NAME,e.toString());
}
returnnewTorrentDetails(trackers,null);
}
}
@Override
@ -556,5 +623,5 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -556,5 +623,5 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -294,14 +294,15 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -294,14 +294,15 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -313,10 +314,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -313,10 +314,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -36,15 +34,15 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -36,15 +34,15 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
finalprivateStringname;
privateTorrentStatusstatusCode;
privateStringlocationDir;
finalprivateintrateDownload;
finalprivateintrateUpload;
finalprivateintpeersGettingFromUs;
finalprivateintpeersSendingToUs;
finalprivateintpeersConnected;
finalprivateintpeersKnown;
finalprivateintseedersConnected;
finalprivateintseedersKnown;
finalprivateintleechersConnected;
finalprivateintleechersKnown;
finalprivateinteta;
finalprivatelongdownloadedEver;
finalprivatelonguploadedEver;
finalprivatelongtotalSize;
@ -56,48 +54,22 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -56,48 +54,22 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@ -106,38 +78,38 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -106,38 +78,38 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@ -160,7 +132,87 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -160,7 +132,87 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@ -174,11 +226,11 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -174,11 +226,11 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@ -258,7 +310,8 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -258,7 +310,8 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
*/
publicbooleancanStop(){
// Can stop when it is downloading or seeding or paused
@ -288,7 +341,7 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -288,7 +341,7 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
publicvoidmimicNewLabel(StringnewLabel){
label=newLabel;
}
publicvoidmimicCheckingStatus(){
statusCode=TorrentStatus.Checking;
}
@ -296,34 +349,34 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -296,34 +349,34 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@ -334,12 +387,12 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -334,12 +387,12 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
dest.writeInt(rateDownload);
dest.writeInt(rateUpload);
dest.writeInt(peersGettingFromUs);
dest.writeInt(peersSendingToUs);
dest.writeInt(peersConnected);
dest.writeInt(peersKnown);
dest.writeInt(seedersConnected);
dest.writeInt(seedersKnown);
dest.writeInt(leechersConnected);
dest.writeInt(leechersKnown);
dest.writeInt(eta);
dest.writeLong(downloadedEver);
dest.writeLong(uploadedEver);
dest.writeLong(totalSize);
@ -347,10 +400,10 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -347,10 +400,10 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@ -95,7 +95,6 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -95,7 +95,6 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -504,9 +503,9 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -504,9 +503,9 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -516,9 +516,9 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -516,9 +516,9 @@ public class UtorrentAdapter implements IDaemonAdapter {