TorrentFlux.com Hey, OppTupacShakur, you have 11 messages, 0 are new.
06-27-2007, 12:39:41
Home Help Search Profile Logout donate chat
News:


+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.1 Hacks
| | |-+  Start / Stop / Resume all torrents
« previous next »
Pages: 1 2 [All] Go Down Reply Notify of replies Send this topic Print
Author Topic: Start / Stop / Resume all torrents  (Read 6747 times)
gunn0r
Newbie
*
Offline Offline

Posts: 29


G.I.R.



View Profile Personal Message (Offline)
« on: 05-14-2006, 17:06:28 » Reply with quote

Hi there!

Does anyone know why http://www.torrentflux.com/forum/index.php/topic,43.msg10073.html is not working anymore with TF 2.1?
Report to moderator   Logged

Don't eat yellow snow.
wobbles
Newbie
*
Offline Offline

Posts: 37



View Profile Email Personal Message (Offline)
« Reply #1 on: 05-31-2006, 21:54:16 » Reply with quote

This is a wanted mod and I'm also curious to know why it does not work under 2.1.
Report to moderator   Logged
munk
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 71




View Profile WWW Personal Message (Offline)
« Reply #2 on: 06-02-2006, 07:27:31 » Reply with quote

First of all I would ask the developers to PLEASE add the start/stop all feature in the next release of torrentflux, it's a very useful addition that most major multi-torrent clients worth their salt have already.  If not then at least assign the torrent starting functionality to a function of it's own rather than having it in the index.php where it can't be reused without copy/pasting.

This hack adds start all/stop all functionality to torrentflux 2.1 to allow a logged in admin user to start/stop all torrents with one click of a button.  The start/stop all buttons are added towards the bottom right of the main index page, just above the section that indicates the current down/upload speeds. 

Only torrents that have already been started at least once can be affected by the start/stop all buttons - to start torrents that haven't already been started would need a slightly different approach.  It's not always a good idea to blindly start all torrents in the torrent list, at least not for me anyway.  I use the start stop all functionality from a cronjob to stop all torrents at 6pm and then restart them all at midnight.  However I also have a utility that imports torrents automatically as well and I don't necessarily always want to start all of these before I've checked them over.  The best thing would be to have a setting in the control panel to allow the user to 'start/stop all torrents including NEW torrents'.  Again though that's one for the feature request list really in a future version of tf.

Ok on to the mod...


---
1. Find the line in index.php that reads:

Code
$drivespace = getDriveSpace($cfg["path"]);

and modify it to read:

Code
$drivespace = getDriveSpace($cfg["path"]);
 
// Did the user issue the stop all command?
if(isset($_REQUEST["stopall"]) && IsAdmin($cfg["user"]) === true) {
include_once("AliasFile.php");
$dirName = $cfg["torrent_file_path"];
$arList = array();
$file_filter = getFileFilter($cfg["file_types_array"]);
$handle = opendir($dirName);
 
while($entry = readdir($handle)) {
if ($entry != "." && $entry != ".." && !is_dir($dirName."/".$entry)) {
if (ereg($file_filter, $entry)) {
$key = filemtime($dirName."/".$entry).md5($entry);
$arList[$key] = $entry;
}
}
}
 
foreach($arList as $entry) {
$owner = getOwner($entry);
$alias = getAliasName($entry);
$af = new AliasFile($cfg["torrent_file_path"].$alias.".stat", $owner);
 
if ($af->running != "2" && $af->time_left != "Torrent Died") {
if($af->percent_done < 100) {
// The torrent is being stopped but is not completed dowloading
$af->percent_done = ($af->percent_done + 100)*-1;
$af->running = "0";
$af->time_left = "Torrent Stopped";
} else {
// Torrent was seeding and is now being stopped
$af->percent_done = 100;
$af->running = "0";
$af->time_left = "Download Succeeded!";
}
 
// Write out the new Stat File
$af->WriteFile();
}
}
 
// pause to let stat files catch up:
sleep(5);
 
AuditAction("ADMIN", "Stopped All Torrents");
header("location: index.php");
}
 
