Open GoogleCodeExporter opened 9 years ago
There are currently no intents to add server settings, no. I am happy to add
this. You can use intents already to open Transdroid but you'll need to know
the (internal) ID of the server. I bet you'd rather give the server name
(although that's not unique strictly speaking)?
Original comment by erickok@gmail.com
on 29 Apr 2011 at 8:45
Thanks for the quick response!
I couldn't (and still can't) find any documentation showing how to open
Transdroid with an ID. However, opening transdroid with the server name and
port rather than ID is necessary because I won't be able to store the internal
ID anywhere due to the way I am handling communication between the Bytesized
API and the App.
Note that for the intent to add server settings, I will be able to provide all
the settings needed for the server, from the bytesized API as parameters to the
intent.
Original comment by darthc...@googlemail.com
on 29 Apr 2011 at 1:17
There's no documentation on opening with some ID (since there is no way to
determine the right ID anyway as of yet).
Probably best is to have two intents. To add a server:
Intent i = new Intent("org.transdroid.control.ADD_SERVER");
// Mandatory
i.putExtra("NAME", "Some custom name");
i.putExtra("TYPE", "daemon_transmission"); // Code of the torrent client type;
see
http://code.google.com/p/transdroid/source/browse/trunk/res/values/arrays.xml
i.putExtra("ADDRESS", "192.168.1.1"); // Or www.someaddress.com
i.putExtra("PORT", "0000"); // Port number
// Optional
i.putExtra("AUTH", "true"); // "true" or "false"
i.putExtra("USER", "username");
i.putExtra("PASS", "password"); // Plain text password
i.putExtra("FOLDER", "/path/to/folder"); // Some torrent clients have a
(sometimes optional) folder
i.putExtra("SSL", "false"); // "true" or "false"
i.putExtra("SSL_ACCEPTALL", "true"); // "true" or "false", whether to accept
all certificates
i.putExtra("SSL_CERT", "somekey"); // Raw SSL certificate key
i.putExtra("OS", "type_linux"); // Code of the OS type; see
http://code.google.com/p/transdroid/source/browse/trunk/res/values/arrays.xml
i.putExtra("DOWNLOADDIR", "/path/to/download/dir");
i.putExtra("FTPURL", "ftp://user@address/path/to/downloads");
i.putExtra("ALARMFINISHED", "true");
i.putExtra("ALARMNEW", "false");
startActivity(i);
This would start the 'add server' preferences screen with all the above
specified settings filled in (and defaults for the omitted settings).
Then start Transdroid with:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("transdroid://username@address:port")));
This will start Transdroid and shows the first server that matches the address,
port and username (or at least those specified in the transdroid:// url).
(You cannot start Transdroid this way without adding the server first. I might
add that later but I'll have to think about how to specify the daemon type in
that case; maybe via alternative schemes such as deluge:// and transmission://)
Sounds good?
Original comment by erickok@gmail.com
on 29 Apr 2011 at 1:55
Thanks! That would be absolutely brilliant, except I would suggest a few small
changes.
For the ADD_SERVER intent, I would suggest returning a result which is whether
the server was added or not. (This assumes that transdroid would close once the
server was saved (or cancelled).)
Also, it may be a good idea to enforce some form of temporary encoding such as
base64 on the password field, so it isn't passed via plain text.
For the ACTION_VIEW intent (if it is possible - I don't know), I would suggest
returning a result which is whether a server was found.
This would enable the following pseudocode to work
try {
if (!runTransdroid(serverdetails)) {
if (addServer(serverdetails)) {
if (!runTransdroid(serverdetails)) {
showMessage("Could not run transdroid");
}
}
else {
showMessage("Could not add server details");
}
}
}
catch (ActivityNotFoundException) {
showMessage("Please install Transdroid to use this feature");
}
One problem with the URI transdroid://username@address:port however is that
deluge doesn't accept usernames. How would this be handled?
Original comment by darthc...@googlemail.com
on 29 Apr 2011 at 2:58
I will make the activities return a RESULT_CANCELED or RESULT_OK accordingly.
You can grab these by starting the activities with startAcitivyForresult(i) and
getting the resultCode. Of course you will not get these back until the
activity closes. In case of the server add this will be after the user confirms
the adding of the server. In case of the normal startup (to some specific
server) that may be near-instant (if the server could not be found) or, well,
possibly never if the server was found. Your app logic will do something like:
private static final int ADD_SERVER = 0;
private static final int SHOW_SERVER = 0;
try {
Intent i = new Intent("org.transdroid.control.ADD_SERVER");
// setttings
startActivityForResults(i, ADD_SERVER);
} catch (ActivityNotFoundException) {
showMessage("Please install Transdroid to use this feature");
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ADD_SERVER) {
if (resultCode == RESULT_OK) {
startActivityForResult(new Intent(Intent.ACTION_VIEW,
Uri.parse("transdroid://username@address:port")), SHOW_SERVER);
} else {
showMessage("Adding of server was cancelled");
}
} else if (requestCode == SHOW_SERVER) {
if (resultCode == RESULT_CANCELLED) {
showMessage("Server to show was not found!");
}
}
}
You may omit the username for Deluge servers and just use
transdroid://address:port
Original comment by erickok@gmail.com
on 30 Apr 2011 at 7:38
[deleted comment]
Hi.
I am soon going to be working on version 2 of the app that I was going to
include the use of this in. (Version 1 has been available from
https://play.google.com/store/apps/details?id=com.bytesizedhosting.api.android.d
arthcrap since June 2011).
Is there any update on the progress?
Thanks.
Original comment by darthc...@googlemail.com
on 3 Sep 2012 at 5:07
Sorry, I haven't worked on this feature yet. Do you have some deadline? As I
have a too little time to work on it at the moment.
Original comment by erickok@gmail.com
on 1 Oct 2012 at 3:56
No. There is no deadline, as I am writing the app on a volunteer basis.
If it could be done before December 15th, that would be good, but it is not
essential - that is when my semester at university finishes, and thus when I'll
have some free time . I was going to work on the app in September but that
never materialized.
I was mainly making sure the ticket hadn't been completely abandoned.
Thanks
Original comment by darthc...@googlemail.com
on 1 Oct 2012 at 5:52
Original issue reported on code.google.com by
darthc...@googlemail.com
on 28 Apr 2011 at 5:25