Compare commits

..

No commits in common. 'b25804d5d7ee978eb0815a8a7a7a4ee2ee49514d' and 'aadddd0d3ac926bb376e956e2d2451f7d91ff638' have entirely different histories.

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

5
app/src/main/AndroidManifest.xml

@ -15,7 +15,8 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
package="org.transdroid">
<uses-sdk /> <uses-sdk />
@ -51,7 +52,7 @@
</queries> </queries>
<application <application
android:name="org.transdroid.core.gui.TransdroidApp_" android:name=".core.gui.TransdroidApp_"
android:allowBackup="true" android:allowBackup="true"
android:banner="@drawable/banner" android:banner="@drawable/banner"
android:hardwareAccelerated="true" 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
*/ */
public boolean canPause() { public boolean canPause() {
// Can pause when it is downloading or seeding // Can pause when it is downloading or seeding
return statusCode == TorrentStatus.Downloading || statusCode == TorrentStatus.Seeding || statusCode == TorrentStatus.Queued; return statusCode == TorrentStatus.Downloading || statusCode == TorrentStatus.Seeding;
} }
/** /**

6
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
@ -163,14 +163,14 @@ public class BitCometAdapter implements IDaemonAdapter {
// Request to add a torrent by URL // Request to add a torrent by URL
String url = ((AddByUrlTask) task).getUrl(); String url = ((AddByUrlTask) task).getUrl();
makeUploadUrlRequest(log, "/panel/task_add_magnet_result", url); makeUploadUrlRequest(log, "/panel/task_add_httpftp_result", url);
return new DaemonTaskSuccessResult(task); return new DaemonTaskSuccessResult(task);
case AddByMagnetUrl: case AddByMagnetUrl:
// Request to add a torrent by URL // Request to add a torrent by URL
String magnetUrl = ((AddByMagnetUrlTask) task).getUrl(); String magnetUrl = ((AddByMagnetUrlTask) task).getUrl();
makeUploadUrlRequest(log, "/panel/task_add_magnet_result", magnetUrl); makeUploadUrlRequest(log, "/panel/task_add_httpftp_result", magnetUrl);
return new DaemonTaskSuccessResult(task); return new DaemonTaskSuccessResult(task);
case Remove: case Remove:

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

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

2
build.gradle

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

2
gradle/wrapper/gradle-wrapper.properties vendored

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

Loading…
Cancel
Save