[mythtv-users] mythweb: improve 'recorded'

Eyal Lebedinsky eyal at eyal.emu.id.au
Sun Aug 25 02:48:58 UTC 2013


I find it frustrating that listing 'recorded programs' takes a very long time with
my large number of recordings and I did not find an easy way to browse a huge list.
It is actually impossible from a mobile device (over wireless).

I would have liked a tree style by year/month/day, but decided to go for the simpler
solution. I added
- 'recent' option to only show so many recent programs
- 'since' option to do the same by date

I am not sure if I i did it properly but such features should be a good addition.
Developers - please consider including such a feature.

The syntax is trivial:
	mythweb/tv/recorded?recent   [default is 100 programs]
	mythweb/tv/recorded?recent=20
	mythweb/tv/recorded?since=20130820

This is what I changed in /usr/share/mythweb/modules/tv/recorded.php

// Queries for a specific program title
     isset($_REQUEST['title'])    or $_REQUEST['title']    = isset($_REQUEST['refresh']) ? '' : $_SESSION['recorded_title'];
     isset($_REQUEST['recgroup']) or $_REQUEST['recgroup'] = isset($_REQUEST['refresh']) ? '' : $_SESSION['recorded_recgroup'];
     $recent = !isset($_REQUEST['recent'])                                       // [EL]
         ? 0 : ('' == $_REQUEST['recent'] ? 100 : $_REQUEST['recent']);          // [EL]
     $since = !isset($_REQUEST['since']) || '' == $_REQUEST['since']             // [EL]
         ? 0 : unixtime($_REQUEST['since']);                                     // [EL]

// Parse the program list
     $warning    = NULL;
     $recordings = MythBackend::find()->queryProgramRows(                        // [EL]
         'QUERY_RECORDINGS '.($recent || $since ? 'Descending' : 'Unsorted'));   // [EL]
     while (true) {
         $Total_Used     = 0;
         $Total_Time     = 0;
         $Total_Programs = 0;
         $Programs       = array();
         $Groups         = array();
         $Program_Titles = array();
         foreach ($recordings as $key => $record) {
             if ($recent && $Total_Programs > $recent) break;                    // [EL]
             if ($since && $record[12] < $since) break;                          // [EL]
         // Skip the offset
             if ($key === 'offset')  // WHY IN THE WORLD DOES 0 == 'offset'?!?!?  so we use ===
                 continue;

cheers

-- 
Eyal Lebedinsky	(eyal at eyal.emu.id.au)


More information about the mythtv-users mailing list