Browse Source

Properly catch old BitComet installed to revert to using HTML parsing.

pull/11/head
Eric Kok 12 years ago
parent
commit
e62f5d9fc4
  1. 2
      android/AndroidManifest.xml
  2. 2
      android/res/values/changelog.xml
  3. 21
      lib/src/org/transdroid/daemon/BitComet/BitCometAdapter.java

2
android/AndroidManifest.xml

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.transdroid"
android:versionName="1.1.8"
android:versionCode="149"
android:versionCode="150"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />

2
android/res/values/changelog.xml

@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
Transdroid 1.1.8\n
- Improved BitComet support, by Sergey\n
- Fix for non-English KTorrent\n
- Report Deluge tracker errors\n
- Sort by date added with uTorrent\n
\n
Transdroid 1.1.7\n
- Transmission and qBittorrent bugfixes\n

21
lib/src/org/transdroid/daemon/BitComet/BitCometAdapter.java

@ -101,20 +101,25 @@ public class BitCometAdapter implements IDaemonAdapter { @@ -101,20 +101,25 @@ public class BitCometAdapter implements IDaemonAdapter {
// Request all torrents from server
// first, check client for the new AJAX interface (BitComet v.1.34 and up)
String result = makeRequest("/panel/task_list_xml");
if (result.startsWith("<?xml", 0)) {
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseXmlTorrents(result), null);
try {
String xmlResult = makeRequest("/panel/task_list_xml");
if (xmlResult.startsWith("<?xml", 0)) {
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseXmlTorrents(xmlResult), null);
}
} catch (Exception e) {
// it's probably an old client, parse HTML instead
String htmlResult = makeRequest("/panel/task_list");
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseHttpTorrents(htmlResult), null);
}
// it's old client, parse HTML
result = makeRequest("/panel/task_list");
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseHttpTorrents(result), null);
case GetFileList:
// Request files listing for a specific torrent
String fhash = ((GetFileListTask)task).getTargetTorrent().getUniqueID();
result = makeRequest("/panel/task_detail", new BasicNameValuePair("id", fhash), new BasicNameValuePair("show", "files"));
return new GetFileListTaskSuccessResult((GetFileListTask) task, parseHttpTorrentFiles(result, fhash));
String fileListResult = makeRequest("/panel/task_detail", new BasicNameValuePair("id", fhash),
new BasicNameValuePair("show", "files"));
return new GetFileListTaskSuccessResult((GetFileListTask) task, parseHttpTorrentFiles(fileListResult,
fhash));
case AddByFile:

Loading…
Cancel
Save