2019-05-11 23:23:27 +02:00
|
|
|
@page
|
2020-12-21 21:31:18 +01:00
|
|
|
@using System.IO
|
2023-06-01 01:57:21 +02:00
|
|
|
@using System.Web
|
2019-05-11 23:23:27 +02:00
|
|
|
@model IndexModel
|
|
|
|
@{
|
2023-06-01 01:56:42 +02:00
|
|
|
if (Model.LogConditionsMet)
|
2023-11-05 14:13:04 +01:00
|
|
|
ViewData["Title"] = $"{Model.LogDisplay} ~ webmusic on .NET {Environment.Version}";
|
2023-06-01 01:56:42 +02:00
|
|
|
else
|
2023-06-01 01:57:55 +02:00
|
|
|
ViewData["Title"] = $"{Model.Displaypath} ~ 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>
|
2023-04-07 21:02:14 +02:00
|
|
|
<br/>
|
|
|
|
<a class="action-muted">[--]</a>
|
|
|
|
<a href="/playlist/@(Request.QueryString).m3u" class="entry-muted cfont"> Download playlist</a>
|
2022-11-20 16:47:08 +01:00
|
|
|
@if (Model.LogConditionsMet) {
|
|
|
|
<br/>
|
|
|
|
<a class="action-muted">[--]</a>
|
2023-04-07 21:02:14 +02:00
|
|
|
<span id="log" onclick="log_playback('/log?artist=@Model.LogArtist&album=@Model.LogAlbum&url=@Model.LogUrl')" class="entry-muted cfont" style="cursor: pointer">Log playback</span>
|
|
|
|
<span class="action-muted">/</span>
|
|
|
|
<span id="copy_hash_np" onclick="copy_hash_np()" class="entry-muted cfont" style="cursor: pointer">Copy #np</span>
|
|
|
|
<span class="action-muted">/</span>
|
|
|
|
<span id="copy_journal_full" onclick="copy_journal_full()" class="entry-muted cfont" style="cursor: pointer">Copy journal (full)</span>
|
|
|
|
<span class="action-muted">/</span>
|
|
|
|
<span id="copy_journal_album" onclick="copy_journal_album()" class="entry-muted cfont" style="cursor: pointer">Copy journal (album only)</span>
|
2022-11-20 16:47:08 +01:00
|
|
|
}
|
2020-12-21 20:42:29 +01:00
|
|
|
<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)) {
|
2023-05-27 03:45:36 +02:00
|
|
|
<a class="action" href="/lyrics/?@Html.Raw(IndexModel.Encode(Model.Path + "/" + lrcfile))" target="_blank">[LRC]</a>
|
2022-11-20 16:47:08 +01:00
|
|
|
}
|
2023-04-07 21:02:14 +02:00
|
|
|
else if (Directory.GetFiles(Model.Fullpath, "*.lrc").Length != 0) {
|
2022-11-20 16:47:08 +01:00
|
|
|
<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>
|
2023-04-07 21:02:14 +02:00
|
|
|
function log_playback(url) {
|
2022-11-21 02:03:01 +01:00
|
|
|
fetch(url).then(function(response) {
|
2022-11-21 02:06:43 +01:00
|
|
|
return response.text();
|
|
|
|
}).then(function(text) {
|
2023-04-07 21:02:14 +02:00
|
|
|
document.getElementById('log').innerText = 'Log playback (' + text + ')';
|
2022-11-21 02:03:01 +01:00
|
|
|
});
|
|
|
|
}
|
2023-04-07 21:02:14 +02:00
|
|
|
|
|
|
|
function reset_copy_labels() {
|
|
|
|
document.getElementById('copy_hash_np').innerText = 'Copy #np';
|
|
|
|
document.getElementById('copy_journal_full').innerText = 'Copy journal (full)';
|
|
|
|
document.getElementById('copy_journal_album').innerText = 'Copy journal (album only)';
|
|
|
|
}
|
|
|
|
|
|
|
|
function copy_hash_np() {
|
2023-04-13 15:28:22 +02:00
|
|
|
copyToClipboard('[#np](@Html.Raw(Log.NowPlayingUrl)) @Html.Raw(Model.CopyArtist) - @Html.Raw(Model.CopyAlbum)');
|
2023-04-07 21:02:14 +02:00
|
|
|
reset_copy_labels();
|
|
|
|
document.getElementById('copy_hash_np').innerText = 'Copy #np (Copied!)';
|
|
|
|
}
|
|
|
|
|
|
|
|
function copy_journal_full() {
|
2023-04-13 15:28:22 +02:00
|
|
|
copyToClipboard('[@Html.Raw(Model.CopyArtist)](' + getUrl('@Html.Raw(Model.LogArtist)') + ') - [@Html.Raw(Model.CopyAlbum)](' + getUrl('@Html.Raw(Model.LogArtist)', '@Html.Raw(Model.LogAlbum)') + ')')
|
2023-04-07 21:02:14 +02:00
|
|
|
reset_copy_labels();
|
|
|
|
document.getElementById('copy_journal_full').innerText = 'Copy journal (full) (Copied!)';
|
|
|
|
}
|
|
|
|
|
|
|
|
function copy_journal_album() {
|
2023-04-13 15:28:22 +02:00
|
|
|
copyToClipboard(', [@Html.Raw(Model.CopyAlbum)](' + getUrl('@Html.Raw(Model.LogArtist)', '@Html.Raw(Model.LogAlbum)') + ')')
|
2023-04-07 21:02:14 +02:00
|
|
|
reset_copy_labels();
|
|
|
|
document.getElementById('copy_journal_album').innerText = 'Copy journal (album only) (Copied!)';
|
|
|
|
}
|
|
|
|
|
|
|
|
function getUrl(artist, album) {
|
|
|
|
let url = location.protocol + '//' + location.host + '/?/' + artist;
|
|
|
|
|
|
|
|
if (album) {
|
|
|
|
url += '/' + album;
|
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
2022-11-21 02:03:01 +01:00
|
|
|
</script>
|