I'm trying to add this feature : add a download from a directory (/home/user/torrents).
It could be use to quickly add torrents previously downloaded and, mainly, restore the downloads after an ftd crash.
It's quite simple from the ui point of view. I've added a new button to the interface and here is what I have in mind :
Code: Select all
$restore_downloads = $_POST['restore_downloads'];
$user_torrents = '/home/'.$_SESSION['user'].'/torrents/';
if($restore_downloads == 'Restore' && file_exists($user_torrents)) {
$uuid = $_POST['uuid'];
$files = glob($user_torrents.'*.torrent');
foreach($files as $url) {
$dl->add_download($_SESSION['user'], $url, $uuid);
}
}