@ -91,7 +100,13 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -91,7 +100,13 @@ public class BitCometAdapter implements IDaemonAdapter {
caseRetrieve:
// Request all torrents from server
Stringresult=makeRequest("/panel/task_list");
// first, check client for the new AJAX interface (BitComet v.1.34 and up)
@ -142,6 +157,42 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -142,6 +157,42 @@ public class BitCometAdapter implements IDaemonAdapter {
returnnewDaemonTaskFailureResult(task,newDaemonException(ExceptionType.MethodUnsupported,task.getMethod()+" is not supported by "+getType()));
}
@ -162,7 +213,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -162,7 +213,7 @@ public class BitCometAdapter implements IDaemonAdapter {
}
/**
*BuildtheURLofthehttprequestfromtheusersettings
*BuildtheURLoftheHTTPrequestfromtheusersettings
*@returnTheURLtorequest
*/
privateStringbuildWebUIUrl(Stringpath){
@ -195,7 +246,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -195,7 +246,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -336,6 +387,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -336,6 +387,7 @@ public class BitCometAdapter implements IDaemonAdapter {
try{
// Find, prepare and split substring with HTML tag TABLE
@ -347,7 +399,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -347,7 +399,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -434,7 +486,149 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -434,7 +486,149 @@ public class BitCometAdapter implements IDaemonAdapter {
// End of a 'transfer' item, add gathered torrent data
sizeDone=(long)(totalSize*progress);
torrents.add(newTorrent(
id,
null,// hash, // we suppose to use simple integer IDs
name,
status,
null,
rateDown,
rateUp,
leechers,
seeders,
seeders+leechers,
seedersTotal+leechersTotal,
(int)((status==TorrentStatus.Downloading&&rateDown!=0)?(totalSize-sizeDone)/rateDown:-1),// eta (in seconds) = (total_size_in_btes - bytes_already_downloaded) / bytes_per_second
sizeDone,
sizeUp,
totalSize,
progress,
0f,
label,
dateAdded,
null));// Not supported in the web interface
id++;// Stop/start/etc. requests are made by ID, which is the order number in the returned XML list :-S
@ -466,7 +660,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -466,7 +660,7 @@ public class BitCometAdapter implements IDaemonAdapter {
settings.getDownloadDir()+fileDetails[3],
size,
sizeDone,
parsePriority(fileDetails[1])));
convertPriority(fileDetails[1])));
}
}
catch(Exceptione){
@ -480,7 +674,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -480,7 +674,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -501,7 +695,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -501,7 +695,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -513,7 +707,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -513,7 +707,7 @@ public class BitCometAdapter implements IDaemonAdapter {
/**
*ParseBitComettorrentstatus
**/
privateTorrentStatusparseStatus(Stringstate){
privateTorrentStatusconvertStatus(Stringstate){
// Status is given as a descriptive string and an indication if the torrent was stopped/paused
if(state.equals("stopped")){
returnTorrentStatus.Paused;
@ -523,6 +717,15 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -523,6 +717,15 @@ public class BitCometAdapter implements IDaemonAdapter {