// Did the user issue the resume all command?
if(isset($_REQUEST["startall"]) && IsAdmin($cfg["user"]) === true) {
   include_once("AliasFile.php");
 
// check to see if the path to the python script is valid
if (!is_file($cfg["btphpbin"]))
{
AuditAction($cfg["constants"]["error"], "Error  Path for ".$cfg["btphpbin"]." is not valid");
if (IsAdmin())
{
header("location: admin.php?op=configSettings");
exit();
}
else
{
$messages .= "<b>Error</b> TorrentFlux settings are not correct (path to python script is not valid) -- please contact an admin.<br>";
}
}
 
$command = "";
 
$rate = getRequestVar('rate');
if (empty($rate))
{
$rate = $cfg["max_upload_rate"];
}
$drate = getRequestVar('drate');
if (empty($drate))
{
$drate = $cfg["max_download_rate"];
}
$superseeder = getRequestVar('superseeder');
if (empty($superseeder))
{
$superseeder = "0"; // should be 0 in most cases
}
$runtime = getRequestVar('runtime');
if (empty($runtime))
{
$runtime = $cfg["torrent_dies_when_done"];
}
 
$maxuploads = getRequestVar('maxuploads');
if (empty($maxuploads))
{
$maxuploads = $cfg["max_uploads"];
}
$minport = getRequestVar('minport');
if (empty($minport))
{
$minport = $cfg["minport"];
}
$maxport = getRequestVar('maxport');
if (empty($maxport))
{
$maxport = $cfg["maxport"];
}
$rerequest = getRequestVar("rerequest");
if (empty($rerequest))
{
$rerequest = $cfg["rerequest_interval"];
}
$sharekill = getRequestVar('sharekill');
 
if ($runtime == "True" )
$sharekill = "-1";
 
if (empty($sharekill))
{
$sharekill = $cfg["sharekill"];
}
 
// Build up a list of torrents to start, $arList:
$dirName = $cfg["torrent_file_path"];
$arList = array();
$file_filter = getFileFilter($cfg["file_types_array"]);
$handle = opendir($dirName);
$command = "";
 
while($entry = readdir($handle)) {
if ($entry != "." && $entry != ".." && !is_dir($dirName."/".$entry)) {
if (ereg($file_filter, $entry)) {
$key = filemtime($dirName."/".$entry).md5($entry);
$arList[$key] = $entry;
}
}
}
 
// For each torrent, if not running start it now:
foreach($arList as $entry) {
$owner = getOwner($entry);
$alias = getAliasName($entry);
$af = new AliasFile($cfg["torrent_file_path"].$alias.".stat", $owner);
 
if ($af->running == 0 ) {
$af->StartTorrentFile();  // this only writes out the stat file (does not start torrent)
if (usingTornado())
{
$command = $runtime." ".$sharekill." ".$cfg["torrent_file_path"].$alias.".stat ".$owner." --responsefile '".$cfg["torrent_file_path"].$entry."' --display_interval 5 --max_download_rate ". $drate ." --max_upload_rate ".$rate." --max_uploads ".$maxuploads." --minport ".$minport." --maxport ".$maxport." --rerequest_interval ".$rerequest." --super_seeder ".$superseeder;
 
if(file_exists($cfg["torrent_file_path"].$alias.".prio")) {
$priolist = explode(',',file_get_contents($cfg["torrent_file_path"].$alias.".prio"));
$priolist = implode(',',array_slice($priolist,1,$priolist[0]));
$command .= " --priority ".$priolist;
}
 
$command .= " ".$cfg["cmd_options"]." > /dev/null &";
 
if (! array_key_exists("pythonCmd", $cfg))
{
insertSetting("pythonCmd","/usr/bin/python");
}
 
if (! array_key_exists("debugTorrents", $cfg))
{
insertSetting("debugTorrents", "0");
}
 
if (!$cfg["debugTorrents"])
{
$pyCmd = $cfg["pythonCmd"] . " -OO";
}else{
$pyCmd = $cfg["pythonCmd"];
}
 
$command = "cd " . $cfg["path"] . $owner . "; HOME=".$cfg["path"]."; export HOME; nohup " . $pyCmd . " " .$cfg["btphpbin"] . " " . $command;
}
else
{
$messages .= "<b>Error</b> BitTornado is only supported Client at this time.<br>";
}
 
// write the session to close so older version of PHP will not hang
session_write_close("TorrentFlux");
 
// Start command safely:
$result=shell_exec($command);
AuditAction($cfg["constants"]["start_torrent"], $torrent."<br>Die:".$runtime.", Sharekill:".$sharekill.", MaxUploads:".$maxuploads.", DownRate:".$drate.", UploadRate:".$rate.", Ports:".$minport."-".$maxport.", SuperSeed:".$superseeder.", Rerequest Interval:".$rerequest);
 
// slow down and wait for thread to kick off.
// otherwise on fast servers it will kill stop it before it gets a chance to run.
sleep(1);
}
 
if ($messages != "")
{
AuditAction($cfg["constants"]["error"], $messages);
}
}
 
// Finally redirect to index page:
header("location: index.php");
}
 

