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

2
android/res/values/changelog.xml

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

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

@ -101,20 +101,25 @@ public class BitCometAdapter implements IDaemonAdapter {
// Request all torrents from server // Request all torrents from server
// first, check client for the new AJAX interface (BitComet v.1.34 and up) // first, check client for the new AJAX interface (BitComet v.1.34 and up)
String result = makeRequest("/panel/task_list_xml"); try {
if (result.startsWith("<?xml", 0)) { String xmlResult = makeRequest("/panel/task_list_xml");
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseXmlTorrents(result), null); 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: case GetFileList:
// Request files listing for a specific torrent // Request files listing for a specific torrent
String fhash = ((GetFileListTask)task).getTargetTorrent().getUniqueID(); String fhash = ((GetFileListTask)task).getTargetTorrent().getUniqueID();
result = makeRequest("/panel/task_detail", new BasicNameValuePair("id", fhash), new BasicNameValuePair("show", "files")); String fileListResult = makeRequest("/panel/task_detail", new BasicNameValuePair("id", fhash),
return new GetFileListTaskSuccessResult((GetFileListTask) task, parseHttpTorrentFiles(result, fhash)); new BasicNameValuePair("show", "files"));
return new GetFileListTaskSuccessResult((GetFileListTask) task, parseHttpTorrentFiles(fileListResult,
fhash));
case AddByFile: case AddByFile:

Loading…
Cancel
Save