Hack-y fixes#115 by manually stripping out decimal separators to parse numbers in a somewhat reliable way. Should work with most locales. Also party fixes#102 or at least until the real date done is given by the qBittorrent web interface.
@ -81,11 +79,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -81,11 +79,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -129,51 +127,52 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -129,51 +127,52 @@ public class QbittorrentAdapter implements IDaemonAdapter {
// Unable to establish version number; assume an old version by setting it to version 1
@ -181,15 +180,16 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -181,15 +180,16 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -201,7 +201,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -201,7 +201,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -222,27 +222,31 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -222,27 +222,31 @@ public class QbittorrentAdapter implements IDaemonAdapter {
}
// We have to make a separate request per file, it seems
@ -265,11 +269,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -265,11 +269,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -282,17 +286,17 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -282,17 +286,17 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -300,17 +304,18 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -300,17 +304,18 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -322,7 +327,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -322,7 +327,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -331,20 +336,9 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -331,20 +336,9 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -352,9 +346,9 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -352,9 +346,9 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -368,14 +362,14 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -368,14 +362,14 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -387,40 +381,27 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -387,40 +381,27 @@ public class QbittorrentAdapter implements IDaemonAdapter {
doubleratio=parseRatio(tor.getString("ratio"));
doubleprogress=tor.getDouble("progress");
intdlspeed=parseSpeed(tor.getString("dlspeed"));
longeta=-1L;
if(dlspeed>0)
eta=(long)(size-(size*progress))/dlspeed;
// Date added is only available in /json/propertiesGeneral on a per-torrent basis, unfortunately
// Add the parsed torrent to the list
torrents.add(newTorrent(
(long)i,
tor.getString("hash"),
tor.getString("name"),
parseStatus(tor.getString("state")),
null,
dlspeed,
parseSpeed(tor.getString("upspeed")),
leechers,
leechers+seeders,
known,
known,
(int)((size-(size*progress))/dlspeed),
(long)(size*progress),
(long)(size*ratio),
size,
(float)progress,
0f,
null,
null,// Only available in /json/propertiesGeneral on a per-torrent basis, unfortunately
// FIXME Hack for issue #115: Strip the possible . and , separators in a hopefully reliable fashion, for now
string=string.replace(",",".");
returnDouble.parseDouble(string);
}catch(Exceptione){
return0D;
@ -431,19 +412,31 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -431,19 +412,31 @@ public class QbittorrentAdapter implements IDaemonAdapter {
// See https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-Documentation
if(string.equals("Unknown"))
return-1;
// Sizes are given in "703.3 MiB"-like string format
// Returns size in B-based long
// Sizes are given in "1,023.3 MiB"-like string format
// FIXME Hack for issue #115: Strip the possible . and , separators in a hopefully reliable fashion, for now
@ -527,25 +520,19 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -527,25 +520,19 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -570,5 +557,5 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -570,5 +557,5 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -142,12 +142,14 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
@@ -142,12 +142,14 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
if(realDateDone!=null){
this.dateDone=realDateDone;
}else{
if(this.partDone==1){//finished but no finished date set so move to bottom of list
if(this.partDone==1){
// Finished but no finished date: set so move to bottom of list