Browse Source

Fix ratio bug (when downloading only part of the files), see issue 405.\nFixed Deluge highest priority bug, see issue 396.

pull/11/head
Eric Kok 12 years ago
parent
commit
55f5721946
  1. 7
      lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java
  2. 8
      lib/src/org/transdroid/daemon/Torrent.java

7
lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java

@ -614,11 +614,12 @@ public class DelugeAdapter implements IDaemonAdapter {
return Priority.Off; return Priority.Off;
case 2: case 2:
return Priority.Normal; return Priority.Normal;
case 3: case 5:
return Priority.High; return Priority.High;
} default:
return Priority.Low; return Priority.Low;
} }
}
private int convertPriority(Priority priority) { private int convertPriority(Priority priority) {
switch (priority) { switch (priority) {
@ -627,7 +628,7 @@ public class DelugeAdapter implements IDaemonAdapter {
case Normal: case Normal:
return 2; return 2;
case High: case High:
return 3; return 5;
default: default:
return 1; return 1;
} }

8
lib/src/org/transdroid/daemon/Torrent.java

@ -160,17 +160,11 @@ public final class Torrent implements Parcelable, Comparable<Torrent> {
} }
/** /**
* Gives the upload/download seed ratio. If not downloading, * Gives the upload/download seed ratio.
* it will base the ratio on the total size; so if you created the torrent yourself
* you will have downloaded 0 bytes, but the ratio will pretend you have 100%.
* @return The ratio in range [0,r] * @return The ratio in range [0,r]
*/ */
public double getRatio() { public double getRatio() {
if (statusCode == TorrentStatus.Downloading) {
return ((double)uploadedEver) / ((double)downloadedEver); return ((double)uploadedEver) / ((double)downloadedEver);
} else {
return ((double)uploadedEver) / ((double)totalSize);
}
} }
/** /**

Loading…
Cancel
Save