TorrentFlux.com Hey, OppTupacShakur, you have 11 messages, 0 are new.
05-07-2007, 11:39:52
Home Help Search Profile Logout donate chat
News:


+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.1 Hacks
| | |-+  Patch for estimated time column
« previous next »
Pages: [1] Go Down Reply Notify of replies Send this topic Print
Author Topic: Patch for estimated time column  (Read 453 times)
shuttlebox
Newbie
*
Offline Offline

Posts: 2



View Profile Personal Message (Offline)
« on: 12-15-2006, 08:59:42 » Reply with quote

When a torrent slows down to 0 KB/s the estimated download time starts increasing like crazy, it's not uncommon to have a value like "632436487624868258726587265872d 12:34:56" in there and it breaks the page layout making everything ugly.

I just stole the trimming function for the Torrent File column and used it for the estTime variable. I'm sure there's a nicer way to do it but it worked for me and something similar should be done for the next release me thinks.  Smiley

Code:
--- functions.php.061212        2006-12-12 23:38:51.949219000 +0100
+++ functions.php       2006-12-12 23:43:18.073651500 +0100
@@ -2294,6 +2294,12 @@
             if ($af->time_left != "" && $af->time_left != "0")
             {
                 $estTime = $af->time_left;
+                if(strlen($estTime) >= 20)
+                {
+                    // needs to be trimmed
+                    $estTime = substr($estTime, 0, 17);
+                    $estTime .= "...";
+                }
             }

             $sql_search_time = "Select time from tf_log where action
like '%Upload' and file like '".$entry."%'";
Report to moderator   Logged
Qrome
Administrator
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 2587


TorrentFlux.com





View Profile Personal Message (Offline)
« Reply #1 on: 12-15-2006, 09:37:48 » Reply with quote

Please post what version this is for?   Also, this should be posted in the "Hacks" forum not Feature Requests.   I will move it.
Report to moderator   Logged

Check out the new FireFox Extension by IceWind for TorrentFlux called TorrentFlux Add -- right click on torrents and have them added to your TorrentFlux list.
shuttlebox
Newbie
*
Offline Offline

Posts: 2



View Profile Personal Message (Offline)
« Reply #2 on: 12-15-2006, 09:42:35 » Reply with quote

Please post what version this is for?   Also, this should be posted in the "Hacks" forum not Feature Requests.   I will move it.

Sorry about the version, I use 2.1 beta as packaged by Ubuntu 6.10.

It's a hack but I also request it as a future feature.  Wink
Report to moderator   Logged
alpha2
Newbie
*
Offline Offline

Posts: 5



View Profile Personal Message (Offline)
« Reply #3 on: 04-17-2007, 06:50:34 » Reply with quote

where should i add this code ?
or must i change something ?
Report to moderator   Logged
kiehlster
Newbie
*
Offline Offline

Posts: 6



View Profile Personal Message (Offline)
« Reply #4 on: 04-23-2007, 14:38:00 » Reply with quote

Is a fix for this in 2.3 final?  I just noticed today that one of my broken torrents which I've left running for days is now going to take me this many days "359705121933603624518032998266956375193542911492191847262004225462478283152553484948623427899523578143541776301044201522182342049403" or about "13139913129994652950430429160436762564147686264554953324639423761186421302376383011821860379891272260951297764421705991677893773" 75-year lifetimes.

It sounds like this issue has been around a while and there are a lot of suggestions for fixing it, but do we have one that's accepted by the developers?
Report to moderator   Logged

Setup: Apache 2.2, MySQL 5.1, PHP 5.2, Python 2.4.4c1, TF 2.3 Final
Searcher
Newbie
*
Offline Offline

Posts: 7



View Profile WWW Personal Message (Offline)
« Reply #5 on: 05-01-2007, 08:09:05 » Reply with quote

I hope you don't mind if i share my little trimming mod, it replaces days with number 100 if they're more than 2 digits long.

functions.php line 2439
search for
Code:
$estTime = $af->time_left;
add below
Code:
$estTime = ereg_replace('^[0-9]{3,}d', '100d', $estTime);
Report to moderator   Logged
Pages: [1] 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