its only a start, but it's functional. I
couldn't find a working version of this or enough of a
lead so I made my own. Here ya go.
Add this to your
index.php by searching for delfile and editing there. I
only added 3 lines near the top of this. Make sure you
create a folder called 'completed' in the same
folder as the user folders or change the path or name or
whatever.
$delfile =
getRequestVar('delfile');
if(! $delfile ==
'')
{
$alias_file =
getRequestVar('alias_file');
if
(($cfg["user"] == getOwner($delfile)) ||
IsAdmin())
{
$command = "mv
\"".$cfg["path"].$cfg["user"]."/".get_data_name($delfile,false)."\"
".$cfg["path"]."completed/"; //get the raw command for
moving the file to the completed folder
$output =
shell_exec($command); //execute move command, store
output in $output
echo $output; //it
apparently needs this to be happy and work. Got
me.
@unlink($cfg["torrent_file_path"].$delfile);
@unlink($cfg["torrent_file_path"].$alias_file);
// try to remove the QInfo if in
case it was queued.
@unlink($cfg["torrent_file_path"]."queue/".$alias_file.".Qinfo");
// try to remove the pid
file
@unlink($cfg["torrent_file_path"].$alias_file.".pid");
@unlink($cfg["torrent_file_path"].getAliasName($delfile).".prio");
AuditAction($cfg["constants"]["delete_torrent"],
$delfile);
$alias =
getAliasName($delfile);
header("location:
index.php");
exit();
}
else
{
AuditAction($cfg["constants"]["error"], $cfg["user"]."
attempted to delete ".$delfile);
}
}
Also add this to the end of your
functions.php file.
function
array_search_partial($needlestring, $haystackarray)
{
if (is_array($haystackarray))
{ // confirms array
$needlelength = strlen($needlestring); //
length of string needle
foreach ($haystackarray as $arraykey =>
$arrayvalue) { // gets array value
$arraypart =
substr($arrayvalue, 0, $needlelength); // first
characters of array value
if ($needlestring == $arraypart) { //
did we find a match
return $arraykey; //
return will stop loop
} // end match conditional
} // end loop
} // end array check
return
false; // no matches found if this
far
}
function get_data_name($torrent,
$allowSave=false)
{
global
$cfg;
$list =
shell_exec("cd " . $cfg["torrent_file_path"]."; " .
$cfg["pythonCmd"] . " -OO " . $cfg["btshowmetainfo"]."
\"".$torrent."\""); //this gets all the 'details.php'
data.
$array =
explode("\n",$list); //explodes the raw data into an
array for searching, delimited by a newline
$key =
array_search_partial("directory name: ", $array); //uses
the above function to search for the array entry
starting with 'directory name:' for the data
path
$filename
= ltrim($array[$key],"directory name: "); //trims the
front off of the array value to get just the directory
name
if(!$key)
{ //if a directory was not found...
$key =
array_search_partial("file name.....:", $array);
//search for a file name
$filename =
ltrim($array[$key],"file name.....: "); //trim the front
for file name alone
}
return $filename;
//return the filename
}
Note that this
does not check to see if the torrent completed or
anything, just when you delete it from the home page it
moves the files. I may add that in if no one else
does.