[mythtv-users] Mythweb - Summarize space consumed by title ?

Greg Foster greg.foster at gmail.com
Fri Mar 30 10:58:50 UTC 2007


Hi Chris/All,

Noticed yesterday that my available space was getting low, and started
hunting things down.  I'm sure this may exist in SVN, but I couldn't
find it in the stock ".20" release I have here.

Here's the code adding the summary of space consumed by title, as well
as the number of episodes which exist on disk.  In my case, it helped
my identify that I had waaay too many recordings of 'Curious George'
sitting there for my son.  The report sits on the 'stats' page.

Please excuse the code, as I'm not a CSS guy *at all*.  On one system
it seems to display nicely, but on another with a higher resolution
the table gets tucked in between.

Sorry if someone has sent something like this out already.  Hope it
helps someone.

Greg

####################################################
[from /var/www/mythweb/modules/stats/handler.php]

// Get the summary of disk space utilized by shows
    $sh = $db->query('SELECT title,count(title) AS
ecount,TRUNCATE(SUM(filesize)/1073741824,2) AS gb FROM recorded GROUP
BY title ORDER BY gb DESC '
        .$limit);
    while($row = $sh->fetch_assoc())
        $space_used_by_show[] = $row;
    $sh->finish();

####################################################
[from /var/www/mythweb/modules/stats/tmpl/default/stats.php]

<table id="space_used" style="text-align: left;">
    <caption> Space for top <?php echo $_REQUEST['count_dropdown'] ?>
Used</caption>
    <colgroup>
        <col class="title"></col>
        <col class="ecount"></col>
        <col class="gb"></col>
    </colgroup>
    <tr>
        <th>#</th>
        <th><?php echo 'title' ?></th>
        <th><?php echo 'ecount' ?></th>
        <th><?php echo 'gb' ?></th>
    </tr><?php
        foreach($space_used_by_show as $num => $row) {
            echo "<tr>\n",
                 "        <td>", ($num + 1), "</td>\n",
                 "        <td>", $row['title'], "</td>\n",
                 "        <td>", $row['ecount'], "</td>\n",
                 "        <td>", $row['gb'], "</td>\n",
                 "    </tr>\n";
        }
    ?>
    </table>

####################################################
[from /var/www/mythweb/skins/default/stats.css]
#space_used {
    float:              left;
    border:             1px solid #9090B0;
    border-collapse:    collapse;
}
#space_used col.count, #space_used td+td+td, #space_used th+th+th {
    text-align: center;
}
#space_used caption {
    border:             1px dotted #9090B0;
    font-weight:        bold;
}
#space_used td {
    border:             1px dotted #9090B0;
    padding:            0px .5em;
}
#space_used th {
    border:             1px solid  #9090B0;
    border-right:       1px dotted #9090B0;
    border-left:        1px dotted #9090B0;
    padding:            0px .5em;
}


More information about the mythtv-users mailing list