* @return array the list of artists found
*/
static public function getArtists($search='%',$exact=false){
+ $uid=self::$uid;
+ if(empty($uid)){
+ $uid=self::$uid=$_SESSION['user_id'];
+ }
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=? ORDER BY artist_name");
- return $query->execute(array($search,self::$uid))->fetchAll();
+ $query=OC_DB::prepare("SELECT DISTINCT artist_name, artist_id FROM *PREFIX*media_artists
+ INNER JOIN *PREFIX*media_songs ON artist_id=song_artist WHERE artist_name LIKE ? AND song_user=? ORDER BY artist_name");
+ $result=$query->execute(array($search,self::$uid));
+ return $result->fetchAll();
}
/**
* @return array the list of albums found
*/
static public function getAlbums($artist=0,$search='%',$exact=false){
+ $uid=self::$uid;
+ if(empty($uid)){
+ $uid=self::$uid=$_SESSION['user_id'];
+ }
$cmd="SELECT DISTINCT album_name, album_artist, album_id
FROM *PREFIX*media_albums INNER JOIN *PREFIX*media_songs ON album_id=song_album WHERE song_user=? ";
$params=array(self::$uid);