2. Towards the end of index.php find this:

Code
            <table>
           <tr>
               <td class="tiny" align="right"><?php echo _CURRENTDOWNLOAD ?>:</td>
               <td class="tiny"><strong><?php echo number_format($cfg["total_download"], 2); ?></strong> kB/s</td>
           </tr>
 

and modify it to read:

Code
            <table>
<?php
if(IsAdmin()) {
?>
           <tr>
               <td class="tiny" align="right">Start/Stop All Torrents: </td>
               <td class="tiny"><a href="?stopall=now"><img src="images/kill.gif" title="Stop all torrents" border="0" /></a> <a href="?startall=now"><img src="images/run_on.gif" title="Start all torrents" border="0" alt="Start/Resume All Torrents"></a></td>
           </tr>
<?php
}
?>
           <tr>
               <td class="tiny" align="right"><?php echo _CURRENTDOWNLOAD ?>:</td>
               <td class="tiny"><strong><?php echo number_format($cfg["total_download"], 2); ?></strong> kB/s</td>
           </tr>
 
« Last Edit: 06-02-2006, 07:36:26 by munk » Report to moderator   Logged

Running:
FreeBSD 4.11-STABLE
Apache/1.3.36 (Unix)
PHP 4.4.2
MySQL 4.0.27-log
Python 2.4.3

Current Mods: Remember Me|Start/Stop All|Enhanced Link List|Multi Torrent Uploads|Multi File Delete

FreeBSD Torrentflux Fix

Torrentflux-b4rt
gunn0r
Newbie
*
Offline Offline

Posts: 29


G.I.R.



View Profile Personal Message (Offline)
« Reply #3 on: 06-02-2006, 07:38:53 » Reply with quote

munk,

thank you very much! this is excatly what I was after Grin
Report to moderator   Logged

Don't eat yellow snow.
munk
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 71




View Profile WWW Personal Message (Offline)
« Reply #4 on: 06-02-2006, 07:43:07 » Reply with quote

np hope it helps.
Report to moderator   Logged

Running:
FreeBSD 4.11-STABLE
Apache/1.3.36 (Unix)
PHP 4.4.2
MySQL 4.0.27-log
Python 2.4.3

Current Mods: Remember Me|Start/Stop All|Enhanced Link List|Multi Torrent Uploads|Multi File Delete

FreeBSD Torrentflux Fix

Torrentflux-b4rt
wobbles
Newbie
*
Offline Offline

Posts: 37



View Profile Email Personal Message (Offline)
« Reply #5 on: 06-02-2006, 21:05:24 » Reply with quote

Hey munk, tried to add this to the vanilla install for b4rt 8.2. Had no success, got to step 2 and failed to find the code requested in index.php.

Please help? Embarrassed

In the end, this is an a+ mod to add

cheers!:>
Report to moderator   Logged
b4rt
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 542



