Browse Source

Fix torrent status parsing for BitComet.

pull/621/head
wxhere 2 years ago
parent
commit
35e9f4734d
  1. 16
      app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java

16
app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java

@ -1,4 +1,4 @@
/* /*
* This file is part of Transdroid <http://www.transdroid.org> * This file is part of Transdroid <http://www.transdroid.org>
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
@ -592,6 +592,12 @@ public class BitCometAdapter implements IDaemonAdapter {
// End of a 'transfer' item, add gathered torrent data // End of a 'transfer' item, add gathered torrent data
sizeDone = (long) (totalSize * progress); sizeDone = (long) (totalSize * progress);
// Fix seeding status for completed torrents
if (status == TorrentStatus.Downloading && progress >= 1) {
status = TorrentStatus.Seeding;
}
// @formatter:off // @formatter:off
torrents.add(new Torrent( torrents.add(new Torrent(
id, id,
@ -656,10 +662,10 @@ public class BitCometAdapter implements IDaemonAdapter {
status = convertStatus(xpp.getText()); status = convertStatus(xpp.getText());
break; break;
case "bytes_downloaded": case "bytes_downloaded":
sizeDone = Integer.parseInt(xpp.getText()); sizeDone = Long.parseLong(xpp.getText());
break; break;
case "bytes_uploaded": case "bytes_uploaded":
sizeUp = Integer.parseInt(xpp.getText()); sizeUp = Long.parseLong(xpp.getText());
break; break;
case "size": case "size":
totalSize = Long.parseLong(xpp.getText()); totalSize = Long.parseLong(xpp.getText());
@ -778,6 +784,10 @@ public class BitCometAdapter implements IDaemonAdapter {
return TorrentStatus.Paused; return TorrentStatus.Paused;
} else if (state.equals("running")) { } else if (state.equals("running")) {
return TorrentStatus.Downloading; return TorrentStatus.Downloading;
} else if (state.equals("hashing")) {
return TorrentStatus.Checking;
} else if (state.equals("queued")) {
return TorrentStatus.Queued;
} }
return TorrentStatus.Unknown; return TorrentStatus.Unknown;
} }

Loading…
Cancel
Save