Example #1
0
 /**
  * getPodcasts
  * Get all podcast channels.
  * Takes the optional includeEpisodes and channel id in parameters
  */
 public static function getpodcasts($input)
 {
     self::check_version($input, "1.6.0");
     $id = $input['id'];
     $includeEpisodes = isset($input['includeEpisodes']) ? $input['includeEpisodes'] : true;
     if (AmpConfig::get('podcast')) {
         if ($id) {
             $podcast = new Podcast(Subsonic_XML_Data::getAmpacheId($id));
             if ($podcast->id) {
                 $r = Subsonic_XML_Data::createSuccessResponse();
                 Subsonic_XML_Data::addPodcasts($r, array($podcast), $includeEpisodes);
             } else {
                 $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
             }
         } else {
             $podcasts = Catalog::get_podcasts();
             $r = Subsonic_XML_Data::createSuccessResponse();
             Subsonic_XML_Data::addPodcasts($r, $podcasts, $includeEpisodes);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }