Shortcomings:
1. Torrent Info thing still pops up at the end of the row, clicking it will get you no-where fast, other than a page of errors.
2. No resume support yet.. I want to know if the thing is stable before i attempt to get resume working and whatnot.
3. Occasionally the file will finish downloading, but will be stuck at 98%(or something close to that) in teh interface.. <- Should be fixed.
4. NO queue support, files are downloaded as soon as the files are submitted. NO pause NO Stop(other than killing it yourself via cli)
First a note on this.. i'm not completely sure why, and dont know if its my box, or torrentflux, or something else, maybe somethings blocking read to the stat file.. i really dont know, So be warned, This is a Beta version, it seems to work, but i'd like for other peoples comments on it.. and perhaps code fixes..
Changes that need to be made:
in index.php:
Search for this:
$url_upload = getRequestVar('url_upload');
After it, but BEFORE if(! $url_upload == '') insert this:
// <DD32>: Check to see its a wget command first.
if( (! $url_upload == '') && (getRequestVar('wget') == 'true') ){
exec("nohup "._BIN_PHP." -f wget.php $url_upload ".$cfg['user']." > /dev/null &");
sleep(2); //sleep so that hopefully the other script has time to write out the stat files.
//Prevent url_upload firing:
$url_upload = '';
}
// </DD32>
Now, to add it to the GUI of the index,
I Chose to add another button along side the URL torrent upload.. If someone thinks theres a better way then this(i didnt want to add another field..) then say so and i'll consider for the next one, hopefully with better performance.
index.php
search for: <input type="Submit" value="<?php echo _GETFILE ?>">
place this after it:
<input type="hidden" name="wget" value="false">
<input type="submit" value="WGet It" onSelect="document.getElementById('wget').value = 'true';" onClick="document.getElementById('wget').value = 'true';" onKeyDown="document.getElementById('wget').value = 'true';">
it should now look like this:
<td>
<hr>
<?php echo _URLFILE ?>:<br>
<input type="text" name="url_upload" size="50">
<input type="Submit" value="<?php echo _GETFILE ?>">
<input type="hidden" name="wget" value="false">
<input type="submit" value="WGet It" onSelect="document.getElementById('wget').value = 'true';" onClick="document.getElementById('wget').value = 'true';" onKeyDown="document.getElementById('wget').value = 'true';">
</td>
</form>
next:
in config.php
add this somewhere, At the end will do:
// <DD32>
define('_BIN_WGET','/usr/bin/wget');
define('_BIN_PHP','/usr/bin/php');
// </DD32>
(Yes following b4rt's convention of external references, correct the paths there if they are wrong. it needs to be the PHP-CLI version.)
Still config.php:
Find this like:
$cfg["file_types_array"] = array("torrent");
replace with:
$cfg["file_types_array"] = array("torrent","url");
(.url files are what i have chosen to hold the http address of the fiel to be downloaded.)
next, Attached to this is 'wget.php', save it into the same fodler as index.php.
(ie. mine is stored in '/www/torrentflux/wget.php')
Hopefully now wget will work when a url is put in the torrent URL upload, and wget is clicked.
Tested with the vanilla plain version, and b4rts codebase, so it should work with both.
Can someone with a better spec box than mine test this out and tell me if its extremely slow?
I've seen apache and mysql processes spike upto 40% cpu each while using these 2, both in the vanilla version and b4rts mods, i'm not completely sure why, and not even sure if its related to this mod or not.. any pointers there would be apreciated as well.
D
(My Box: 500mhz + 450MB ram/ Slackware-current+apache2+php5.1.1+mysql5.0.19)
I Dont see why this wouldnt work on Win32 if TF2.1 was ported over, but i can only say it'll work on linux right now
