function Recording($recording_data) { // SQL data if (is_array($recording_data) && isset($recording_data['recordid'])) { $this->recordid = $recording_data['recordid']; $this->type = $recording_data['type']; $this->chanid = $recording_data['chanid']; $this->starttime = $recording_data['starttime_unix']; $this->endtime = $recording_data['endtime_unix']; $this->title = $recording_data['title']; $this->subtitle = $recording_data['subtitle']; $this->description = $recording_data['description']; $this->season = $recording_data['season']; $this->episode = $recording_data['episode']; $this->category = $recording_data['category']; $this->profile = $recording_data['profile']; $this->recgroup = $recording_data['recgroup']; $this->storagegroup = $recording_data['storagegroup']; $this->recpriority = $recording_data['recpriority']; $this->autoexpire = $recording_data['autoexpire']; $this->maxepisodes = $recording_data['maxepisodes']; $this->maxnewest = $recording_data['maxnewest']; $this->dupin = $recording_data['dupin']; $this->dupmethod = $recording_data['dupmethod']; $this->startoffset = $recording_data['startoffset']; $this->endoffset = $recording_data['endoffset']; $this->seriesid = $recording_data['seriesid']; $this->programid = $recording_data['programid']; $this->inetref = $recording_data['inetref']; $this->progstart = $recording_data['progstart']; $this->progend = $recording_data['progend']; $this->basename = $recording_data['basename']; } else { $tmp = @get_object_vars($recording_data); if (count($tmp) > 0) { foreach ($tmp as $key => $value) { $this->{$key} = $value; } } } // We get various recording-related information, too switch ($this->type) { case 1: $this->record_once = true; break; case 2: $this->record_daily = true; break; case 3: $this->record_channel = true; break; case 4: $this->record_always = true; break; case 5: $this->record_weekly = true; break; case 6: $this->record_findone = true; break; } // Add a generic "will record" variable, too $this->will_record = $this->record_daily || $this->record_weekly || $this->record_once || $this->record_findone || $this->record_channel || $this->record_always ? true : false; // Turn type int a word $this->texttype = $GLOBALS['RecTypes'][$this->type]; // Do we have a chanid? Load some info about it if ($this->chanid && !isset($this->channel)) { $this->channel =& Channel::find($this->chanid); } // Find out which css category this recording falls into if ($this->chanid != '') { $this->css_class = category_class($this); } }
public function __construct($data) { global $db; // This is a mythbackend-formatted program - info about this data structure is stored in libs/libmyth/programinfo.cpp if (!isset($data['chanid']) && isset($data[0])) { // Load the remaining info we got from mythbackend $this->title = trim($data[0]); # program name/title $this->subtitle = $data[1]; # episode name $this->description = $data[2]; # episode description $this->season = $data[3]; $this->episode = $data[4]; $this->total_episodes = $data[5]; $this->syndicatedepisodenumber = $data[6]; $this->category = $data[7]; $this->chanid = $data[8]; # mysql chanid $this->channum = $data[9]; $this->callsign = $data[10]; $this->channame = $data[11]; $this->filename = $data[12]; $this->filesize = $data[13]; $this->starttime = $data[14]; # show start-time $this->endtime = $data[15]; # show end-time $this->findid = $data[16]; $this->hostname = $data[17]; $this->sourceid = $data[18]; $this->cardid = $data[19]; $this->inputid = $data[20]; $this->recpriority = $data[21]; $this->recstatus = $data[22]; $this->recordid = $data[23]; $this->rectype = $data[24]; $this->dupin = $data[25]; $this->dupmethod = $data[26]; $this->recstartts = $data[27]; # ACTUAL start time (also maps to recorded.starttime) $this->recendts = $data[28]; # ACTUAL end time $this->progflags = $data[29]; $this->recgroup = $data[30]; $this->outputfilters = $data[31]; $this->seriesid = $data[32]; $this->programid = $data[33]; $this->inetref = $data[34]; $this->lastmodified = $data[35]; $this->stars = $data[36]; $this->airdate = $data[37]; $this->playgroup = $data[38]; $this->recpriority2 = $data[39]; $this->parentid = $data[40]; $this->storagegroup = $data[41]; $this->audioproperties = $data[42]; $this->videoproperties = $data[43]; $this->subtitletype = $data[44]; $this->year = $data[45]; $this->partnumber = $data[46]; $this->parttotal = $data[47]; $this->category_type = $data[48]; $this->recordedid = $data[49]; // Is this a previously-recorded program? if (!empty($this->filename)) { $this->url = video_url($this); // get download info } // Assign the program flags $this->has_commflag = $this->progflags & 0x1 ? true : false; // FL_COMMFLAG = 0x00000001 $this->has_cutlist = $this->progflags & 0x2 ? true : false; // FL_CUTLIST = 0x00000002 $this->auto_expire = $this->progflags & 0x4 ? true : false; // FL_AUTOEXP = 0x00000004 $this->is_editing = $this->progflags & 0x8 ? true : false; // FL_EDITING = 0x00000008 $this->bookmark = $this->progflags & 0x10 ? true : false; // FL_BOOKMARK = 0x00000010 $this->is_recording = $this->progflags & 0x100000 ? true : false; // FL_INUSERECORDING = 0x00100000 $this->is_playing = $this->progflags & 0x200000 ? true : false; // FL_INUSEPLAYING = 0x00200000 $this->is_transcoded = $this->progflags & 0x100 ? true : false; // FL_TRANSCODED = 0x00000100 $this->is_watched = $this->progflags & 0x200 ? true : false; // FL_WATCHED = 0x00000200 // Can be deleted? $this->can_delete = !$this->is_recording && !$this->is_playing || $this->recgroup != 'LiveTV'; // Add a generic "will record" variable, too $this->will_record = $this->rectype && $this->rectype != rectype_dontrec ? true : false; } else { if (in_array($data['airdate'], array('0000-00-00', '0000', '1900-01-01'))) { $this->airdate = $data['originalairdate']; } else { $this->airdate = $data['airdate']; } $this->category = _or($data['category'], t('Unknown')); $this->category_type = _or($data['category_type'], t('Unknown')); $this->chanid = $data['chanid']; $this->description = $data['description']; $this->endtime = $data['endtime_unix']; $this->previouslyshown = $data['previouslyshown']; $this->programid = $data['programid']; $this->rater = $data['rater']; $this->rating = $data['rating']; $this->seriesid = $data['seriesid']; $this->showtype = $data['showtype']; $this->stars = $data['stars']; $this->starttime = $data['starttime_unix']; $this->subtitle = $data['subtitle']; $this->subtitled = $data['subtitled']; $this->title = $data['title']; $this->partnumber = $data['partnumber']; $this->parttotal = $data['parttotal']; $this->colorcode = $data['colorcode']; $this->syndicatedepisodenumber = $data['syndicatedepisodenumber']; $this->title_pronounce = $data['title_pronounce']; $this->recstatus = $data['recstatus']; $this->recordedid = $data['recordedid']; // These db fields should really get renamed... $this->audioproperties = $data['stereo']; $this->videoproperties = $data['hdtv']; $this->subtitletype = $data['closecaptioned']; } // Assign shortcut names to the new audio/video/subtitle property flags $this->stereo = $this->audioproperties & 0x1; $this->mono = $this->audioproperties & 0x2; $this->surround = $this->audioproperties & 0x4; $this->dolby = $this->audioproperties & 0x8; $this->audiohardhear = $this->audioproperties & 0x10; $this->audiovisimpair = $this->audioproperties & 0x20; $this->hdtv = $this->videoproperties & 0x1; $this->widescreen = $this->videoproperties & 0x2; $this->avc = $this->videoproperties & 0x4; $this->hd_ready = $this->videoproperties & 0x8; $this->fullhd = $this->videoproperties & 0x10; $this->damaged = $this->videoproperties & 0x20; $this->closecaptioned = $this->subtitletype & 0x1; $this->has_subtitles = $this->subtitletype & 0x2; $this->subtitled = $this->subtitletype & 0x4; $this->deaf_signed = $this->subtitletype & 0x8; // Generate the star string, since mysql has issues with REPEAT() and // decimals, and the backend doesn't do it for us, anyway. $this->starstring = @str_repeat(star_character, intVal($this->stars * max_stars)); $frac = $this->stars * max_stars - intVal($this->stars * max_stars); if ($frac >= 0.75) { $this->starstring .= '¾'; } elseif ($frac >= 0.5) { $this->starstring .= '½'; } elseif ($frac >= 0.25) { $this->starstring .= '¼'; } // Get the name of the input if ($this->inputid) { $this->inputname = $db->query_col('SELECT displayname FROM capturecard WHERE cardid=?', $this->inputid); } else { $this->inputname = $db->query_col('SELECT inputname FROM recorded WHERE recordedid=?', $this->recordedid); } // Turn recstatus into a word if (isset($this->recstatus) && $GLOBALS['RecStatus_Types'][$this->recstatus]) { $this->recstatus_orig = $this->recstatus; $this->recstatus = $GLOBALS['RecStatus_Types'][$this->recstatus]; $this->conflicting = $this->recstatus == 'Conflict'; # conflicts with another scheduled recording? $this->recording = $this->recstatus == 'WillRecord'; # scheduled to record? } // No longer a null column, so check for blank entries if (in_array($this->airdate, array('0000-00-00', '0000', '1900-01-01'))) { $this->airdate = NULL; } // Do we have a chanid? Load some info about it if ($this->chanid && !isset($this->channel)) { $this->channel =& Channel::find($this->chanid); } // Calculate the duration if ($this->recendts) { $this->length = $this->recendts - $this->recstartts; } else { $this->length = $this->endtime - $this->starttime; } // A special recstatus for shows that this was manually set to record if ($this->rectype == rectype_override) { $this->recstatus = 'ForceRecord'; } // Find out which css category this program falls into if ($this->chanid != '') { $this->css_class = category_class($this); } // Create the fancy description $this->update_fancy_desc(); }
/** * constructor /**/ public function __construct($data) { global $db; $this->dupmethod = _or(setting('prefDupMethod'), 0); // Schedule object data -- just copy it into place if (is_object($data)) { // Not the right type of object? if (strcasecmp(get_class($data), 'schedule')) { trigger_error("Incorrect object of class " . get_class($data) . " passed to new Schedule()", FATAL); } // Copy its variables into place $a = @get_object_vars($data); if (is_array($a) && count($a) > 0) { foreach ($a as $key => $val) { $this->{$key} = $val; } } } elseif (is_null($data)) { return; } else { // Are we passing in a set of chanid, starttime? if (func_num_args() == 2) { $chanid = func_get_arg(0); $start = func_get_arg(1); $data = $db->query_col(' SELECT recordid FROM record WHERE record.chanid = ? AND record.starttime = FROM_UNIXTIME(?)', $chanid, $start); } // Data is a recordid -- load its contents if (!is_array($data) && $data > 0) { $data = $db->query_assoc('SELECT *, UNIX_TIMESTAMP(startdate)+TIME_TO_SEC(starttime) AS starttime, UNIX_TIMESTAMP(enddate)+TIME_TO_SEC(endtime) AS endtime FROM record WHERE recordid=?', $data); } // Array? if (is_array($data) && isset($data['recordid'])) { foreach ($data as $key => $val) { $this->{$key} = $val; } } } // Custom power search needs to have fields split out if ($this->search == searchtype_power) { ######### /** @todo actually split out the fields! */ } // Add a generic "will record" variable, too $this->will_record = $this->type && $this->type != rectype_dontrec ? true : false; // Turn type into a word $this->texttype = $GLOBALS['RecTypes'][$this->type]; // Do we have a chanid? Load some info about it if ($this->chanid > 0 && !isset($this->channel)) { $this->channel =& Channel::find($this->chanid); } // Find out which css category this recording falls into if ($this->chanid != '') { $this->css_class = category_class($this); } }