View Profile WWW Email Personal Message (Offline)
« Reply #6 on: 06-02-2006, 21:49:55 » Reply with quote

Hey munk, tried to add this to the vanilla install for b4rt 8.2. Had no success, got to step 2 and failed to find the code requested in index.php.

Please help? Embarrassed

In the end, this is an a+ mod to add

cheers!:>

you cant apply this as described here because in my codebase i have done what munk wants :
If not then at least assign the torrent starting functionality to a function of it's own rather than having it in the index.php where it can't be reused without copy/pasting.

writing a "do on all" function is very simple in my codebase as i have written functions not only for starting a client but
for everything flux can do on torrent-clients (including those operations flux 2.1 cant do):

just a snip-example from "fluxcli.php" which does stop all running clients:
Code:
$torrents = getTorrentListFromFS();
foreach ($torrents as $torrent) {
if (isTorrentRunning($torrent))
cliStopTorrent($torrent);
}

take a look into my index.php or multi.php to see how you start a torrent-client with a function-call.
(so batch-calls on multiple torrents dont need something like "http-getting")

if you need/want further details post in the other thread to keep things in place or drop me a pm.


EDIT:
this post is in reference to the post above as wobbles stated he uses my version and this hack wont work on my v82 in this form.
ignore this (my post) if you run a 2.1 final.

EDIT2:
just released v83 which has an implementation like this integrated. its possible to "start all"/"resume all"/"stop all" torrent-clients.

regards,
b4rt
« Last Edit: 06-03-2006, 21:46:48 by b4rt » Report to moderator   Logged

torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
munk
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 71




View Profile WWW Personal Message (Offline)
« Reply #7 on: 06-05-2006, 15:55:03 » Reply with quote

Good work b4rt Smiley
Report to moderator   Logged

Running:
FreeBSD 4.11-STABLE
Apache/1.3.36 (Unix)
PHP 4.4.2
MySQL 4.0.27-log
Python 2.4.3

Current Mods: Remember Me|Start/Stop All|Enhanced Link List|Multi Torrent Uploads|Multi File Delete

FreeBSD Torrentflux Fix

Torrentflux-b4rt
Yokisho
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 7



View Profile Email Personal Message (Offline)
« Reply #8 on: 06-05-2006, 18:27:57 » Reply with quote

can anybody write an update script for TF-2.1?

Thanks!!
Report to moderator   Logged

Debian Sarge 3.1r1 - kernel 2.4.27-2-686
Apache 1.3.33 (Php-4.3.10-16, )
Paczesiowa
Full Member
***
Offline Offline

TF Base: Linux 2.x
Posts: 177



View Profile Email Personal Message (Offline)
« Reply #9 on: 06-09-2006, 09:23:11 » Reply with quote

dude it's working for 2.1 ...


anyway here is modifed step one for people using transmission:

sry it's format looks like [crud] but windows notepad sux:] and I'm not that desperate to use with linux console editor:]

Code
$drivespace = getDriveSpace($cfg["path"]);
 
 
 
// Did the user issue the stop all command?
 
if(isset($_REQUEST["stopall"]) && IsAdmin($cfg["user"]) === true) {
 
include_once("AliasFile.php");
 
$dirName = $cfg["torrent_file_path"];
 
$arList = array();
 
$file_filter = getFileFilter($cfg["file_types_array"]);
 
$handle = opendir($dirName);
 
 
 
while($entry = readdir($handle)) {
 
if ($entry != "." && $entry != ".." && !is_dir($dirName."/".$entry)) {
 
if (ereg($file_filter, $entry)) {
 
$key = filemtime($dirName."/".$entry).md5($entry);
 
$arList[$key] = $entry;
 
}
 
}
 
}
 
 
 
foreach($arList as $entry) {
 
$owner = getOwner($entry);
 
$alias = getAliasName($entry);
 
$af = new AliasFile($cfg["torrent_file_path"].$alias.".stat", $owner);
 
 
 
if ($af->running != "2" && $af->time_left != "Torrent Died") {
 
if($af->percent_done < 100) {
 
// The torrent is being stopped but is not completed dowloading
 
$af->percent_done = ($af->percent_done + 100)*-1;
 
$af->running = "0";
 
$af->time_left = "Torrent Stopped";
 
} else {
 
// Torrent was seeding and is now being stopped
 
$af->percent_done = 100;
 
$af->running = "0";
 
$af->time_left = "Download Succeeded!";
 
}
 
 
 
// Write out the new Stat File
 
$af->WriteFile();
 
}
 
}
 
 
 
// pause to let stat files catch up:
 
sleep(5);
 
 
 
AuditAction("ADMIN", "Stopped All Torrents");
 
header("location: index.php");
 
}
 
 
 
