<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>Beat Heaven: <?= $artist_name ?></title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<style type="text/css">
			body, input { font-family: Georgia; }
			hr { border: none; border-bottom: #AAA 1px solid; }
			.album { margin: 1em 0 3em 0; width: 50em; }
			.album .album-title { font-size: 1.5em; }
			.duration, .year, .bonus { color: #AAA; }
			.parsed { color: #4C4; }
			.unparsed { color: #C44; }
			input { font-size: 2em; }
		</style>
	</head>
	<body>
		<form>
			<input type="text" name="q" value="<?= $q ?>"/>
		</form>
		<div class="albums">
			<? foreach($albums as $rg => $album): if (isset($g_tracks[$rg]) && count($g_tracks[$rg]) > 0): ?>
			<div class="album">
				<div class="album-title">
					<span class="name"><?= $album['name'] ?></span>
					<span class="year">(<?= $album['year'] ? $album['year'] : '?' ?>)</span>
				</div>
				<ol>
					<? foreach($g_tracks[$rg]['tracks'] as $track): ?>
					<? $track['parsed'] = BeatDB::exists($track['id']); ?>
					<? $m = floor($track['length'] / 60); $s = ($track['length'] - ($m * 60)); $d = $m .':'. ($s < 10 ? '0' : ''). $s; ?>
					<li><?= $track['name'] ?> <span class="duration"><?= $d ?></span><?= ($track['parsed'] ? ' <span class="parsed">(parsed)</span>' : ' <span class="unparsed">(not parsed)</span>') ?></li>
					<? endforeach; ?>
				</ol>
				<? if (count($g_tracks[$rg]['bonus']) > 0): ?>
					<span class="bonus">Bonus:</span>
					<ol>
						<? foreach($g_tracks[$rg]['bonus'] as $track): ?>
						<? $track['parsed'] = BeatDB::exists($track['id']); ?>
						<? $m = floor($track['length'] / 60); $s = ($track['length'] - ($m * 60)); $d = $m .':'. ($s < 10 ? '0' : ''). $s; ?>
						<li><?= $track['name'] ?> <span class="duration"><?= $d ?></span><?= ($track['parsed'] ? ' <span class="parsed">(parsed)</span>' : ' <span class="unparsed">(not parsed)</span>') ?></li>
						<? endforeach; ?>
					</ol>
				<? endif; ?>
			</div>
			<? endif; endforeach; ?>
		</div>
	</body>
</html>
