2019-05-11 23:23:27 +02:00
|
|
|
@page
|
2020-12-21 21:31:18 +01:00
|
|
|
@using System.IO
|
2019-05-11 23:23:27 +02:00
|
|
|
@model IndexModel
|
|
|
|
@{
|
2020-12-21 20:42:29 +01:00
|
|
|
ViewData["Title"] = $"webmusic on .NET {Environment.Version}";
|
2019-05-11 23:23:27 +02:00
|
|
|
}
|
2020-12-21 20:42:29 +01:00
|
|
|
@if (Model.Path.Contains("/..")) {
|
|
|
|
return;
|
2019-05-11 23:23:27 +02:00
|
|
|
}
|
2020-12-21 20:42:29 +01:00
|
|
|
@if (Model.Path.EndsWith(".lrc")) {
|
2021-06-25 15:01:44 +02:00
|
|
|
Layout = "Shared/_LayoutNojs";
|
2020-12-21 20:42:29 +01:00
|
|
|
<h3>@Model.Path</h3>
|
|
|
|
<p>@Html.Raw((await System.IO.File.ReadAllTextAsync("music" + Model.Path)).Replace("\n", "<br/>"))</p>
|
2019-08-12 20:16:33 +02:00
|
|
|
}
|
2020-12-21 20:42:29 +01:00
|
|
|
else {
|
|
|
|
<h2>
|
2021-03-21 18:04:15 +01:00
|
|
|
@Model.Displaypath <span id="state"></span> <span id="flags">[<span id="repeatButton">R</span><span id="continuousButton">C</span>]</span>
|
2020-12-21 20:42:29 +01:00
|
|
|
</h2>
|
|
|
|
<a class="action-muted">[..]</a>
|
2021-05-27 16:15:56 +02:00
|
|
|
<a href="?@IndexModel.Encode(Model.PathOneup)" id="back" class="entry-muted cfont"> Go back</a>
|
2022-11-20 16:47:08 +01:00
|
|
|
@if (Model.LogConditionsMet) {
|
|
|
|
<br/>
|
|
|
|
<a class="action-muted">[--]</a>
|
2022-11-21 02:07:43 +01:00
|
|
|
<span id="log" onclick="get('/log?artist=@Model.LogArtist&album=@Model.LogAlbum&url=@Model.LogUrl')" class="entry-muted cfont" style="cursor: pointer"> Log playback</span>
|
2022-11-20 16:47:08 +01:00
|
|
|
}
|
2020-12-21 20:42:29 +01:00
|
|
|
<br/>
|
|
|
|
<a class="action-muted">[--]</a>
|
|
|
|
<a href="/playlist/@(Request.QueryString).m3u" class="entry-muted cfont"> Download playlist</a>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
@foreach (var dir in Model.Dirs) {
|
2021-03-06 14:47:36 +01:00
|
|
|
<li>
|
2022-11-20 16:47:08 +01:00
|
|
|
<a class="action" href="#">[--]</a>
|
|
|
|
<a class="dir" href="?@IndexModel.Encode(Model.Path + "/" + dir)"> @dir</a>
|
2021-03-06 14:47:36 +01:00
|
|
|
</li>
|
2020-12-21 20:42:29 +01:00
|
|
|
}
|
|
|
|
@foreach (var file in Model.Files) {
|
|
|
|
var basename = System.IO.Path.GetFileNameWithoutExtension(file);
|
|
|
|
var lrcfile = basename + ".lrc";
|
|
|
|
var lrcpath = System.IO.Path.Combine(Model.Fullpath, lrcfile);
|
|
|
|
|
2021-03-06 14:47:36 +01:00
|
|
|
<li>
|
2022-11-20 16:47:08 +01:00
|
|
|
<a class="action" href="@Html.Raw(IndexModel.Encode(Model.Fullpath + "/" + file))" download>[DL]</a>
|
|
|
|
@if (System.IO.File.Exists(lrcpath)) {
|
|
|
|
<a class="action" href="?@Html.Raw(IndexModel.Encode(Model.Path + "/" + lrcfile))" target="_blank">[LRC]</a>
|
|
|
|
}
|
|
|
|
else if (Directory.GetFiles(@Model.Fullpath, "*.lrc").Length != 0) {
|
|
|
|
<a class="action">[---]</a>
|
|
|
|
}
|
|
|
|
<a class="file" href="@Html.Raw(IndexModel.Encode(Model.Fullpath + "/" + file))"> @file</a>
|
2021-03-06 14:47:36 +01:00
|
|
|
</li>
|
2020-12-21 20:42:29 +01:00
|
|
|
}
|
2021-03-06 14:47:36 +01:00
|
|
|
}
|
2022-11-21 02:03:01 +01:00
|
|
|
|
|
|
|
<script>
|
|
|
|
function get(url) {
|
|
|
|
fetch(url).then(function(response) {
|
2022-11-21 02:06:43 +01:00
|
|
|
return response.text();
|
|
|
|
}).then(function(text) {
|
|
|
|
document.getElementById('log').innerText = ' Log playback (' + text + ')';
|
2022-11-21 02:03:01 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|