Skip to content

Commit 73a3ded

Browse files
committed
Update hard-coded field numbers after recent protocol change.
1 parent 26b37bf commit 73a3ded

File tree

3 files changed

+60
-58
lines changed

3 files changed

+60
-58
lines changed

modules/tv/classes/Program.php

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -75,58 +75,59 @@ class Program extends MythBase {
7575

7676
public function __construct($data) {
7777
global $db;
78-
// This is a mythbackend-formatted program - info about this data structure is stored in libs/libmythtv/programinfo.cpp
78+
// This is a mythbackend-formatted program - info about this data structure is stored in libs/libmyth/programinfo.cpp
7979
if (!isset($data['chanid']) && isset($data[0])) {
8080
// Load the remaining info we got from mythbackend
8181
$this->title = trim($data[0]); # program name/title
8282
$this->subtitle = $data[1]; # episode name
8383
$this->description = $data[2]; # episode description
8484
$this->season = $data[3];
8585
$this->episode = $data[4];
86-
$this->syndicatedepisodenumber = $data[5];
87-
$this->category = $data[6];
88-
$this->chanid = $data[7]; # mysql chanid
89-
$this->channum = $data[8];
90-
$this->callsign = $data[9];
91-
$this->channame = $data[10];
92-
$this->filename = $data[11];
93-
$this->filesize = $data[12];
94-
$this->starttime = $data[13]; # show start-time
95-
$this->endtime = $data[14]; # show end-time
96-
$this->findid = $data[15];
97-
$this->hostname = $data[16];
98-
$this->sourceid = $data[17];
99-
$this->cardid = $data[18];
100-
$this->inputid = $data[19];
101-
$this->recpriority = $data[20];
102-
$this->recstatus = $data[21];
103-
$this->recordid = $data[22];
104-
105-
$this->rectype = $data[23];
106-
$this->dupin = $data[24];
107-
$this->dupmethod = $data[25];
108-
$this->recstartts = $data[26]; # ACTUAL start time (also maps to recorded.starttime)
109-
$this->recendts = $data[27]; # ACTUAL end time
110-
$this->progflags = $data[28];
111-
$this->recgroup = $data[29];
112-
$this->outputfilters = $data[30];
113-
$this->seriesid = $data[31];
114-
$this->programid = $data[32];
115-
$this->inetref = $data[33];
116-
117-
$this->lastmodified = $data[34];
118-
$this->stars = $data[35];
119-
$this->airdate = $data[36];
120-
$this->playgroup = $data[37];
121-
$this->recpriority2 = $data[38];
122-
$this->parentid = $data[39];
123-
$this->storagegroup = $data[40];
124-
$this->audioproperties = $data[41];
125-
$this->videoproperties = $data[42];
126-
$this->subtitletype = $data[43];
127-
$this->year = $data[44];
128-
$this->partnumber = $data[45];
129-
$this->parttotal = $data[46];
86+
$this->total_episodes = $data[5];
87+
$this->syndicatedepisodenumber = $data[6];
88+
$this->category = $data[7];
89+
$this->chanid = $data[8]; # mysql chanid
90+
$this->channum = $data[9];
91+
$this->callsign = $data[10];
92+
$this->channame = $data[11];
93+
$this->filename = $data[12];
94+
$this->filesize = $data[13];
95+
$this->starttime = $data[14]; # show start-time
96+
$this->endtime = $data[15]; # show end-time
97+
$this->findid = $data[16];
98+
$this->hostname = $data[17];
99+
$this->sourceid = $data[18];
100+
$this->cardid = $data[19];
101+
$this->inputid = $data[20];
102+
$this->recpriority = $data[21];
103+
$this->recstatus = $data[22];
104+
$this->recordid = $data[23];
105+
106+
$this->rectype = $data[24];
107+
$this->dupin = $data[25];
108+
$this->dupmethod = $data[26];
109+
$this->recstartts = $data[27]; # ACTUAL start time (also maps to recorded.starttime)
110+
$this->recendts = $data[28]; # ACTUAL end time
111+
$this->progflags = $data[29];
112+
$this->recgroup = $data[30];
113+
$this->outputfilters = $data[31];
114+
$this->seriesid = $data[32];
115+
$this->programid = $data[33];
116+
$this->inetref = $data[34];
117+
118+
$this->lastmodified = $data[35];
119+
$this->stars = $data[36];
120+
$this->airdate = $data[37];
121+
$this->playgroup = $data[38];
122+
$this->recpriority2 = $data[39];
123+
$this->parentid = $data[40];
124+
$this->storagegroup = $data[41];
125+
$this->audioproperties = $data[42];
126+
$this->videoproperties = $data[43];
127+
$this->subtitletype = $data[44];
128+
$this->year = $data[45];
129+
$this->partnumber = $data[46];
130+
$this->parttotal = $data[47];
130131
// Is this a previously-recorded program?
131132
if (!empty($this->filename)) {
132133
$this->url = video_url($this); // get download info
@@ -343,6 +344,7 @@ public function backend_row() {
343344
$this->description , // 02 description
344345
$this->season , // 03 season
345346
$this->episode , // 04 episode
347+
$this->total_episodes , // XXX
346348
$this->syndicatedepisodenumber, // 05 syndicatedepisode
347349
$this->category , // 06 category
348350
$this->chanid , // 07 chanid

modules/tv/classes/Schedule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ public static function &findScheduled() {
151151
foreach (MythBackend::find()->queryProgramRows('QUERY_GETALLPENDING', 2) as $key => $program) {
152152
if ($key === 'offset')
153153
continue;
154-
if ($program[21] == 6)
154+
if ($program[22] == 6)
155155
continue;
156156
// Normal entry: $scheduledRecordings[callsign][starttime][]
157-
self::$scheduledRecordings[$program[9]][$program[13]][] =& new Program($program);
157+
self::$scheduledRecordings[$program[10]][$program[14]][] =& new Program($program);
158158
}
159159
Cache::set('Schedule::findScheduled', self::$scheduledRecordings);
160160
}

modules/tv/recorded.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
if (($_SESSION['recorded_title'] == $row[0]) || ($_SESSION['recorded_title'] == ''))
2727
$prev_row++;
2828
// This row isn't the one we're looking for
29-
if ($row[7] != $_REQUEST['chanid'] || $row[26] != $_REQUEST['starttime'])
29+
if ($row[8] != $_REQUEST['chanid'] || $row[27] != $_REQUEST['starttime'])
3030
continue;
3131
// Delete the recording
3232
MythBackend::find()->sendCommand(array($backendstr, implode(MythBackend::$backend_separator, $row), '0'));
@@ -71,34 +71,34 @@
7171
// Skip the offset
7272
if ($key === 'offset') // WHY IN THE WORLD DOES 0 == 'offset'?!?!? so we use ===
7373
continue;
74-
// Get the length (27 == recendts; 26 == recstartts)
75-
$length = $record[27] - $record[26];
76-
// Keep track of the total time and disk space used (9 == filesize)
74+
// Get the length (28 == recendts; 27 == recstartts)
75+
$length = $record[28] - $record[27];
76+
// Keep track of the total time and disk space used (13 == filesize)
7777
$Total_Time += $length;
7878
if (function_exists('gmp_add')) {
7979
// GMP functions should work better with 64 bit numbers.
80-
$Total_Used = gmp_strval(gmp_add($Total_Used, $record[12]));
80+
$Total_Used = gmp_strval(gmp_add($Total_Used, $record[13]));
8181
}
8282
else {
8383
// This is inaccurate, but it's the best we can get without GMP.
84-
$Total_Used += $record[12];
84+
$Total_Used += $record[13];
8585
}
8686
// keep track of their names and how many episodes we have recorded
8787
$Total_Programs++;
88-
$Groups[$record[29]]++;
88+
$Groups[$record[30]]++;
8989
// Hide LiveTV and Deleted recordings from the title list
90-
if (($_REQUEST['recgroup'] && $_REQUEST['recgroup'] == $record[29]) || (!$_REQUEST['recgroup'] && $record[29] != 'LiveTV' && $record[29] != 'Deleted'))
90+
if (($_REQUEST['recgroup'] && $_REQUEST['recgroup'] == $record[30]) || (!$_REQUEST['recgroup'] && $record[30] != 'LiveTV' && $record[30] != 'Deleted'))
9191
$Program_Titles[$record[0]]++;
9292
// Skip files with no chanid
93-
if (!$record[7])
93+
if (!$record[8])
9494
continue;
9595
// Skip programs the user doesn't want to look at
9696
if ($_REQUEST['title'] && $_REQUEST['title'] != $record[0])
9797
continue;
98-
if ($_REQUEST['recgroup'] && $_REQUEST['recgroup'] != $record[29])
98+
if ($_REQUEST['recgroup'] && $_REQUEST['recgroup'] != $record[30])
9999
continue;
100100
// Hide LiveTV recordings from the default view
101-
if (empty($_REQUEST['recgroup']) && ($record[29] == 'LiveTV' || $record[29] == 'Deleted'))
101+
if (empty($_REQUEST['recgroup']) && ($record[30] == 'LiveTV' || $record[30] == 'Deleted'))
102102
continue;
103103
// Make sure that everything we're dealing with is an array
104104
if (!is_array($Programs[$record[0]]))

0 commit comments

Comments
 (0)