diff --git a/modules/_shared/lang/English.lang b/modules/_shared/lang/English.lang index b7b2f2c..d0bfd6d 100644 --- a/modules/_shared/lang/English.lang +++ b/modules/_shared/lang/English.lang @@ -1,3 +1,12 @@ +"New episode" +"Identifiable episode" +"First showing" +"Primetime" +"Commercial free" +"High definition" +"This Episode" +"Post Processing" +"Schedule Options" "" "# Tracks" "$1 B" diff --git a/modules/tv/classes/Schedule.php b/modules/tv/classes/Schedule.php index 7129da5..f3454c4 100644 --- a/modules/tv/classes/Schedule.php +++ b/modules/tv/classes/Schedule.php @@ -51,6 +51,7 @@ class Schedule extends MythBase { public $findid; public $transcoder; public $parentid; + public $filter; public $playgroup; public $prefinput; @@ -63,6 +64,50 @@ class Schedule extends MythBase { public $will_record = false; public $css_class; // css class, based on category and/or category_type + + /** + * Intended to be called as Schedule::availableRecordFilters() + * + * @return array sorted list of record filters available to the system keyed by filterid + /**/ + public static function availableRecordFilters() { + static $cache = array(); + if (empty($cache)) { + global $db; + $cache = $db->query_keyed_list_assoc('filterid', + 'SELECT filterid,description,newruledefault + FROM recordfilter + ORDER BY filterid'); + } + return $cache; + } + + /** + * + * @return an array of the filters for this Schedule. Array includes + * a property called "enabled" to indicate if the filter is enabled. + * If this is not a real schedule "enabled" is from the newruledefault + * property + * + /**/ + public function recordFilters() { + $filters = array(); + foreach (Schedule::availableRecordFilters() as $id => $filter) { + $filters[$id] = $filter; + // if this is a real schedule, use the filter property + if ($this->recordid) { + $mask = 1 << $id; + $filters[$id]['enabled'] = ($this->filter & $mask) == $mask; + + // otherwise it's not a real schedule, so use the default value + } else { + $filters[$id]['enabled'] = $filter['newruledefault']; + } + } + + return $filters; + } + public static function findAll($sort = true) { global $db; $orderby = ''; @@ -236,10 +281,10 @@ class Schedule extends MythBase { findday,findtime,findid,autotranscode,parentid,transcoder, autouserjob1,autouserjob2,autouserjob3,autouserjob4,autometadata, playgroup,storagegroup,prefinput, - next_record,last_record,last_delete,inetref,season,episode) + next_record,last_record,last_delete,inetref,season,episode,filter) VALUES (?,?,?, FROM_UNIXTIME(?),FROM_UNIXTIME(?),FROM_UNIXTIME(?),FROM_UNIXTIME(?), - ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', + ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', _or($this->recordid, 0, true), _or($this->type, 0, true), $this->chanid, @@ -286,7 +331,8 @@ class Schedule extends MythBase { _or($this->last_delete, '00:00:00' ), _or($this->inetref, '' ), _or($this->season, 0 ), - _or($this->episode, 0 ) + _or($this->episode, 0 ), + _or($this->filter, 0 ) ); // Get the id that was returned $recordid = $sh->insert_id(); diff --git a/modules/tv/detail.php b/modules/tv/detail.php index 5b444d9..a63d818 100644 --- a/modules/tv/detail.php +++ b/modules/tv/detail.php @@ -162,6 +162,9 @@ redirect_browser(root_url.'tv/detail/'.$program->chanid.'/'.$program->recstartts); } +// Load the utility/display functions for scheduling + require_once 'includes/schedule_utils.php'; + // The user tried to update the recording settings - update the database and the variable in memory if (isset($_POST['save'])) { if ($schedule) { @@ -234,6 +237,7 @@ $schedule->inetref = $_POST['inetref']; $schedule->season = intval($_POST['season']); $schedule->episode = intval($_POST['episode']); + $schedule->filter = generateFilter(); // Keep track of the parent recording for overrides if ($_POST['record'] == rectype_override) { @@ -348,9 +352,6 @@ $program->load_jobs(); } -// Load the utility/display functions for scheduling - require_once 'includes/schedule_utils.php'; - // Setup some vars for the ipod template $Page_Previous_Location = root_url.'tv/list_shows_in_title_and_group?group='.urlencode($program->recgroup).'&title='.urlencode($program->title); $Page_Previous_Location_Name = $program->title; diff --git a/modules/tv/includes/schedule_utils.php b/modules/tv/includes/schedule_utils.php index eb1ec4f..d5f3af3 100644 --- a/modules/tv/includes/schedule_utils.php +++ b/modules/tv/includes/schedule_utils.php @@ -11,6 +11,18 @@ /**/ /** + * Generates a schedule filter paramater from the POST parameters +/**/ + function generateFilter() { + $total = 0; + foreach (Schedule::availableRecordFilters() as $id => $filter) { + $enabled = intval($_POST["recordfilter_$id"]); + $total |= $enabled << $id; + } + return $total; +} + +/** * Prints a -