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 13 years ago
parent
commit
55f5721946
  1. 7
      lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java
  2. 10
      lib/src/org/transdroid/daemon/Torrent.java

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

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

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

@ -160,17 +160,11 @@ public final class Torrent implements Parcelable, Comparable<Torrent> { @@ -160,17 +160,11 @@ public final class Torrent implements Parcelable, Comparable<Torrent> {
}
/**
* Gives the upload/download seed ratio. If not downloading,
* 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%.
* Gives the upload/download seed ratio.
* @return The ratio in range [0,r]
*/
public double getRatio() {
if (statusCode == TorrentStatus.Downloading) {
return ((double)uploadedEver) / ((double)downloadedEver);
} else {
return ((double)uploadedEver) / ((double)totalSize);
}
return ((double)uploadedEver) / ((double)downloadedEver);
}
/**

Loading…
Cancel
Save