// Did the user issue the resume all command?
 
if(isset($_REQUEST["startall"]) && IsAdmin($cfg["user"]) === true) {
 
   include_once("AliasFile.php");
 
 
 
// check to see if the path to the python script is valid
 
if (!is_file($cfg["btphpbin"]))
 
{
 
AuditAction($cfg["constants"]["error"], "Error  Path for ".$cfg["btphpbin"]." is not valid");
 
if (IsAdmin())
 
{
 
header("location: admin.php?op=configSettings");
 
exit();
 
}
 
else
 
{
 
$messages .= "<b>Error</b> TorrentFlux settings are not correct (path to python script is not valid) -- please contact an admin.<br>";
 
}
 
}
 
 
 
$command = "";
 
 
 
$rate = getRequestVar('rate');
 
if (empty($rate))
 
{
 
$rate = $cfg["max_upload_rate"];
 
}
 
$drate = getRequestVar('drate');
 
if (empty($drate))
 
{
 
$drate = $cfg["max_download_rate"];
 
}
 
$superseeder = getRequestVar('superseeder');
 
if (empty($superseeder))
 
{
 
$superseeder = "0"; // should be 0 in most cases
 
}
 
$runtime = getRequestVar('runtime');
 
if (empty($runtime))
 
{
 
$runtime = $cfg["torrent_dies_when_done"];
 
}
 
 
 
$maxuploads = getRequestVar('maxuploads');
 
if (empty($maxuploads))
 
{
 
$maxuploads = $cfg["max_uploads"];
 
}
 
$minport = getRequestVar('minport');
 
if (empty($minport))
 
{
 
$minport = $cfg["minport"];
 
}
 
$maxport = getRequestVar('maxport');
 
if (empty($maxport))
 
{
 
$maxport = $cfg["maxport"];
 
}
 
$rerequest = getRequestVar("rerequest");
 
if (empty($rerequest))
 
{
 
$rerequest = $cfg["rerequest_interval"];
 
}
 
$sharekill = getRequestVar('sharekill');
 
 
 
if ($runtime == "True" )
 
$sharekill = "-1";
 
 
 
if (empty($sharekill))
 
{
 
$sharekill = $cfg["sharekill"];
 
}
 
 
 
// Build up a list of torrents to start, $arList:
 
$dirName = $cfg["torrent_file_path"];
 
$arList = array();
 
$file_filter = getFileFilter($cfg["file_types_array"]);
 
$handle = opendir($dirName);
 
$command = "";
 
 
 
while($entry = readdir($handle)) {
 
if ($entry != "." && $entry != ".." && !is_dir($dirName."/".$entry)) {
 
if (ereg($file_filter, $entry)) {
 
$key = filemtime($dirName."/".$entry).md5($entry);
 
$arList[$key] = $entry;
 
}
 
}
 
}
 
 
 
// For each torrent, if not running start it now:
 
foreach($arList as $entry) {
 
$owner = getOwner($entry);
 
$alias = getAliasName($entry);
 
$af = new AliasFile($cfg["torrent_file_path"].$alias.".stat", $owner);
 
 
 
if ($af->running == 0 ) {
 
$af->StartTorrentFile();  // this only writes out the stat file (does not start torrent)
 
if (usingTornado())
 
{
 
$command = $runtime." ".$sharekill." ".$cfg["torrent_file_path"].$alias.".stat ".$owner." --responsefile '".$cfg["torrent_file_path"].$entry."' --display_interval 5 --max_download_rate ". $drate ." --max_upload_rate ".$rate." --max_uploads ".$maxuploads." --minport ".$minport." --maxport ".$maxport." --rerequest_interval ".$rerequest." --super_seeder ".$superseeder;
 
 
 
if(file_exists($cfg["torrent_file_path"].$alias.".prio")) {
 
$priolist = explode(',',file_get_contents($cfg["torrent_file_path"].$alias.".prio"));
 
$priolist = implode(',',array_slice($priolist,1,$priolist[0]));
 
$command .= " --priority ".$priolist;
 
}
 
 
 
$command .= " ".$cfg["cmd_options"]." > /dev/null &";
 
 
 
if (! array_key_exists("pythonCmd", $cfg))
 
{
 
insertSetting("pythonCmd","/usr/bin/python");
 
}
 
 
 
if (! array_key_exists("debugTorrents", $cfg))
 
{
 
insertSetting("debugTorrents", "0");
 
}
 
 
 
if (!$cfg["debugTorrents"])
 
{
 
$pyCmd = $cfg["pythonCmd"] . " -OO";
 
}else{
 
$pyCmd = $cfg["pythonCmd"];
 
}
 
 
 
$command = "cd " . $cfg["path"] . $owner . "; HOME=".$cfg["path"]."; export HOME; nohup " . $pyCmd . " " .$cfg["btphpbin"] . " " . $command;
 
}
 
else
 
{
           // Sylver : What is missing in Transmission integration here :
           // - Queing system
           // - Priority management ?
           if (usingTransmission())
           {
               if ($cfg["AllowQueing"] == 0)
               {
               $command = " -t \"".$cfg["torrent_file_path"].$alias.".stat\""." -w ".$owner." -p ".$minport." -u ".$rate." -d ".$drate." -e 5 -c ".$sharekill." \"".$cfg["torrent_file_path"].$entry."\"";
               $command .= " ".$cfg["cmd_options"]." > /dev/null &";
 
               // This file is being started manually.
               $command = "cd " . $cfg["path"] . $owner . "; HOME=".$cfg["path"]."; export HOME; nohup " . $cfg["btphpbin"] . " " . $command;
               }
               else
               {
               $messages .= "<b>Error</b> No queing support for Tranmsission yet. Please disable queing option.<br>";
               }
           }
           else
           {
               // Must be using the Original BitTorrent Client
               // This is now being required to allow Queing functionality
               //$command = "cd " . $cfg["path"] . $owner . "; nohup " . $cfg["btphpbin"] . " ".$runtime." ".$sharekill." ".$cfg["torrent_file_path"].$alias.".stat ".$owner." --responsefile \"".$cfg["torrent_file_path"].$torrent."\" --display_interval 5 --max_download_rate ". $drate ." --max_upload_rate ".$rate." --max_uploads ".$maxuploads." --minport ".$minport." --maxport ".$maxport." --rerequest_interval ".$rerequest." ".$cfg["cmd_options"]." > /dev/null &";
               $messages .= "<b>Error</b> BitTornado is only supported Client at this time.<br>";
           }
}
 
 
 
// write the session to close so older version of PHP will not hang
 
session_write_close("TorrentFlux");
 
 
 
// Start command safely:
 
$result=shell_exec($command);
 
 
AuditAction($cfg["constants"]["start_torrent"], $torrent."<br>Die:".$runtime.", Sharekill:".$sharekill.", MaxUploads:".$maxuploads.", DownRate:".$drate.", UploadRate:".$rate.", Ports:".$minport."-".$maxport.", SuperSeed:".$superseeder.", Rerequest Interval:".$rerequest);
 
 
 
// slow down and wait for thread to kick off.
 
// otherwise on fast servers it will kill stop it before it gets a chance to run.
 
sleep(1);
 
}
 
 
 
if ($messages != "")
 
{
 
AuditAction($cfg["constants"]["error"], $messages);
 
}
 
}
 
 
 
 
// Finally redirect to index page:
 
header("location: index.php");
 
}
« Last Edit: 06-09-2006, 09:25:14 by Paczesiowa » Report to moderator   Logged

