Improve log display

This commit is contained in:
Laura Hausmann 2023-11-05 14:13:04 +01:00
parent 9f595e98a3
commit 08a945c80b
Signed by: zotan
GPG key ID: D044E84C5BE01605
2 changed files with 16 additions and 14 deletions

View file

@ -4,7 +4,7 @@
@model IndexModel
@{
if (Model.LogConditionsMet)
ViewData["Title"] = $"{HttpUtility.UrlDecode(Model.LogArtist)} - {HttpUtility.UrlDecode(Model.LogAlbum)} ~ webmusic on .NET {Environment.Version}";
ViewData["Title"] = $"{Model.LogDisplay} ~ webmusic on .NET {Environment.Version}";
else
ViewData["Title"] = $"{Model.Displaypath} ~ webmusic on .NET {Environment.Version}";
}

View file

@ -9,19 +9,20 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
namespace webmusic.Pages {
public class IndexModel : PageModel {
private const string Root = "music";
public List<string> Dirs = new();
public string Displaypath = "";
public List<string> Files = new();
public string Fullpath = "";
public string Path = "";
public string PathOneup = "";
public bool LogConditionsMet;
public string LogArtist;
public string LogAlbum;
public string LogUrl;
public string CopyArtist;
public string CopyAlbum;
private const string Root = "music";
public List<string> Dirs = new();
public string Displaypath = "";
public List<string> Files = new();
public string Fullpath = "";
public string Path = "";
public string PathOneup = "";
public bool LogConditionsMet;
public string LogArtist;
public string LogAlbum;
public string LogDisplay;
public string LogUrl;
public string CopyArtist;
public string CopyAlbum;
public void OnGet() {
if (Request.QueryString.HasValue)
@ -56,6 +57,7 @@ namespace webmusic.Pages {
CopyArtist = pathparts[Index.FromEnd(2)].Replace("'", "\\'");;
LogAlbum = HttpUtility.UrlPathEncode(pathparts[Index.FromEnd(1)]).Replace("'", "\\'").Replace("&", "%26");
LogArtist = HttpUtility.UrlPathEncode(pathparts[Index.FromEnd(2)]).Replace("'", "\\'").Replace("&", "%26");
LogDisplay = $"{pathparts[Index.FromEnd(2)]} - {pathparts[Index.FromEnd(1)]}";
LogUrl = Request.GetEncodedUrl().Replace("'", "\\'").Replace("&", "%26");
LogConditionsMet = true;
}