fix collection browsing using the ampache api
This commit is contained in:
parent
ea65d90a41
commit
9f28c20660
2 changed files with 6 additions and 4 deletions
|
@ -201,6 +201,7 @@ class OC_MEDIA_AMPACHE{
|
|||
$filter=isset($params['filter'])?$params['filter']:'';
|
||||
$exact=isset($params['exact'])?($params['exact']=='true'):false;
|
||||
$artists=OC_MEDIA_COLLECTION::getArtists($filter,$exact);
|
||||
error_log('artists found: '.print_r($artists,true));
|
||||
echo('<root>');
|
||||
foreach($artists as $artist){
|
||||
self::printArtist($artist);
|
||||
|
@ -215,8 +216,7 @@ class OC_MEDIA_AMPACHE{
|
|||
</root>");
|
||||
return;
|
||||
}
|
||||
global $SITEROOT;
|
||||
$filter=$params['filter'];
|
||||
$filter=isset($params['filter'])?$params['filter']:'';
|
||||
$songs=OC_MEDIA_COLLECTION::getSongs($filter);
|
||||
$artist=OC_MEDIA_COLLECTION::getArtistName($filter);
|
||||
echo('<root>');
|
||||
|
|
|
@ -123,10 +123,12 @@ class OC_MEDIA_COLLECTION{
|
|||
static public function getArtists($search='%',$exact=false){
|
||||
if(!$exact and $search!='%'){
|
||||
$search="%$search%";
|
||||
}elseif($search==''){
|
||||
$search='%';
|
||||
}
|
||||
$query=OC_DB::prepare("SELECT DISTINCT *PREFIX*media_artists.artist_name AS artist_name , *PREFIX*media_artists.artist_id AS artist_id FROM *PREFIX*media_artists
|
||||
INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=?");
|
||||
return $query->execute(array($search,OC_User::getUser()))->fetchAll();
|
||||
return $query->execute(array($search,self::$uid))->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,7 +161,7 @@ class OC_MEDIA_COLLECTION{
|
|||
static public function getAlbums($artist=0,$search='%',$exact=false){
|
||||
$cmd="SELECT DISTINCT *PREFIX*media_albums.album_name AS album_name , *PREFIX*media_albums.album_artist AS album_artist , *PREFIX*media_albums.album_id AS album_id
|
||||
FROM *PREFIX*media_albums INNER JOIN *PREFIX*media_songs ON *PREFIX*media_albums.album_id=*PREFIX*media_songs.song_album WHERE *PREFIX*media_songs.song_user=? ";
|
||||
$params=array(OC_User::getUser());
|
||||
$params=array(self::$uid);
|
||||
if($artist!=0){
|
||||
$cmd.="AND *PREFIX*media_albums.album_artist = ? ";
|
||||
array_push($params,$artist);
|
||||
|
|
Loading…
Reference in a new issue