32 lines
700 B
PHP
32 lines
700 B
PHP
<?php
|
|
|
|
require '../header.php';
|
|
|
|
if ( isset($_REQUEST['searchfor']) ) {
|
|
$searchfor = $_REQUEST['searchfor'];
|
|
} else {
|
|
exit();
|
|
}
|
|
|
|
$songs = Song::getSearchList($searchfor);
|
|
|
|
$data = array();
|
|
$data["search"] = array();
|
|
|
|
foreach ( $songs as $song ) {
|
|
$curdata = array();
|
|
$curdata["id"] = $song->getID();
|
|
$curdata["arturl"] = $song->getArtFile(ARTURL);
|
|
$curdata["title"] = $song->getTitle(HTMLSAFE);
|
|
$curdata["artist"] = $song->getArtist(HTMLSAFE);
|
|
$curdata["album"] = $song->getAlbum(HTMLSAFE);
|
|
$curdata["year"] = $song->getYear(HTMLSAFE);
|
|
$data['search'][] = $curdata;
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($data);
|
|
exit();
|
|
|
|
// vim: sw=3 ts=3 et ai:
|