@page "/np"
@using zotanpw.Backend.database
@model NowPlayingModel

@{
	ViewData["title"] = "now playing";
	var db = new Database.DbConn();
	var albums = db.AlbumHistory.OrderByDescending(p => p.DateTime).Take(50);
}

<p>Here you can see what kind of music I've been listening to lately. This table is updated every couple minutes from multiple data sources.</p>
<p style="background-color:#333; padding:5px 7px;">Links to my music library / webplayer are accessible to authorized users only. If you think this includes you, but something isn't working, <a href="/#contact">DM me</a>.</p>
<table>
	<th style="width:10ch">Date</th>
	<th style="width: 20ch;">Artist</th>
	<th>Album</th>
	<th style="width:12ch">Link</th>
	@foreach (var album in albums) {
		<tr>
			<td>@album.DateTime.ToString("yyyy-MM-dd")</td>
			<td>@album.Artist</td>
			<td>@album.Title</td>
			<td>
				<a href="@album.Link" target="_blank">@album.Source</a>
			</td>
		</tr>
	}
</table>