Compare commits

..

12 Commits

Author SHA1 Message Date
Eric Kok b25804d5d7
Merge pull request #625 from bwitt/qbittorrent-show-all-categories 2 years ago
Eric Kok 98dc4bca3f
Merge pull request #626 from bwitt/bitcomet-fix-character 2 years ago
Eric Kok f9b62cf27e
Merge pull request #629 from bwitt/bicomet-add-magnet-url-fix 2 years ago
Eric Kok cc7a73ce56
Merge pull request #631 from bwitt/qbittorrent-set-global-limits 2 years ago
Eric Kok 1a87ae1211
Merge pull request #637 from bwitt/allow-pausing-when-queued 2 years ago
Eric Kok de349784e2
Merge pull request #641 from bwitt/update-gradle-plugin-731 2 years ago
Brian Witt acc818ee6c Update gradle plugin to 7.3.1 2 years ago
Brian Witt 71f3e1b4b5 Allow pausing a torrent when queued 2 years ago
Brian Witt 175249adff BitComet: Update add magnet url 2 years ago
Brian Witt 452927ada4 qBittorrent: Fix setting global upload and download limits 2 years ago
Brian Witt 9e489bc3a9 Remove illegal character from BitCometAdapter.java 2 years ago
Brian Witt 85ef0d51e4 Show all categories on recent qbittorrent 2 years ago
  1. 7
      app/build.gradle
  2. 5
      app/src/main/AndroidManifest.xml
  3. 2
      app/src/main/java/org/transdroid/daemon/Torrent.java
  4. 6
      app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java
  5. 31
      app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java
  6. 2
      build.gradle
  7. 2
      gradle/wrapper/gradle-wrapper.properties

7
app/build.gradle

@ -64,9 +64,6 @@ android { @@ -64,9 +64,6 @@ android {
}
}
lintOptions {
disable 'MissingTranslation', 'ExtraTranslation', 'StringFormatInvalid', 'ValidFragment', 'Registered'
}
compileOptions {
encoding = 'UTF-8'
@ -75,6 +72,10 @@ android { @@ -75,6 +72,10 @@ android {
}
useLibrary 'org.apache.http.legacy'
lint {
disable 'MissingTranslation', 'ExtraTranslation', 'StringFormatInvalid', 'ValidFragment', 'Registered'
}
namespace 'org.transdroid'
}
dependencies {

5
app/src/main/AndroidManifest.xml

@ -15,8 +15,7 @@ @@ -15,8 +15,7 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.transdroid">
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk />
@ -52,7 +51,7 @@ @@ -52,7 +51,7 @@
</queries>
<application
android:name=".core.gui.TransdroidApp_"
android:name="org.transdroid.core.gui.TransdroidApp_"
android:allowBackup="true"
android:banner="@drawable/banner"
android:hardwareAccelerated="true"

2
app/src/main/java/org/transdroid/daemon/Torrent.java

@ -359,7 +359,7 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl @@ -359,7 +359,7 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
*/
public boolean canPause() {
// Can pause when it is downloading or seeding
return statusCode == TorrentStatus.Downloading || statusCode == TorrentStatus.Seeding;
return statusCode == TorrentStatus.Downloading || statusCode == TorrentStatus.Seeding || statusCode == TorrentStatus.Queued;
}
/**

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
/*
/*
* This file is part of Transdroid <http://www.transdroid.org>
*
* Transdroid is free software: you can redistribute it and/or modify
@ -163,14 +163,14 @@ public class BitCometAdapter implements IDaemonAdapter { @@ -163,14 +163,14 @@ public class BitCometAdapter implements IDaemonAdapter {
// Request to add a torrent by URL
String url = ((AddByUrlTask) task).getUrl();
makeUploadUrlRequest(log, "/panel/task_add_httpftp_result", url);
makeUploadUrlRequest(log, "/panel/task_add_magnet_result", url);
return new DaemonTaskSuccessResult(task);
case AddByMagnetUrl:
// Request to add a torrent by URL
String magnetUrl = ((AddByMagnetUrlTask) task).getUrl();
makeUploadUrlRequest(log, "/panel/task_add_httpftp_result", magnetUrl);
makeUploadUrlRequest(log, "/panel/task_add_magnet_result", magnetUrl);
return new DaemonTaskSuccessResult(task);
case Remove:

31
app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java

@ -234,9 +234,17 @@ public class QBittorrentAdapter implements IDaemonAdapter { @@ -234,9 +234,17 @@ public class QBittorrentAdapter implements IDaemonAdapter {
path = "/json/events";
}
JSONArray result = new JSONArray(makeRequest(log, path));
JSONArray allTorrentsResult = new JSONArray(makeRequest(log, path));
final List<Torrent> torrentsList = parseJsonTorrents(allTorrentsResult);
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseJsonTorrents(result), parseJsonLabels(result));
JSONArray allLabelsResult;
if (version >= 40100) {
allLabelsResult = new JSONObject(makeRequest(log, "/api/v2/torrents/categories")).names();
} else {
allLabelsResult = new JSONArray();
}
final List<Label> labelList = parseJsonLabels(allLabelsResult, allTorrentsResult);
return new RetrieveTaskSuccessResult((RetrieveTask) task, torrentsList, labelList);
case GetTorrentDetails:
@ -469,8 +477,8 @@ public class QBittorrentAdapter implements IDaemonAdapter { @@ -469,8 +477,8 @@ public class QBittorrentAdapter implements IDaemonAdapter {
String ul = (ratesTask.getUploadRate() == null ? "NaN" : Long.toString(ratesTask.getUploadRate() * 1024));
if (version >= 40100) {
pathDL = "/api/v2/torrents/setDownloadLimit";
pathUL = "/api/v2/torrents/setUploadLimit";
pathDL = "/api/v2/transfer/setDownloadLimit";
pathUL = "/api/v2/transfer/setUploadLimit";
} else {
pathDL = "/command/setGlobalDlLimit";
pathUL = "/command/setGlobalUpLimit";
@ -648,18 +656,25 @@ public class QBittorrentAdapter implements IDaemonAdapter { @@ -648,18 +656,25 @@ public class QBittorrentAdapter implements IDaemonAdapter {
}
private List<Label> parseJsonLabels(JSONArray response) throws JSONException {
private List<Label> parseJsonLabels(JSONArray allLabelsResponse, JSONArray allTorrentsResponse) throws JSONException {
// Collect used labels from response
// Collect used labels from torrents response
Map<String, Label> labels = new HashMap<>();
for (int i = 0; i < response.length(); i++) {
JSONObject tor = response.getJSONObject(i);
for (int i = 0; i < allTorrentsResponse.length(); i++) {
JSONObject tor = allTorrentsResponse.getJSONObject(i);
if (tor.has("category")) {
String label = tor.optString("category");
final Label labelObject = labels.get(label);
labels.put(label, new Label(label, (labelObject != null) ? labelObject.getCount() + 1 : 1));
}
}
// add unused labels
for (int i = 0; i < allLabelsResponse.length(); i++) {
String label = allLabelsResponse.getString(i);
if (!labels.containsKey(label)) {
labels.put(label, new Label(label, 0));
}
}
return new ArrayList<>(labels.values());
}

2
build.gradle

@ -6,7 +6,7 @@ buildscript { @@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

2
gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Loading…
Cancel
Save