Пример #1
0
 /**
  * getSimilarSongs
  * Returns a random collection of songs from the given artist and similar artists, using data from last.fm. Typically used for artist radio features.
  * Takes song/album/artist id in parameter with optional similar songs count.
  */
 public static function getsimilarsongs($input)
 {
     $id = self::check_parameter($input, 'id');
     $count = $input['count'] ?: 50;
     $songs = null;
     if (Subsonic_XML_Data::isArtist($id)) {
         // TODO: support similar songs for artists
     } elseif (Subsonic_XML_Data::isAlbum($id)) {
         // TODO: support similar songs for albums
     } elseif (Subsonic_XML_Data::isSong($id)) {
         if (AmpConfig::get('show_similar')) {
             $songs = Recommendation::get_songs_like(Subsonic_XML_Data::getAmpacheId($id));
         }
     }
     if ($songs === null) {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
     } else {
         $r = Subsonic_XML_Data::createSuccessResponse();
         Subsonic_XML_Data::addSimilarSongs($r, $songs);
     }
     self::apiOutput($input, $r);
 }
Пример #2
0
 /**
  * deleteBookmark
  * Delete an existing bookmark.
  * Takes the file id in parameter.
  * Not supported.
  */
 public static function deletebookmark($input)
 {
     self::check_version($input, "1.9.0");
     $id = self::check_parameter($input, 'id');
     $type = Subsonic_XML_Data::getAmpacheType($id);
     $bookmark = new Bookmark(Subsonic_XML_Data::getAmpacheId($id), $type);
     if ($bookmark->id) {
         $bookmark->remove();
         $r = Subsonic_XML_Data::createSuccessResponse();
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
     }
     self::apiOutput($input, $r);
 }
Пример #3
0
 /**
  * scrobble
  * Scrobbles a given music file on last.fm.
  * Takes the file id with optional time and submission parameters.
  * Not supported. Already done by Ampache if plugin enabled.
  */
 public static function scrobble($input)
 {
     self::check_version($input, "1.5.0");
     // Ignore error to not break clients
     $r = Subsonic_XML_Data::createSuccessResponse();
     self::apiOutput($input, $r);
 }