Ticket #1232: mythweb.recorded.3.diff

File mythweb.recorded.3.diff, 9.8 KB (added by Robert Tsai <rtsai1111>, 20 years ago)

More group-by-channum fixes. Re-expose "nodups" UI for searches. Fix some calls to load_all_channels.

  • mythweb/themes/wml/tv/list.php

     
    110110            if (($page * $page_size) < count($Channels)) echo ' <a href="'.root.'tv/list?listbycallsign=y&amp;page='.($page + 1).$prev_query.'">next &gt;</a>';
    111111            echo "<br />";
    112112
     113            $displayed_channels = array();
    113114            foreach (array_keys($Channels) as $key) {
    114115
    115116                $row++;
     
    124125                    continue;
    125126                }
    126127
     128                // Skip already-displayed channels
     129                if ($displayed_channels[$Channels[$key]->channum])
     130                    continue;
     131                $displayed_channels[$Channels[$key]->channum] = 1;
     132
    127133                echo "<a href='".root."tv/channel/".$Channels[$key]->chanid."'>".$Channels[$key]->callsign."</a><br /> ";
    128134
    129135                // Count this channel
  • mythweb/themes/default/tv/list.php

     
    100100
    101101        $timeslot_anchor    = 0;
    102102        $channel_count      = 0;
     103        $displayed_channels = array();
    103104
    104105    // Go through each channel and load/print its info - use references to avoid "copy" overhead
    105106
     
    111112            if ($channel->visible == 0) {
    112113                continue;
    113114            }
     115        // Skip already-displayed channels
     116            if ($displayed_channels[$channel->channum])
     117                continue;
     118            $displayed_channels[$channel->channum] = 1;
    114119        // Display the timeslot bar?
    115120            if ($channel_count % timeslotbar_skip == 0) {
    116121            // Update the timeslot anchor
  • mythweb/themes/default/tv/search.php

     
    115115    <td><?php echo $show->description ?></td>
    116116    <td><?php echo $show->channel->channum.' - '.$show->channel->name ?></td>
    117117    <td nowrap><?php
    118             echo '<br /><a href="'.root.'tv/detail/'.$show->chanid.'/'.$show->starttime.'">'.
     118            echo '<a href="'.root.'tv/detail/'.$show->chanid.'/'.$show->starttime.'">'.
    119119                strftime($_SESSION['date_search'], $show->starttime) . '</a>';
    120120            if( $show->extra_showings )
    121121                foreach( $show->extra_showings as $showtime )
  • mythweb/themes/default/header.php

     
    131131                            <input type="checkbox" class="radio" id="search_hd" name="search_hd" value="1"<?php echo $_SESSION['search']['search_hd'] ? ' CHECKED' : '' ?>>
    132132                            <a onclick="get_element('search_hd').checked=get_element('search_hd').checked ? false : true;"><?php echo t('HD Only') ?></a>
    133133                        </div>
     134                        <div>
     135                            <input type="checkbox" class="radio" id="nodups" name="nodups" value="1"<?php echo $_SESSION['search']['nodups'] ? ' CHECKED' : '' ?>>
     136                            <a onclick="get_element('nodups').checked=get_element('nodups').checked ? false : true;"><?php echo t('Fold Showings') ?></a>
     137                        </div>
    134138                    </div>
    135139
    136140                    <hr />
  • mythweb/themes/wap/tv/list.php

     
    6060
    6161        // Go through each channel and load/print its info - use references to avoid "copy" overhead
    6262        $channel_count = 0;
     63        $displayed_channels = array();
    6364        foreach (array_keys($Channels) as $key) {
    6465        // Ignore channels with no number
    6566            if (strlen($Channels[$key]->channum) < 1)
    6667                continue;
     68        // Skip already-displayed channels
     69            if ($displayed_channels[$Channels[$key]->channum])
     70                continue;
     71            $displayed_channels[$Channels[$key]->channum] = 1;
    6772        // Count this channel
    6873            $channel_count++;
    6974        // Grab the reference
  • mythweb/includes/programs.php

     
    379376        // No channel data?  Load it
    380377            global $Channels;
    381378            if (!is_array($Channels) || !count($Channels))
    382                 load_all_channels($this->chanid);
     379                load_all_channels();
    383380        // Now we really should scan the $Channel array and add a link to this program's channel
    384381            foreach (array_keys($Channels) as $key) {
    385382                if ($Channels[$key]->chanid == $this->chanid) {
  • mythweb/includes/channels.php

     
    3131        else
    3232            $sql = 'SELECT * FROM channel WHERE';
    3333        $sql .= ' channel.visible=1';
    34     // Group and sort
    35         $sql .= ' GROUP BY channel.channum ORDER BY '
     34    // Sort.
     35        $sql .= ' ORDER BY '
    3636                .(sortby_channum ? '' : 'channel.callsign, ')
    3737                .'(channel.channum + 0), channel.chanid';
    3838    // Query
  • mythweb/includes/recordings.php

     
    123123        // No channel data?  Load it
    124124            global $Channels;
    125125            if (!is_array($Channels) || !count($Channels))
    126                 load_all_channels($this->chanid);
     126                load_all_channels();
    127127        // Now we really should scan the $Channel array and add a link to this recording's channel
    128128            foreach (array_keys($Channels) as $key) {
    129129                if ($Channels[$key]->chanid == $this->chanid) {
  • mythweb/languages/English.php

     
    230230    'Edit MythWeb and some MythTV settings.'     => '',
    231231    'Exact Match'                                => '',
    232232    'HD Only'                                    => '',
     233    'Fold Showings'                              => '',
    233234    'Manual'                                     => '',
    234235    'MythMusic on the web.'                      => '',
    235236    'MythVideo on the web.'                      => '',
  • mythweb/modules/tv/schedules_manual.php

     
    172172    function channel_select($chanid) {
    173173        global $Channels;
    174174        echo '<select name="channel">';
     175        $seen = array();
    175176        foreach ($Channels as $channel) {
    176177        // Ignore invisible channels
    177178            if ($channel->visible == 0)
    178179                continue;
     180        // Group by channum
     181            if ($seen[$channel->channum])
     182                continue;
     183            $seen[$channel->channum] = $channel;
     184
    179185        // Print the option
    180186            echo '<option value="'.$channel->chanid.'"';
    181187        // Selected?
  • mythweb/modules/tv/search.php

     
    164164        if (empty($Results))
    165165            $Results = array();
    166166
     167    // Group $Results by channum
     168        $seen = array();
     169        foreach( $Results as $dex => $row ) {
     170            $uniquer = $row->programid . $row->starttime . $row->channel->channum;
     171            if( isset($seen[$uniquer]) ) {
     172                unset( $Results[$dex] );
     173            } else {
     174                $seen[$uniquer] = $dex;
     175            }
     176        }
     177
    167178    // Remove dups from the results if requested
    168179        if ($nodups) {
    169180            $seen = array();        // program ids already seen
    170181            foreach( $Results as $dex => $row ) {
    171                 $uniquer = $row->programid . $row->chanid;
     182                $uniquer = $row->programid . $row->channel->channum;
    172183                if( $seen[$uniquer] ) {
    173184                    // add a new field to the old row
    174                     $Results[$seen[$uniquer]]->extra_showings[] =
    175                                 $row->starttime;
     185                    if ($row->starttime != $Results[$seen[$uniquer]]->starttime &&
     186                            (!is_array($Results[$seen[$uniquer]]->extra_showings) ||
     187                            !in_array($row->starttime,
     188                            $Results[$seen[$uniquer]]->extra_showings))) {
     189                        $Results[$seen[$uniquer]]->extra_showings[] =
     190                            $row->starttime;
     191                    }
    176192                    unset( $Results[$dex] );
    177193                } else {
    178194                    $seen[$uniquer] = $dex;
  • mythweb/modules/tv/recorded.php

     
    1313 *
    1414/**/
    1515
     16// Populate the $Channels array
     17    load_all_channels();
     18
    1619// Make sure the recordings directory exists
    1720    if (file_exists('data/recordings')) {
    1821    // File is not a directory or a symlink