Ticket #1875: mythweb_decode_progflags.3.patch

File mythweb_decode_progflags.3.patch, 3.5 KB (added by david.asher@…, 20 years ago)

final version

  • includes/programs.php

     
    184184        // This program has already been loaded, and is attached to a recording schedule
    185185            if ($Scheduled_Recordings[$data['channum']][$data['starttime_unix']]) {
    186186                $program =& $Scheduled_Recordings[$data['channum']][$data['starttime_unix']][0];
     187
     188                // merge in data fetched from DB
     189                $program->merge(new Program($data));
    187190            }
    188191        // Otherwise, create a new instance of the program
    189192            else {
     
    343346                $this->thumb_url = root.cache_dir.'/'.str_replace('%2F', '/', rawurlencode(basename($this->filename)));
    344347            }
    345348        // Assign the program flags
    346             $this->has_commflag = ($progflags & 0x01) ? true : false;    // FL_COMMFLAG  = 0x01
    347             $this->has_cutlist  = ($progflags & 0x02) ? true : false;    // FL_CUTLIST   = 0x02
    348             $this->auto_expire  = ($progflags & 0x04) ? true : false;    // FL_AUTOEXP   = 0x04
    349             $this->is_editing   = ($progflags & 0x08) ? true : false;    // FL_EDITING   = 0x08
    350             $this->bookmark     = ($progflags & 0x10) ? true : false;    // FL_BOOKMARK  = 0x10
     349            $this->has_commflag   = ($progflags & 0x001) ? true : false;    // FL_COMMFLAG       = 0x001
     350            $this->has_cutlist    = ($progflags & 0x002) ? true : false;    // FL_CUTLIST        = 0x002
     351            $this->auto_expire    = ($progflags & 0x004) ? true : false;    // FL_AUTOEXP        = 0x004
     352            $this->is_editing     = ($progflags & 0x008) ? true : false;    // FL_EDITING        = 0x008
     353            $this->bookmark       = ($progflags & 0x010) ? true : false;    // FL_BOOKMARK       = 0x010
     354                                                                            // FL_INUSERECORDING = 0x020
     355                                                                            // FL_INUSEPLAYING   = 0x040
     356            $this->stereo         = ($progflags & 0x080) ? true : false;    // FL_STEREO         = 0x080
     357            $this->closecaptioned = ($progflags & 0x100) ? true : false;    // FL_CC             = 0x100
     358            $this->hdtv           = ($progflags & 0x200) ? true : false;    // FL_HDTV           = 0x200
     359                                                                            // FL_TRANSCODED     = 0x400
    351360        // Add a generic "will record" variable, too
    352361            $this->will_record = ($this->rectype && $this->rectype != rectype_dontrec) ? true : false;
    353362        }
     
    427436        if ($this->chanid != '')
    428437            $this->class = category_class($this);
    429438
    430     // Get a nice description with the full details
     439        $this->update_fancy_desc();
     440    }
     441
     442    function merge($prog) {
     443        foreach (get_object_vars($prog) as $name => $value) {
     444            if ($value && !$this->$name) {
     445                $this->$name = $value;
     446            }
     447        }
     448       
     449        // update fancy description in case a part of it changed
     450        $this->update_fancy_desc();
     451    }
     452
     453    function update_fancy_desc() {
     454        // Get a nice description with the full details
    431455        $details = array();
    432456        if ($this->hdtv)
    433457            $details[] = t('HDTV');
     
    447471        $this->fancy_description = $this->description;
    448472        if (count($details) > 0)
    449473            $this->fancy_description .= ' ('.implode(', ', $details).')';
    450 
    451474    }
    452475
    453476/**