@ -80,6 +82,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -80,6 +82,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
privateDaemonSettingssettings;
privateDefaultHttpClienthttpclient;
privateintversion=-1;
privateintapiVersion=-1;
publicQbittorrentAdapter(DaemonSettingssettings){
this.settings=settings;
@ -91,6 +94,22 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -91,6 +94,22 @@ public class QbittorrentAdapter implements IDaemonAdapter {
// We still need to retrieve the version number from the server
// Do this by getting the web interface about page and trying to parse the version number
// Format is something like 'qBittorrent v2.9.7 (Web UI)'
try{
StringapiVerText=makeRequest(log,"/version/api");
apiVersion=Integer.parseInt(apiVerText.trim());
}
catch(DaemonExceptione){
apiVersion=1;
}
catch(NumberFormatExceptione){
apiVersion=1;
}
log.d(LOG_NAME,"qBittorrent API version is "+apiVersion);
// TODO: In API ver 2, query this information from /version/qbittorrent instead.
// For now at least this works fine, though
Stringabout=makeRequest(log,"/about.html");
StringaboutStartText="qBittorrent v";
StringaboutEndText=" (Web UI)";
@ -127,6 +146,42 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -127,6 +146,42 @@ public class QbittorrentAdapter implements IDaemonAdapter {
}
// Unable to establish version number; assume an old version by setting it to version 1
@ -134,18 +189,29 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -134,18 +189,29 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -153,7 +219,8 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -153,7 +219,8 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -374,10 +441,22 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -374,10 +441,22 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -391,7 +470,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -391,7 +470,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
parseStatus(tor.getString("state")),
null,
dlspeed,
parseSpeed(tor.getString("upspeed")),
upspeed,
seeders[0],
seeders[1],
leechers[0],
@ -525,7 +604,14 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -525,7 +604,14 @@ public class QbittorrentAdapter implements IDaemonAdapter {