Ejemplo n.º 1
0
 public static function library_sections($params)
 {
     $r = Plex_XML_Data::createLibContainer();
     $n = count($params);
     if ($n == 0) {
         Plex_XML_Data::setSections($r, Catalog::get_catalogs());
     } else {
         $key = $params[0];
         $catalog = Catalog::create_from_id($key);
         if (!$catalog) {
             self::createError(404);
         }
         if ($n == 1) {
             Plex_XML_Data::setSectionContent($r, $catalog);
         } elseif ($n == 2) {
             $view = $params[1];
             if ($view == "all") {
                 Plex_XML_Data::setSectionAll($r, $catalog);
             } elseif ($view == "albums") {
                 Plex_XML_Data::setSectionAlbums($r, $catalog);
             } elseif ($view == "recentlyadded") {
                 Plex_XML_Data::setCustomSectionView($r, $catalog, Stats::get_recent('album', 25, $key));
             }
         }
     }
     Plex_XML_Data::setContainerSize($r);
     self::apiOutput($r->asXML());
 }