wobbles
Newbie
*
Offline Offline

Posts: 37



View Profile Email Personal Message (Offline)
« Reply #10 on: 06-10-2006, 18:22:52 » Reply with quote

B4rt's mod is great! However, is possible to onl start/stop torrents and only seed. Do download is done?

I'm looking for this mod to do with the above cause when having a download limit with a isp only let me do so much. But, upload is not counted as metered usage.

Seeding /sharing is carring!!

Any help would be great!

Cheers!:>
Report to moderator   Logged
strav
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 1



View Profile Personal Message (Offline)
« Reply #11 on: 10-19-2006, 05:39:14 » Reply with quote

Hey all,

First off, thanks for making this patch.  In actuality, I was looking for that 'slightly different approach' to start all NEW torrents (and torrents which hadn't completed seeding) so I made a simple change to do that.  All I did was change the line:

if ($af->running == 0 ) {

to

if (($af->running == 0 || $af->running == 2) && !($af->percent_done == 100 && $af->sharing >= $af->sharelimit) ) {

I didn't have a whole lot of time to explore the code, but it so far it is behaving the way I wanted it to.
Report to moderator   Logged
Delusion
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 8



View Profile Personal Message (Offline)
« Reply #12 on: 10-26-2006, 20:54:16 » Reply with quote

Hey all,

First off, thanks for making this patch.  In actuality, I was looking for that 'slightly different approach' to start all NEW torrents (and torrents which hadn't completed seeding) so I made a simple change to do that.  All I did was change the line:

if ($af->running == 0 ) {

to

if (($af->running == 0 || $af->running == 2) && !($af->percent_done == 100 && $af->sharing >= $af->sharelimit) ) {

I didn't have a whole lot of time to explore the code, but it so far it is behaving the way I wanted it to.

thanks man, fixed my problem starting "NEW" torrents Smiley
works like a charm, 2.1
gj
Report to moderator   Logged
qiuness
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 36



View Profile Email Personal Message (Offline)
« Reply #13 on: 11-01-2006, 17:23:54 » Reply with quote

i have the xfer bandwidth hack and in the first hack i cant find this:

Code:
<table>
            <tr>
                <td class="tiny" align="right"><?php echo _CURRENTDOWNLOAD ?>:</td>
                <td class="tiny"><strong><?php echo number_format($cfg["total_download"], 2); ?></strong> kB/s</td>
            </tr>

so id doesnt work...
Report to moderator   Logged
Workshed
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 10



View Profile Personal Message (Offline)
« Reply #14 on: 11-23-2006, 13:25:55 » Reply with quote

Don't suppose anyone knows of any way to get this hack to still respect the queue do they?
Report to moderator   Logged
Beowulf
Newbie
*
Offline Offline

Posts: 28



View Profile Email Personal Message (Offline)
« Reply #15 on: 02-04-2007, 15:52:48 » Reply with quote

Does anybody know, if this hack works with TF 2.3 final? Would be nice to know.
Report to moderator   Logged
snakeboy
Newbie
*
Offline Offline

Posts: 10



View Profile Personal Message (Offline)
« Reply #16 on: 02-05-2007, 13:09:52 » Reply with quote

Does anybody know, if this hack works with TF 2.3 final? Would be nice to know.

 -  I second that!  Wink

-snake
Report to moderator   Logged
Beowulf
Newbie
*
Offline Offline

Posts: 28



View Profile Email Personal Message (Offline)
« Reply #17 on: 02-07-2007, 18:49:04 » Reply with quote

Maybe my English isn't good enough. What does "second that" mean?

Main problem could be this line:

Code:
<table>
            <tr>
                <td class="tiny" align="right"><?php echo _CURRENTDOWNLOAD ?>:</td>
                <td class="tiny"><strong><?php echo number_format($cfg["total_download"], 2); ?></strong> kB/s</td>
            </tr>

I habe installed Xfer-hack and cannot find those lines because xfer deletes them  Cry
« Last Edit: 02-07-2007, 20:54:33 by Beowulf » Report to moderator   Logged
Igloo
Newbie
*
Offline Offline

Posts: 13



View Profile Personal Message (Offline)
« Reply #18 on: 02-24-2007, 18:04:30 » Reply with quote

Just a quick note to say that it works fine in 2.3 . I have it in a very random place atm, But it works, That's all i care about Smiley
Report to moderator   Logged
2shae
Newbie
*
Offline Offline

Posts: 4



View Profile Email Personal Message (Offline)
« Reply #19 on: 03-04-2007, 11:05:38 » Reply with quote

brilliant piece of code, i had big problems with torrents not closing properly which annoyed me greatly. thanks for this
Report to moderator   Logged
studioeng
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 7



View Profile Personal Message (Offline)
« Reply #20 on: 04-10-2007, 08:44:58 » Reply with quote

I have been trying to add this hack to my tf2.3 which is currently using the xfer addon.

I cannot seem to get this hack to work. The buttons appear and the page refreshes when you click on either of the buttons, but no action is taken.

I have tried to follow all of the threads which relate to this, and I am just getting more and more confused to why it doesn't work. Is there a 'final' code which I can use which works with tf2.3??

Cheers

PS What's the deal with this thread?? It's too wide for the page  Huh?
Report to moderator   Logged
Discovery
Newbie
*
Offline Offline

Posts: 19



View Profile Personal Message (Offline)
« Reply #21 on: 04-21-2007, 20:12:30 » Reply with quote

This hack works great, I was wondering how to restart all torrents as a "Super Seeder" as I don't know what command I'm looking for.

thanks
Discovery
Report to moderator   Logged
Epeli
Newbie
*
Offline Offline

Posts: 1



View Profile Email Personal Message (Offline)
« Reply #22 on: 05-06-2007, 03:30:54 » Reply with quote

Yeah, it works fine with 2.3.

Btw, has anyone got some hack for autostart new/incomplete torrents working with 2.3?
Report to moderator   Logged
dave-5b
Newbie
*
Offline Offline

Posts: 1



View Profile Personal Message (Offline)
« Reply #23 on: 06-05-2007, 01:07:39 » Reply with quote

Hey,
I am a complete n00b when it comes to any scripting languages, but i managed to get torrentflux and teh stop/start all hack installed with minimal fuss (so i owe you guys and the ubuntu package maintainers copious amounts of alcohol  Smiley )

But can anyone point me at a way of doing this automatically (to take advantage of off-peak download limit)

i have been using:
killall python -s SIGCONT/STOP
as a cron job but my internet connection has been acting very funny (slow) since and this, in general seems a very ugly way to go about things

Thanks!
Report to moderator   Logged
ibezans
Newbie
*
Offline Offline

Posts: 1



View Profile Personal Message (Offline)
« Reply #24 on: 06-23-2007, 18:06:50 » Reply with quote

I've also been able to hack 2.3 to use the start/stop all functionality.  However, I've run into another issue with it (may be specific
 to 2.3).  Here's the scenario:

I have multiple websites on my system, so I rotate the logs every night.  Part of this process requires me to restart apache2. 
Doing so kills all of the active torrents.  Obviously, this hack will allow me to log back in and start all of the torrents with a
single-click, and I've noted that others with previous versions of TF (2.1, specifically) have been able to use wget, via cron, to
 achieve this.

The issue that I've come across is that when I use wget it looks as though TF is presenting me with a login page, asking me to
validate my login credentials:

Here is how I'm calling the page, via wget:
wget --http-user=myuser --http-password=mypass --wait=3 --retry-connrefused --ignore-length 'http://localhost/torrentflux/index.php?startall=now'

Maybe I'm just taking the wrong approach to the cronjob, though  Wink  Any thoughts/help?
Report to moderator   Logged
Pages: 1 2 [All] Go Up Reply Notify of replies Send this topic Print 
« previous next »
Jump to:  


Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP