@ -113,8 +113,9 @@ public class ServerSetting implements SimpleListItem {
@@ -113,8 +113,9 @@ public class ServerSetting implements SimpleListItem {
@Override
publicStringgetName(){
if(!TextUtils.isEmpty(name))
if(!TextUtils.isEmpty(name)){
returnname;
}
if(!TextUtils.isEmpty(address)){
Stringhost=Uri.parse(address).getHost();
returnhost==null?DEFAULT_NAME:host;
@ -221,13 +222,13 @@ public class ServerSetting implements SimpleListItem {
@@ -221,13 +222,13 @@ public class ServerSetting implements SimpleListItem {
publicStringgetHumanReadableIdentifier(){
if(isAutoGenerated){
// Hide the 'implementation details'; just give the username and server
@ -235,11 +236,12 @@ public class ServerSetting implements SimpleListItem {
@@ -235,11 +236,12 @@ public class ServerSetting implements SimpleListItem {
@ -279,13 +281,15 @@ public class ServerSetting implements SimpleListItem {
@@ -279,13 +281,15 @@ public class ServerSetting implements SimpleListItem {
// The local integer key is converted to the idString string.
// The host name address used is dependent on the network that we are currently connected to (to allow a
// distinct connection IP or host name when connected to a local network).
if(!TextUtils.isEmpty(localNetwork))
Log.d(caller,"Creating adapter for "+name+" of type "+type.name()+": connected to "
+connectedToNetwork+" and configured local network is "+localNetwork);
if(!TextUtils.isEmpty(localNetwork)){
Log_.getInstance_(caller)
.d("ServerSetting","Creating adapter for "+name+" of type "+type.name()+": connected to "+
connectedToNetwork+" and configured local network is "+localNetwork);
@ -95,6 +95,8 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -95,6 +95,8 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
// Settings
@Bean
protectedLoglog;
@Bean
protectedNavigationHelpernavigationHelper;
@Bean
protectedConnectivityHelperconnectivityHelper;
@ -185,7 +187,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -185,7 +187,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -198,7 +200,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -198,7 +200,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -210,7 +212,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -210,7 +212,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -222,7 +224,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -222,7 +224,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -234,7 +236,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -234,7 +236,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -246,7 +248,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -246,7 +248,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -258,7 +260,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -258,7 +260,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -269,7 +271,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -269,7 +271,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -293,7 +295,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -293,7 +295,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -305,7 +307,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -305,7 +307,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -317,7 +319,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -317,7 +319,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -328,7 +330,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -328,7 +330,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -340,7 +342,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -340,7 +342,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -373,7 +375,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@@ -373,7 +375,7 @@ public class DetailsActivity extends Activity implements TorrentTasksExecutor, R
@ -180,7 +174,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
@@ -180,7 +174,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
@ -158,7 +157,8 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
@@ -158,7 +157,8 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
@ -213,14 +213,14 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
@@ -213,14 +213,14 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
// Filter the list of torrents to show according to navigation and text filters
@ -33,14 +33,15 @@ public class LogUncaughtExceptionHandler implements Thread.UncaughtExceptionHand
@@ -33,14 +33,15 @@ public class LogUncaughtExceptionHandler implements Thread.UncaughtExceptionHand
@ -71,6 +77,83 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -71,6 +77,83 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -86,8 +169,9 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -86,8 +169,9 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -96,14 +180,17 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -96,14 +180,17 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -119,9 +206,8 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -119,9 +206,8 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -156,9 +242,8 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -156,9 +242,8 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -171,17 +256,17 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -171,17 +256,17 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -210,114 +295,18 @@ public class MainSettingsActivity extends PreferenceActivity {
@@ -210,114 +295,18 @@ public class MainSettingsActivity extends PreferenceActivity {
@ -119,8 +119,8 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
@@ -119,8 +119,8 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
@ -99,7 +103,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
@@ -99,7 +103,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
}catch(Exceptione){
Log.d(XirvikSharedSettingsActivity.this,
log.d(XirvikSharedSettingsActivity.this,
"Could not retrieve the Xirvik shared seedbox RPC mount point setting: "+e.toString());
returnnull;
@ -126,7 +130,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
@@ -126,7 +130,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
"Skip the RSS checker service, as background data is disabled, the service is disabled or we are not connected.");
return;
}
@ -76,15 +78,16 @@ public class RssCheckerService extends IntentService {
@@ -76,15 +78,16 @@ public class RssCheckerService extends IntentService {
try{
if(!feed.shouldAlarmOnNewItems()){
Log.d(this,"Skip checker for "+feed.getName()+" as alarms are disabled");
log.d(this,"Skip checker for "+feed.getName()+" as alarms are disabled");
continue;
}
Log.d(this,"Try to parse "+feed.getName()+" ("+feed.getUrl()+")");
log.d(this,"Try to parse "+feed.getName()+" ("+feed.getUrl()+")");
RssParserparser=newRssParser(feed.getUrl());
parser.parse();
if(parser.getChannel()==null)
if(parser.getChannel()==null){
continue;
}
// Find the last item that is newer than the last viewed date
for(Itemitem:parser.getChannel().getItems()){
@ -92,13 +95,14 @@ public class RssCheckerService extends IntentService {
@@ -92,13 +95,14 @@ public class RssCheckerService extends IntentService {
break;
}else{
unread++;
if(!hasUnread.contains(feed.getName()))
if(!hasUnread.contains(feed.getName())){
hasUnread.add(feed.getName());
}
}
}
Log.d(this,feed.getName()+" has "+(hasUnread.contains(feed.getName())?"":"no ")
+"unread items");
log.d(this,
feed.getName()+" has "+(hasUnread.contains(feed.getName())?"":"no ")+"unread items");
}catch(Exceptione){
// Ignore RSS feeds that could not be retrieved or parsed
@ -111,17 +115,17 @@ public class RssCheckerService extends IntentService {
@@ -111,17 +115,17 @@ public class RssCheckerService extends IntentService {
}
// Provide a notification, since there are new RSS items
"Skip the server checker service, as background data is disabled, the service is disabled or we are not connected.");
return;
}
@ -92,13 +94,13 @@ public class ServerCheckerService extends IntentService {
@@ -92,13 +94,13 @@ public class ServerCheckerService extends IntentService {
// Check for differences between the last and the current stats
JSONArraycurrentStats=newJSONArray();
@ -133,7 +135,7 @@ public class ServerCheckerService extends IntentService {
@@ -133,7 +135,7 @@ public class ServerCheckerService extends IntentService {
@ -80,23 +81,73 @@ public class ListWidgetConfigActivity extends Activity {
@@ -80,23 +81,73 @@ public class ListWidgetConfigActivity extends Activity {
@ -104,8 +155,8 @@ public class ListWidgetConfigActivity extends Activity {
@@ -104,8 +155,8 @@ public class ListWidgetConfigActivity extends Activity {
@ -119,10 +170,10 @@ public class ListWidgetConfigActivity extends Activity {
@@ -119,10 +170,10 @@ public class ListWidgetConfigActivity extends Activity {
@ -156,31 +207,17 @@ public class ListWidgetConfigActivity extends Activity {
@@ -156,31 +207,17 @@ public class ListWidgetConfigActivity extends Activity {
@ -201,22 +238,27 @@ public class ListWidgetConfigActivity extends Activity {
@@ -201,22 +238,27 @@ public class ListWidgetConfigActivity extends Activity {
protectedvoidfilterTorrents(){
// All spinners have to be initialised already
if(serverSpinner.getSelectedItem()==null)
if(serverSpinner.getSelectedItem()==null){
return;
if(filterSpinner.getSelectedItem()==null)
}
if(filterSpinner.getSelectedItem()==null){
return;
if(sortSpinner.getSelectedItem()==null)
}
if(sortSpinner.getSelectedItem()==null){
return;
if(previewTorrents==null)
}
if(previewTorrents==null){
return;
}
// Get the already loaded torrents and filter and sort them
@ -257,38 +299,4 @@ public class ListWidgetConfigActivity extends Activity {
@@ -257,38 +299,4 @@ public class ListWidgetConfigActivity extends Activity {
@ -52,49 +52,6 @@ public class ListWidgetProvider extends AppWidgetProvider {
@@ -52,49 +52,6 @@ public class ListWidgetProvider extends AppWidgetProvider {
@ -107,12 +64,14 @@ public class ListWidgetProvider extends AppWidgetProvider {
@@ -107,12 +64,14 @@ public class ListWidgetProvider extends AppWidgetProvider {
"Tried to set up widget "+appWidgetId+" but the bound server ID "+config.getServerId()+
" no longer exists.");
returnnull;
}
@ -176,4 +135,46 @@ public class ListWidgetProvider extends AppWidgetProvider {
@@ -176,4 +135,46 @@ public class ListWidgetProvider extends AppWidgetProvider {
@ -59,12 +59,14 @@ public class AlphanumComparator implements Comparator<String> {
@@ -59,12 +59,14 @@ public class AlphanumComparator implements Comparator<String> {
returnchunk.toString();
}
publicintcompare(Stringo1,Stringo2){
if(!(o1instanceofString)||!(o2instanceofString)){
publicintcompare(Strings1,Strings2){
if(s1==null&&s2!=null){
return-1;
}elseif(s1!=null&&s2==null){
return1;
}elseif(s1==null){
return0;
}
Strings1=(String)o1;
Strings2=(String)o2;
intthisMarker=0;
intthatMarker=0;
@ -79,7 +81,7 @@ public class AlphanumComparator implements Comparator<String> {
@@ -79,7 +81,7 @@ public class AlphanumComparator implements Comparator<String> {
thatMarker+=thatChunk.length();
// If both chunks contain numeric characters, sort them numerically
@ -92,128 +89,167 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -92,128 +89,167 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -225,13 +261,13 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -225,13 +261,13 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -260,25 +296,25 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -260,25 +296,25 @@ public class BitCometAdapter implements IDaemonAdapter {
returnresult;
}
DLog.d(LOG_NAME,"Error: No entity in HTTP response");
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
@ -291,13 +327,14 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -291,13 +327,14 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -309,7 +346,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -309,7 +346,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -319,18 +358,18 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -319,18 +358,18 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -343,7 +382,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -343,7 +382,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -375,34 +414,36 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -375,34 +414,36 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -411,10 +452,11 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -411,10 +452,11 @@ public class BitCometAdapter implements IDaemonAdapter {
// Unfortunately, there is no info for above values providing by BitComet now,
// so we may only send additional request for that
@ -423,42 +465,49 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -423,42 +465,49 @@ public class BitCometAdapter implements IDaemonAdapter {
intknownLeechers=0;
intknownSeeders=0;
intdistributed_copies=0;
longsizeUp=0;
Stringcomment="";
DatedateAdded=newDate();
longsizeUp;
Stringcomment;
DatedateAdded;
// Comment code below to speedup torrent listing
// P.S. feature request to extend torrents info is already sent to the BitComet developers
@ -482,10 +531,10 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -482,10 +531,10 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -493,13 +542,12 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -493,13 +542,12 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -511,8 +559,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -511,8 +559,7 @@ public class BitCometAdapter implements IDaemonAdapter {
// Temp variables to load into torrent objects
intid=0;
Stringname="";
@SuppressWarnings("unused")
Stringhash="";
@SuppressWarnings("unused")Stringhash="";
TorrentStatusstatus=TorrentStatus.Unknown;
longsizeDone=0;
longsizeUp=0;
@ -537,6 +584,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -537,6 +584,7 @@ public class BitCometAdapter implements IDaemonAdapter {
// End of a 'transfer' item, add gathered torrent data
sizeDone=(long)(totalSize*progress);
// @formatter:off
torrents.add(newTorrent(
id,
null,// hash, // we suppose to use simple integer IDs
@ -560,10 +608,11 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -560,10 +608,11 @@ public class BitCometAdapter implements IDaemonAdapter {
null,
null,// Not supported in the web interface
settings.getType()));
// @formatter:on
id++;// Stop/start/etc. requests are made by ID, which is the order number in the returned XML list :-S
// Start of a new 'transfer' item; reset gathered torrent data
name="";
@ -582,7 +631,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -582,7 +631,7 @@ public class BitCometAdapter implements IDaemonAdapter {
label="";
dateAdded=newDate();
}elseif(next==XmlPullParser.START_TAG){
}elseif(next==XmlPullParser.START_TAG){
// Probably encountered a torrent property, i.e. '<type>BT</type>'
next=xpp.next();
@ -638,8 +687,8 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -638,8 +687,8 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -649,19 +698,21 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -649,19 +698,21 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -670,9 +721,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -670,9 +721,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -680,30 +731,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -680,30 +731,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -715,7 +745,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -715,7 +745,7 @@ public class BitCometAdapter implements IDaemonAdapter {
/**
*ParseBitComettorrentstatus
**/
*/
privateTorrentStatusconvertStatus(Stringstate){
// Status is given as a descriptive string and an indication if the torrent was stopped/paused
if(state.equals("stopped")){
@ -726,15 +756,6 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -726,15 +756,6 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -174,10 +175,10 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -174,10 +175,10 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -281,10 +281,11 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -281,10 +281,11 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -78,86 +78,88 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -78,86 +78,88 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -166,13 +168,13 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -166,13 +168,13 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -201,31 +203,31 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -201,31 +203,31 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
returnresult;
}
DLog.d(LOG_NAME,"Error: No entity in HTTP response");
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
@ -235,7 +237,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -235,7 +237,7 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -243,10 +245,9 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -243,10 +245,9 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -115,54 +114,54 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -115,54 +114,54 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -172,12 +171,12 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -172,12 +171,12 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -206,10 +205,9 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -206,10 +205,9 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -218,31 +216,31 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -218,31 +216,31 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -264,8 +262,9 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -264,8 +262,9 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
response=httpclient.execute(httppost);
}
if(!hasRespond)
if(!hasRespond){
returnnull;
}
HttpEntityentity=response.getEntity();
if(entity!=null){
@ -276,24 +275,24 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -276,24 +275,24 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -301,39 +300,40 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -301,39 +300,40 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -345,15 +345,18 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -345,15 +345,18 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -366,17 +369,18 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -366,17 +369,18 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -395,15 +399,16 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -395,15 +399,16 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -414,12 +419,12 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -414,12 +419,12 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -141,34 +138,30 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -141,34 +138,30 @@ public class DelugeAdapter implements IDaemonAdapter {
@ -205,10 +198,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -205,10 +198,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@ -219,200 +212,207 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -219,200 +212,207 @@ public class DelugeAdapter implements IDaemonAdapter {
// We still need to retrieve the version number from the server
// Do this by getting the web interface main html page and trying to parse the version number
// Format is something like '<title>Deluge: Web UI 1.3.6</title>'
@ -464,9 +465,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -464,9 +465,10 @@ public class DelugeAdapter implements IDaemonAdapter {
Stringnumbers="";
for(charc:parts[2].toCharArray()){
if(Character.isDigit(c))
// Still a number; add it to the numbers string
// Still a number; add it to the numbers string
{
numbers+=Character.toString(c);
else{
}else{
// No longer reading numbers; stop reading
break;
}
@ -478,10 +480,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -478,10 +480,10 @@ public class DelugeAdapter implements IDaemonAdapter {
}
}
}catch(NumberFormatExceptione){
DLog.d(LOG_NAME,"Error parsing the Deluge version code as number: "+e.toString());
log.d(LOG_NAME,"Error parsing the Deluge version code as number: "+e.toString());
@ -543,7 +545,9 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -543,7 +545,9 @@ public class DelugeAdapter implements IDaemonAdapter {
// Still no session cookie?
if(sessionCookie==null){
// Set error message and cancel the action that was requested
thrownewDaemonException(ExceptionType.AuthenticationFailure,"Password error? Server time difference? No (valid) cookie in response and JSON was: "+HttpHelper.convertStreamToString(instream));
@ -590,10 +596,10 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -590,10 +596,10 @@ public class DelugeAdapter implements IDaemonAdapter {
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity in response object.");
@ -601,23 +607,24 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -601,23 +607,24 @@ public class DelugeAdapter implements IDaemonAdapter {
thrownewDaemonException(ExceptionType.NotConnected,"Web interface probably not connected to a daemon yet, because 'torrents' is null: "+response.toString());
@ -673,19 +684,22 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -673,19 +684,22 @@ public class DelugeAdapter implements IDaemonAdapter {
@ -724,25 +740,25 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -724,25 +740,25 @@ public class DelugeAdapter implements IDaemonAdapter {
if(version>=10303){
// Priority codes changes from Deluge 1.3.3 onwards
switch(priority){
case0:
returnPriority.Off;
case1:
returnPriority.Low;
case7:
returnPriority.High;
default:
returnPriority.Normal;
case0:
returnPriority.Off;
case1:
returnPriority.Low;
case7:
returnPriority.High;
default:
returnPriority.Normal;
}
}else{
switch(priority){
case0:
returnPriority.Off;
case2:
returnPriority.Normal;
case5:
returnPriority.High;
default:
returnPriority.Low;
case0:
returnPriority.Off;
case2:
returnPriority.Normal;
case5:
returnPriority.High;
default:
returnPriority.Low;
}
}
}
@ -751,25 +767,25 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -751,25 +767,25 @@ public class DelugeAdapter implements IDaemonAdapter {
if(version>=10303){
// Priority codes changes from Deluge 1.3.3 onwards
@ -98,104 +96,124 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -98,104 +96,124 @@ public class KtorrentAdapter implements IDaemonAdapter {
task.getMethod()+" is not supported by "+getType()));
}
}catch(LoggedOutExceptione){
@ -204,11 +222,12 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -204,11 +222,12 @@ public class KtorrentAdapter implements IDaemonAdapter {
if(retries<2){
retries++;
// Retry
DLog.d(LOG_NAME,"We were logged out without knowing: retry");
returnexecuteTask(task);
log.d(LOG_NAME,"We were logged out without knowing: retry");
returnexecuteTask(log,task);
}else{
// Never retry more than twice; in this case just return a task failure
returnnewDaemonTaskFailureResult(task,newDaemonException(ExceptionType.ConnectionError,"Retried "+retries+" already, so we stopped now"));
"Retried "+retries+" already, so we stopped now"));
}
}catch(DaemonExceptione){
@ -221,13 +240,13 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -221,13 +240,13 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -235,29 +254,30 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -235,29 +254,30 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -270,23 +290,25 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -270,23 +290,25 @@ public class KtorrentAdapter implements IDaemonAdapter {
// If the files list is empty, it means that this is a single-file torrent
// We can mimic this single file form the torrent statistics itself
@ -294,10 +316,10 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -294,10 +316,10 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -305,8 +327,10 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -305,8 +327,10 @@ public class KtorrentAdapter implements IDaemonAdapter {
params.add(newBasicNameValuePair(RPC_URL_LOGIN_PASS,""));// Password is send (as SHA1 hex) in the challenge field
params.add(newBasicNameValuePair(RPC_URL_LOGIN_CHAL,sha1Pass(challengeString+settings.getPassword())));// Make a SHA1 encrypted hex-formated string of the challenge code and password
@ -318,40 +342,22 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -318,40 +342,22 @@ public class KtorrentAdapter implements IDaemonAdapter {
retries=0;
}catch(DaemonExceptione){
DLog.d(LOG_NAME,"Login error: "+e.toString());
log.d(LOG_NAME,"Login error: "+e.toString());
throwe;
}catch(Exceptione){
DLog.d(LOG_NAME,"Error during login: "+e.toString());
log.d(LOG_NAME,"Error during login: "+e.toString());
@ -374,34 +380,39 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -374,34 +380,39 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -423,10 +434,10 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -423,10 +434,10 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -448,7 +459,6 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -448,7 +459,6 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -84,13 +85,13 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -84,13 +85,13 @@ public class QbittorrentAdapter implements IDaemonAdapter {
// We still need to retrieve the version number from the server
// Do this by getting the web interface about page and trying to parse the version number
// Format is something like 'qBittorrent v2.9.7 (Web UI)'
Stringabout=makeRequest("/about.html");
Stringabout=makeRequest(log,"/about.html");
StringaboutStartText="qBittorrent v";
StringaboutEndText=" (Web UI)";
intaboutStart=about.indexOf(aboutStartText);
@ -129,83 +130,83 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -129,83 +130,83 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -222,7 +223,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -222,7 +223,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
}
// We have to make a separate request per file, it seems
@ -233,14 +234,14 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -233,14 +234,14 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -257,18 +258,16 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -257,18 +258,16 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -276,7 +275,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -276,7 +275,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -285,7 +284,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -285,7 +284,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -293,7 +292,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -293,7 +292,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -320,11 +319,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -320,11 +319,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
returnresult;
}
DLog.d(LOG_NAME,"Error: No entity in HTTP response");
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
@ -332,7 +331,6 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -332,7 +331,6 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -385,10 +383,31 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -385,10 +383,31 @@ public class QbittorrentAdapter implements IDaemonAdapter {
eta=(long)(size-(size*progress))/dlspeed;
// Date added is only available in /json/propertiesGeneral on a per-torrent basis, unfortunately
@ -88,14 +88,14 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -88,14 +88,14 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -122,23 +122,24 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -122,23 +122,24 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -149,137 +150,139 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -149,137 +150,139 @@ public class RtorrentAdapter implements IDaemonAdapter {
task.getMethod()+" is not supported by "+getType()));
}
}catch(DaemonExceptione){
returnnewDaemonTaskFailureResult(task,e);
@ -290,8 +293,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -290,8 +293,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -299,22 +302,25 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -299,22 +302,25 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -336,12 +342,9 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -336,12 +342,9 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -365,7 +368,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -365,7 +368,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
error=error.equals("")?null:error;
// Determine the time added
Dateadded=null;
Dateadded;
Longaddtime=null;
try{
addtime=Long.valueOf(((String)info[19]).trim());
@ -373,14 +376,16 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -373,14 +376,16 @@ public class RtorrentAdapter implements IDaemonAdapter {
// Not a number (timestamp); ignore and fall back to using creationtime
}
if(addtime!=null)
// Successfully received the addtime from rTorrent (which is a String like '1337089336\n')
// Successfully received the addtime from rTorrent (which is a String like '1337089336\n')
{
added=newDate(addtime*1000L);
else{
}else{
// rTorrent didn't have the addtime (missing plugin?): base it on creationtime instead
if(info[11]instanceofLong)
if(info[11]instanceofLong){
added=newDate((Long)info[11]*1000L);
else
}else{
added=newDate((Integer)info[11]*1000L);
}
}
// Determine the seeding time
@ -392,8 +397,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -392,8 +397,10 @@ public class RtorrentAdapter implements IDaemonAdapter {
// Not a number (timestamp); ignore and fall back to using creationtime
}
if(seedingtime!=null)
// Successfully received the seedingtime from rTorrent (which is a String like '1337089336\n')
// Successfully received the seedingtime from rTorrent (which is a String like '1337089336\n')
{
finished=newDate(seedingtime*1000L);
}
// Determine the label
Stringlabel=null;
@ -455,11 +462,11 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -455,11 +462,11 @@ public class RtorrentAdapter implements IDaemonAdapter {
(rateDownload>0?(Integer)info[12]/rateDownload:-1),// eta (bytes left / rate download, if rate > 0)
(Integer)info[8],// downloadedEver
(Integer)info[9],// uploadedEver
(Integer)info[10],// totalSize
@ -476,8 +483,9 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -476,8 +483,9 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -550,24 +558,24 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -550,24 +558,24 @@ public class RtorrentAdapter implements IDaemonAdapter {
privatePriorityconvertRtorrentPriority(intcode){
// Note that Rtorrent has no low priority value
switch(code){
case0:
returnPriority.Off;
case2:
returnPriority.High;
default:
returnPriority.Normal;
case0:
returnPriority.Off;
case2:
returnPriority.High;
default:
returnPriority.Normal;
}
}
privateintconvertPriority(Prioritypriority){
// Note that Rtorrent has no low priority value
switch(priority){
caseOff:
return0;
caseHigh:
return2;
default:
return1;
caseOff:
return0;
caseHigh:
return2;
default:
return1;
}
}
@ -587,7 +595,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -587,7 +595,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -601,12 +609,12 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -601,12 +609,12 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -76,47 +75,48 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -76,47 +75,48 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -124,9 +124,9 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -124,9 +124,9 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -149,84 +149,87 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -149,84 +149,87 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -237,16 +240,21 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -237,16 +240,21 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -255,6 +263,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -255,6 +263,7 @@ public class SynologyAdapter implements IDaemonAdapter {
task.getLong("size"),
task.getLong("size_downloaded"),
priority(task.getString("priority"))
// @formatter:on
));
}
returnresult;
@ -263,11 +272,13 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -263,11 +272,13 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -293,7 +304,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -293,7 +304,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -306,6 +317,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -306,6 +317,7 @@ public class SynologyAdapter implements IDaemonAdapter {
}
}
}
// @formatter:off
returnnewTorrent(
id,
jsonTorrent.getString("id"),
@ -322,79 +334,71 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -322,79 +334,71 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -405,13 +409,13 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -405,13 +409,13 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -419,11 +423,11 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -419,11 +423,11 @@ public class SynologyAdapter implements IDaemonAdapter {
DLog.e(LOG_NAME,"Error: No entity in HTTP response");
log.e(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
}
// Read JSON response
@ -436,16 +440,17 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -436,16 +440,17 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -453,4 +458,30 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -453,4 +458,30 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -170,16 +170,16 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
@@ -170,16 +170,16 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
@ -204,16 +204,16 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
@@ -204,16 +204,16 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
@ -241,10 +241,10 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
@@ -241,10 +241,10 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
@ -49,7 +49,7 @@ public class TorrentFilesComparator implements Comparator<TorrentFile> {
@@ -49,7 +49,7 @@ public class TorrentFilesComparator implements Comparator<TorrentFile> {
@ -58,7 +58,7 @@ public class TorrentFilesComparator implements Comparator<TorrentFile> {
@@ -58,7 +58,7 @@ public class TorrentFilesComparator implements Comparator<TorrentFile> {
@ -67,15 +67,15 @@ public class TorrentsComparator implements Comparator<Torrent> {
@@ -67,15 +67,15 @@ public class TorrentsComparator implements Comparator<Torrent> {
@ -92,15 +92,15 @@ public class TorrentsComparator implements Comparator<Torrent> {
@@ -92,15 +92,15 @@ public class TorrentsComparator implements Comparator<Torrent> {
@ -110,11 +109,9 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -110,11 +109,9 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -122,216 +119,239 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -122,216 +119,239 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -344,11 +364,13 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -344,11 +364,13 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -374,7 +396,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -374,7 +396,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -395,7 +417,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -395,7 +417,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
}
// Execute
DLog.d(LOG_NAME,"Execute "+data.getString("method")+" request to "+httppost.getURI().toString());
log.d(LOG_NAME,"Execute "+data.getString("method")+" request to "+httppost.getURI().toString());
@ -408,11 +430,12 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -408,11 +430,12 @@ public class TransmissionAdapter implements IDaemonAdapter {
DLog.d(LOG_NAME,"Retry to execute "+data.getString("method")+" request, now with "+sessionHeader
+": "+sessionToken);
log.d(LOG_NAME,
"Retry to execute "+data.getString("method")+" request, now with "+sessionHeader+": "+
sessionToken);
response=httpclient.execute(httppost);
}
@ -423,9 +446,8 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -423,9 +446,8 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -433,16 +455,16 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -433,16 +455,16 @@ public class TransmissionAdapter implements IDaemonAdapter {
returnjson;
}
DLog.d(LOG_NAME,"Error: No entity in HTTP response");
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
@ -450,7 +472,6 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -450,7 +472,6 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -467,11 +488,12 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -467,11 +488,12 @@ public class TransmissionAdapter implements IDaemonAdapter {
// Allow the user's folder setting to override /transmission (as per Transmission's rpc-url option)
@ -482,7 +504,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -482,7 +504,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
// Error is a number, see https://trac.transmissionbt.com/browser/trunk/libtransmission/transmission.h#L1747
// We only consider it a real error if it is local (blocking), which is error code 3
@ -490,16 +512,18 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -490,16 +512,18 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -512,13 +536,14 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -512,13 +536,14 @@ public class TransmissionAdapter implements IDaemonAdapter {
// No label/category/group support in the RPC API for now
null,
newDate(tor.getLong(RPC_DATEADDED)*1000L),
newDate(tor.getLong(RPC_DATEDONE)*1000L),
errorString,
settings.getType()));
errorString,settings.getType()));
// @formatter:on
}
// Return the list
@ -531,20 +556,20 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -531,20 +556,20 @@ public class TransmissionAdapter implements IDaemonAdapter {
returnTorrentStatus.Unknown;
}elseif(rpcVersion>=14){
switch(status){
case0:
returnTorrentStatus.Paused;
case1:
returnTorrentStatus.Waiting;
case2:
returnTorrentStatus.Checking;
case3:
returnTorrentStatus.Queued;
case4:
returnTorrentStatus.Downloading;
case5:
returnTorrentStatus.Queued;
case6:
returnTorrentStatus.Seeding;
case0:
returnTorrentStatus.Paused;
case1:
returnTorrentStatus.Waiting;
case2:
returnTorrentStatus.Checking;
case3:
returnTorrentStatus.Queued;
case4:
returnTorrentStatus.Downloading;
case5:
returnTorrentStatus.Queued;
case6:
returnTorrentStatus.Seeding;
}
returnTorrentStatus.Unknown;
}else{
@ -563,14 +588,16 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -563,14 +588,16 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -584,12 +611,12 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -584,12 +611,12 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -97,166 +121,180 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -97,166 +121,180 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -265,15 +303,13 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -265,15 +303,13 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -282,20 +318,17 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -282,20 +318,17 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -317,9 +350,11 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -317,9 +350,11 @@ public class UtorrentAdapter implements IDaemonAdapter {
// Auth token was invalidated; retry at max 3 times
authtoken=null;// So that ensureToken() will request a new token on the next try
thrownewDaemonException(ExceptionType.AuthenticationFailure,"Response was '"+result.replace("\n","")+"' instead of a proper JSON object (and we used auth token '"+authtoken+"')");
"' instead of a proper JSON object (and we used auth token '"+authtoken+"')");
}
JSONObjectjson=newJSONObject(result);
instream.close();
@ -328,16 +363,16 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -328,16 +363,16 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -349,20 +384,22 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -349,20 +384,22 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -374,7 +411,7 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -374,7 +411,7 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -389,7 +426,6 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -389,7 +426,6 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -401,7 +437,8 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -401,7 +437,8 @@ public class UtorrentAdapter implements IDaemonAdapter {
@ -433,14 +470,14 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -433,14 +470,14 @@ public class UtorrentAdapter implements IDaemonAdapter {
privatePriorityconvertUtorrentPriority(intcode){
switch(code){
case0:
returnPriority.Off;
case1:
returnPriority.Low;
case3:
returnPriority.High;
default:
returnPriority.Normal;
case0:
returnPriority.Off;
case1:
returnPriority.Low;
case3:
returnPriority.High;
default:
returnPriority.Normal;
}
}
@ -449,38 +486,17 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -449,38 +486,17 @@ public class UtorrentAdapter implements IDaemonAdapter {
return2;
}
switch(newPriority){
caseOff:
return0;
caseLow:
return1;
caseHigh:
return3;
default:
return2;
caseOff:
return0;
caseLow:
return1;
caseHigh:
return3;
default:
return2;
}
}
// These are the positions inside the JSON response array of a torrent
// See http://forum.utorrent.com/viewtopic.php?id=25661
@ -490,7 +506,7 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -490,7 +506,7 @@ public class UtorrentAdapter implements IDaemonAdapter {
floatavailable=((float)tor.getInt(RPC_AVAILABILITY_IDX))/65536f;// Integer in 1/65536ths
floatavailable=((float)tor.getInt(RPC_AVAILABILITY_IDX))/65536f;// Integer in 1/65536ths
// The full torrent path is not available in uTorrent web UI API
// Guess the torrent's directory based on the user-specific default download dir and the torrent name
Stringdir=null;
@ -505,32 +521,19 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -505,32 +521,19 @@ public class UtorrentAdapter implements IDaemonAdapter {
// uTorrent doesn't give the error message, so just remind that there is some error
status==TorrentStatus.Error?"See GUI for error message":null,
settings.getType()));
status==TorrentStatus.Error?"See GUI for error message":null,settings.getType()));
}
returntorrents;
@ -559,39 +562,35 @@ public class UtorrentAdapter implements IDaemonAdapter {
@@ -559,39 +562,35 @@ public class UtorrentAdapter implements IDaemonAdapter {
}
// These are the positions inside the JSON response array of a torrent
// See http://forum.utorrent.com/viewtopic.php?id=25661
(createPaths?file.getString(RPC_FILENAME_IDX).replace((pathSep.equals("/")?"\\":"/"),pathSep):null),// Relative path; 'wrong' path slashes will be replaced
(createPaths?torrent.getLocationDir()+file.getString(RPC_FILENAME_IDX).replace((pathSep.equals("/")?"\\":"/"),pathSep):null),// Full path; 'wrong' path slashes will be replaced
thrownewDaemonException(DaemonException.ExceptionType.UnexpectedResponse,"Map of objects returned by Vuze, but these object do not have some <info> attached or no <_object_id> is available");
}
@ -396,10 +398,10 @@ public class VuzeAdapter implements IDaemonAdapter {
@@ -396,10 +398,10 @@ public class VuzeAdapter implements IDaemonAdapter {
returnmethod.toString()+(adapter==null?"":" on "+adapter.getType())+(targetTorrent!=null||extras!=null?" with ":"")+(targetTorrent==null?"":targetTorrent.toString()+(targetTorrent!=null&&extras!=null?" and ":""))+(extras==null?"":extras.toString());
returnmethod.toString()+(adapter==null?"":" on "+adapter.getType())+
(targetTorrent!=null||extras!=null?" with ":"")+
(targetTorrent==null?"":targetTorrent.toString()+(extras!=null?" and ":""))+
@ -50,9 +49,9 @@ public class SelfSignedTrustManager implements X509TrustManager {
@@ -50,9 +49,9 @@ public class SelfSignedTrustManager implements X509TrustManager {
@ -75,15 +74,15 @@ public class SelfSignedTrustManager implements X509TrustManager {
@@ -75,15 +74,15 @@ public class SelfSignedTrustManager implements X509TrustManager {
@ -130,7 +131,7 @@ public class TlsSniSocketFactory implements LayeredSocketFactory {
@@ -130,7 +131,7 @@ public class TlsSniSocketFactory implements LayeredSocketFactory {