コード例 #1
0
ファイル: upnp_api.class.php プロジェクト: nioc/ampache
 public static function _videoMetadata($prmPath, $prmQuery = '')
 {
     $root = 'amp://video';
     $pathreq = explode('/', $prmPath);
     if ($pathreq[0] == '' && count($pathreq) > 0) {
         array_shift($pathreq);
     }
     $meta = null;
     switch ($pathreq[0]) {
         case 'tvshows':
             switch (count($pathreq)) {
                 case 1:
                     $counts = count(Catalog::get_tvshows());
                     $meta = array('id' => $root . '/tvshows', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts, 'dc:title' => T_('TV Shows'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $tvshow = new TVShow($pathreq[1]);
                     if ($tvshow->id) {
                         $tvshow->format();
                         $meta = self::_itemTVShow($tvshow, $root . '/tvshows');
                     }
                     break;
                 case 3:
                     $season = new TVShow_Season($pathreq[2]);
                     if ($season->id) {
                         $season->format();
                         $meta = self::_itemTVShowSeason($season, $root . '/tvshows/' . $pathreq[1]);
                     }
                     break;
                 case 4:
                     $video = new TVShow_Episode($pathreq[3]);
                     if ($video->id) {
                         $video->format();
                         $meta = self::_itemVideo($video, $root . '/tvshows/' . $pathreq[1] . '/' . $pathreq[2]);
                     }
                     break;
             }
             break;
         case 'clips':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::get_videos_count(null, 'clip');
                     $meta = array('id' => $root . '/clips', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts, 'dc:title' => T_('Clips'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $video = new Clip($pathreq[1]);
                     if ($video->id) {
                         $video->format();
                         $meta = self::_itemVideo($video, $root . '/clips');
                     }
                     break;
             }
             break;
         case 'movies':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::get_videos_count(null, 'movie');
                     $meta = array('id' => $root . '/movies', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts, 'dc:title' => T_('Movies'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $video = new Movie($pathreq[1]);
                     if ($video->id) {
                         $video->format();
                         $meta = self::_itemVideo($video, $root . '/movies');
                     }
                     break;
             }
             break;
         case 'personal_videos':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::get_videos_count(null, 'personal_video');
                     $meta = array('id' => $root . '/personal_videos', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts, 'dc:title' => T_('Personal Videos'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $video = new Personal_Video($pathreq[1]);
                     if ($video->id) {
                         $video->format();
                         $meta = self::_itemVideo($video, $root . '/personal_videos');
                     }
                     break;
             }
             break;
         default:
             $meta = array('id' => $root, 'parentID' => '0', 'restricted' => '1', 'childCount' => '4', 'dc:title' => T_('Video'), 'upnp:class' => 'object.container');
             break;
     }
     return $meta;
 }
コード例 #2
0
ファイル: plex_xml_data.class.php プロジェクト: bl00m/ampache
 public static function setTVShowSeasonRoot(SimpleXMLElement $xml, TVShow_Season $season)
 {
     $tvshow = new TVShow($season->tvshow);
     $tvshow->format();
     $id = self::getTVShowSeasonId($season->id);
     $xml->addAttribute('key', $id);
     $xml->addAttribute('allowSync', '1');
     $xml->addAttribute('nocache', '1');
     $xml->addAttribute('parentIndex', '1');
     // ??
     $xml->addAttribute('parentTitle', '');
     $xml->addAttribute('grandparentStudio', '');
     $xml->addAttribute('grandparentTitle', $tvshow->f_name);
     $xml->addAttribute('title1', $tvshow->f_name);
     $xml->addAttribute('title2', $season->f_name);
     $xml->addAttribute('viewGroup', 'episode');
     $xml->addAttribute('viewMode', '65592');
     $xml->addAttribute('thumb', self::getMetadataUri($id) . '/thumb/' . $id);
     $xml->addAttribute('art', self::getMetadataUri($id) . '/art/' . $id);
     //$xml->addAttribute('banner', self::getMetadataUri($id) . '/banner/' . $id);
     $episodes = $season->get_episodes();
     foreach ($episodes as $episode_id) {
         $episode = new TVShow_Episode($episode_id);
         $episode->format();
         self::addEpisode($xml, $episode);
     }
 }
コード例 #3
0
ファイル: video.class.php プロジェクト: ivan801/ampache
 /**
  * Insert video for derived type.
  * @param array $data
  * @param array $gtypes
  * @param array $options
  * @return int
  */
 private static function insert_video_type(array $data, $gtypes, $options = array())
 {
     if (count($gtypes) > 0) {
         $gtype = $gtypes[0];
         switch ($gtype) {
             case 'tvshow':
                 return TVShow_Episode::insert($data, $gtypes, $options);
             case 'movie':
                 return Movie::insert($data, $gtypes, $options);
             case 'clip':
                 return Clip::insert($data, $gtypes, $options);
             case 'personal_video':
                 return Personal_Video::insert($data, $gtypes, $options);
             default:
                 // Do nothing, video entry already created and no additional data for now
                 break;
         }
     }
     return $data['id'];
 }