Ejemplo n.º 1
0
 /**
  * format
  * this function takes the object and reformats some values
  */
 public function format($details = true)
 {
     parent::format($details);
     if ($details) {
         if ($this->artist) {
             $artist = new Artist($this->artist);
             $artist->format();
             $this->f_artist = $artist->link;
         }
         if ($this->song) {
             $song = new Song($this->song);
             $song->format();
             $this->f_song = $song->f_link;
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * format
  * this function takes the object and reformats some values
  */
 public function format($details = true)
 {
     parent::format($details);
     $season = new TVShow_Season($this->season);
     $season->format($details);
     $this->f_title = $this->original_name ?: $this->f_title;
     $this->f_link = '<a href="' . $this->link . '">' . $this->f_title . '</a>';
     $this->f_season = $season->f_name;
     $this->f_season_link = $season->f_link;
     $this->f_tvshow = $season->f_tvshow;
     $this->f_tvshow_link = $season->f_tvshow_link;
     $this->f_file = $this->f_tvshow;
     if ($this->episode_number) {
         $this->f_file .= ' - S' . sprintf('%02d', $season->season_number) . 'E' . sprintf('%02d', $this->episode_number);
     }
     $this->f_file .= ' - ' . $this->f_title;
     $this->f_full_title = $this->f_file;
     return true;
 }
Ejemplo n.º 3
0
 /**
  * format
  * this function takes the object and reformats some values
  */
 public function format($details = true)
 {
     parent::format($details);
     $this->f_location = $this->location;
     return true;
 }
Ejemplo n.º 4
0
// if random
if ($type == 'song') {
    /* Base Checks passed create the song object */
    $media = new Song($oid);
    $media->format();
} else {
    if ($type == 'song_preview') {
        $media = new Song_Preview($oid);
        $media->format();
    } else {
        $type = 'video';
        $media = new Video($oid);
        if (isset($_REQUEST['subtitle'])) {
            $subtitle = $media->get_subtitle_file($_REQUEST['subtitle']);
        }
        $media->format();
    }
}
if (!User::stream_control(array(array('object_type' => $type, 'object_id' => $media->id)))) {
    debug_event('UI::access_denied', 'Stream control failed for user ' . $GLOBALS['user']->username . ' on ' . $media->get_stream_name(), 3);
    UI::access_denied();
    exit;
}
if ($media->catalog) {
    // Build up the catalog for our current object
    $catalog = Catalog::create_from_id($media->catalog);
    /* If the media is disabled */
    if (!make_bool($media->enabled)) {
        debug_event('Play', "Error: {$media->file} is currently disabled, song skipped", '5');
        // Check to see if this is a democratic playlist, if so remove it completely
        if ($demo_id && isset($democratic)) {
Ejemplo n.º 5
0
            <th class="cel_action essential"><?php 
echo T_('Action');
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
/* Foreach through every artist that has been passed to us */
foreach ($object_ids as $video_id) {
    if (isset($video_type)) {
        $libitem = new $video_type($video_id);
    } else {
        $libitem = new Video($video_id);
    }
    $libitem->format();
    ?>
        <tr id="video_<?php 
    echo $libitem->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
            <?php 
    require AmpConfig::get('prefix') . UI::find_template('show_video_row.inc.php');
    ?>
        </tr>
        <?php 
}
//end foreach
Ejemplo n.º 6
0
 /**
  * format
  * this function takes the object and reformats some values
  */
 public function format($details = true)
 {
     parent::format($details);
     $this->f_original_name = trim($this->prefix . " " . $this->f_title);
     $this->f_title = $this->f_original_name ?: $this->f_title;
     $this->f_full_title = $this->f_title;
     $this->f_link = '<a href="' . $this->link . '">' . $this->f_title . '</a>';
     return true;
 }
Ejemplo n.º 7
0
            <th class="cel_tags optional"><?php 
echo T_('Tags');
?>
</th>
            <th class="cel_action essential"><?php 
echo T_('Action');
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
/* Foreach through every artist that has been passed to us */
foreach ($object_ids as $video_id) {
    $video = new Video($video_id);
    $video->format();
    ?>
        <tr id="video_<?php 
    echo $video->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
            <?php 
    require AmpConfig::get('prefix') . '/templates/show_video_row.inc.php';
    ?>
        </tr>
        <?php 
}
//end foreach
Ejemplo n.º 8
0
 public static function _videoChilds($prmPath, $prmQuery, $start, $count)
 {
     $mediaItems = array();
     $maxCount = 0;
     $queryData = array();
     parse_str($prmQuery, $queryData);
     $parent = 'amp://video' . $prmPath;
     $pathreq = explode('/', $prmPath);
     if ($pathreq[0] == '' && count($pathreq) > 0) {
         array_shift($pathreq);
     }
     switch ($pathreq[0]) {
         case 'tvshows':
             switch (count($pathreq)) {
                 case 1:
                     // Get tvshow list
                     $tvshows = Catalog::get_tvshows();
                     list($maxCount, $tvshows) = self::_slice($tvshows, $start, $count);
                     foreach ($tvshows as $tvshow) {
                         $tvshow->format();
                         $mediaItems[] = self::_itemTVShow($tvshow, $parent);
                     }
                     break;
                 case 2:
                     // Get season list
                     $tvshow = new TVShow($pathreq[1]);
                     if ($tvshow->id) {
                         $season_ids = $tvshow->get_seasons();
                         list($maxCount, $season_ids) = self::_slice($season_ids, $start, $count);
                         foreach ($season_ids as $season_id) {
                             $season = new TVShow_Season($season_id);
                             $season->format();
                             $mediaItems[] = self::_itemTVShowSeason($season, $parent);
                         }
                     }
                     break;
                 case 3:
                     // Get episode list
                     $season = new TVShow_Season($pathreq[2]);
                     if ($season->id) {
                         $episode_ids = $season->get_episodes();
                         list($maxCount, $episode_ids) = self::_slice($episode_ids, $start, $count);
                         foreach ($episode_ids as $episode_id) {
                             $video = new Video($episode_id);
                             $video->format();
                             $mediaItems[] = self::_itemVideo($video, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'clips':
             switch (count($pathreq)) {
                 case 1:
                     // Get clips list
                     $videos = Catalog::get_videos(null, 'clip');
                     list($maxCount, $videos) = self::_slice($videos, $start, $count);
                     foreach ($videos as $video) {
                         $video->format();
                         $mediaItems[] = self::_itemVideo($video, $parent);
                     }
                     break;
             }
             break;
         case 'movies':
             switch (count($pathreq)) {
                 case 1:
                     // Get clips list
                     $videos = Catalog::get_videos(null, 'movie');
                     list($maxCount, $videos) = self::_slice($videos, $start, $count);
                     foreach ($videos as $video) {
                         $video->format();
                         $mediaItems[] = self::_itemVideo($video, $parent);
                     }
                     break;
             }
             break;
         case 'personal_videos':
             switch (count($pathreq)) {
                 case 1:
                     // Get clips list
                     $videos = Catalog::get_videos(null, 'personal_video');
                     list($maxCount, $videos) = self::_slice($videos, $start, $count);
                     foreach ($videos as $video) {
                         $video->format();
                         $mediaItems[] = self::_itemVideo($video, $parent);
                     }
                     break;
             }
             break;
         default:
             $mediaItems[] = self::_videoMetadata('clips');
             $mediaItems[] = self::_videoMetadata('tvshows');
             $mediaItems[] = self::_videoMetadata('movies');
             $mediaItems[] = self::_videoMetadata('personal_videos');
             break;
     }
     if ($maxCount == 0) {
         $maxCount = count($mediaItems);
     }
     return array($maxCount, $mediaItems);
 }
Ejemplo n.º 9
0
 /**
  * videos
  *
  * This builds the xml document for displaying video objects
  *
  * @param    array    $videos    (description here...)
  * @return    string    return xml
  */
 public static function videos($videos)
 {
     if (count($videos) > self::$limit or self::$offset > 0) {
         $videos = array_slice($videos, self::$offset, self::$limit);
     }
     $string = '';
     foreach ($videos as $video_id) {
         $video = new Video($video_id);
         $video->format();
         $string .= "<video id=\"" . $video->id . "\">\n" . "\t<title><![CDATA[" . $video->title . "]]></title>\n" . "\t<mime><![CDATA[" . $video->mime . "]]></mime>\n" . "\t<resolution>" . $video->f_resolution . "</resolution>\n" . "\t<size>" . $video->size . "</size>\n" . self::tags_string($video->tags) . "\t<url><![CDATA[" . Video::play_url($video->id, '', 'api') . "]]></url>\n" . "</video>\n";
     }
     // end foreach
     $final = self::_header() . $string . self::_footer();
     return $final;
 }