Download Directory

52 views
Skip to first unread message

AlexandreB

unread,
Sep 27, 2009, 8:21:04 AM9/27/09
to rtGui
Hi everyone, and first thanks for this nice tool !

I have a question, is there a way to change the download directory for
downloaded files ?

I would like to let the user choice via a select input (like movie /
music / games...) when uploading a torrent or choosing a torrent URL

Thanks !

simon

unread,
Sep 28, 2009, 6:17:00 AM9/28/09
to rtGui

This is possible with rtorrent - I think you need to look at the
options available in the .rtorrent.rc file, and set up several watch
directories for each type (movies/music) of torrent you want.

It's not possible to do this in rtGui, and probably won't be in the
near future.

-Simon.

greg

unread,
Sep 29, 2009, 1:00:57 PM9/29/09
to rtGui
I needed this two a few weeks ago and because of the wonder that is
open source software, I was able to just implement it myself!

Basically, you will just be modifying rtgui to save the .torrent in a
specific directory. You will also need to modify your rtorrent
configuration to add an additional watch directory.

For more information on setting up a second watch directory, check
out:
http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#Watchadirectoryfortorrents

On this page, look for the line:
# Watch another directory with a different destination. (0.7.7+)

Once you have that setup, you can modify a bit of the rtgui code to
add this little checkbox. When "mp3?" is checked, it will save the
torrent to my mp3 subdirectory, like so:
http://fletchowns.net/rtgui_patch/rtgui_directory.png

Open up index.php, find the line:
echo "File: <input name='uploadtorrent' type='file' size=25 /> <input
type='submit' value='Go' />\n";

Replace it with:
echo "File: <input name='uploadtorrent' type='file' size=25 /> mp3?
<input name='ismp3' type='checkbox'/> <input type='submit' value='Go' /
>\n";

Now open up control.php and locate this chunk of code:
// Upload torrent file...
if (isset($r_uploadtorrent)) {
if ($_FILES['uploadtorrent']['name']!="") {
$tmpfile=$_FILES['uploadtorrent']['name'];
if (move_uploaded_file($_FILES['uploadtorrent']['tmp_name'],
$watchdir.basename($_FILES['uploadtorrent']['name']))) {
chmod($watchdir.basename($_FILES['uploadtorrent']['name']),
0777);
header("Location: index.php");
} else {
echo "Error moving file - check permissions etc! <a
href=index.php>Continue</a>.\n";
}
die();
}
}

And replace it with this:
// Upload torrent file...
if (isset($r_uploadtorrent)) {
if ($_FILES['uploadtorrent']['name']!="") {
$tmpfile=$_FILES['uploadtorrent']['name'];
$directory = $watchdir;
if ($_POST['ismp3'] == "on")
$directory .= "mp3/";
$directory .= basename($_FILES['uploadtorrent']['name']);
if (move_uploaded_file($_FILES['uploadtorrent']['tmp_name'],
$directory)) {
chmod($watchdir.basename($_FILES['uploadtorrent']['name']),
0777);
header("Location: index.php");
} else {
echo "Error moving file - check permissions etc! <a
href=index.php>Continue</a>.\n";
}
die();
}
}

Basically, this checks to see if our "ismp3" checkbox we added is
checked, and then it sets the download directory accordingly.

Hope this helps! Shouldn't be too hard to add as many checkboxes as
you would like from here.

greg

unread,
Sep 29, 2009, 1:03:46 PM9/29/09
to rtGui
Since google groups added line breaks to my code I posted, here's a
couple links to the modified files:

http://fletchowns.net/rtgui_patch/index.phps
http://fletchowns.net/rtgui_patch/control.phps
Reply all
Reply to author
Forward
Message has been deleted
0 new messages