Location: PHPKode > projects > mediaIndex > classes/group.downloads.php
<?php
/**
 * $Id: group.downloads.php,v 1.9 2004/12/01 04:07:46 openface Exp $      
 *
 *               _ _        _         _                 
 *  _ __  ___ __| (_)__ _  (_)_ _  __| |_____ _____ _ _ 
 * | '  \/ -_) _` | / _` | | | ' \/ _` / -_) \ / -_) '_|
 * |_|_|_\___\__,_|_\__,_| |_|_||_\__,_\___/_\_\___|_|  
 *                                                     
 *     Standalone Indexer Script for Media Files
 *        jason hines, <hide@address.com>
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
 * General Public License for more details.
 */

/**
 * Group class
 *
 * @version     $Revision: 1.9 $
 * @package     mediaIndexer
 * @subpackage  groups  
 * @author      jason hines, <hide@address.com>
 */

class downloadsGroup extends defaultGroup {

    public $groupName = "Downloads";

    public function printInfo(file $file) {
        $info = $file->getRawInfo();
        if (!empty($info)) {
          print "<table class=\"info\">\n";
          print "<tr><td>File Format:</td><td>{$info['fileformat']}</td></tr>\n";
          print "<tr><td>Mime Type:</td><td>{$info['mime_type']}</td></tr>\n";
          print "</table>\n";
        }

        echo "<p><b>Estimated Download Times</b><br />";
        echo $this->_downloadtime(filesize(_MEDIAPATH.$file->path),850) . " minutes (cable/DSL modem)<br />";
        echo $this->_downloadtime(filesize(_MEDIAPATH.$file->path),56) . " minutes (56K modem)<br />";
        echo $this->_downloadtime(filesize(_MEDIAPATH.$file->path),28.8) . " minutes (28.8K modem)<br />";
        echo "</p>";
    }

    protected function _downloadtime($size, $speed=28.8) {
        $size = ($size * 8) / 1024;
        $speed = floatval($speed);
        $size = floatval($size);
        $time = ceil($size / $speed);
        return round($time / 60,1);
    }

}

?>
Return current item: mediaIndex