<?php

require '../header.php';

$query = "SELECT id, songid FROM " . INSTANTQTABLE . " ORDER BY id";
$sth = $globaldbh->prepare($query);
$sth->execute();
$data = array();
$data["jukebox"] = array();
while ( $row = $sth->fetch() ) {
   $id = $row['id'];
   $song = new Song($row['songid']);
   $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['jukebox'][] = $curdata;
}

header('Content-Type: application/json');
echo json_encode($data);
exit();

// vim: sw=3 ts=3 ai mouse-=a:
