trim parsed music video titles (#152)
This commit is contained in:
@@ -133,8 +133,8 @@ namespace ErsatzTV.Core.Metadata
|
||||
Match match = Regex.Match(fileName, PATTERN);
|
||||
if (match.Success)
|
||||
{
|
||||
metadata.Artist = match.Groups[1].Value;
|
||||
metadata.Title = match.Groups[2].Value;
|
||||
metadata.Artist = match.Groups[1].Value.Trim();
|
||||
metadata.Title = match.Groups[2].Value.Trim();
|
||||
metadata.Genres = new List<Genre>();
|
||||
metadata.Tags = new List<Tag>();
|
||||
metadata.Studios = new List<Studio>();
|
||||
|
||||
Generated
+1964
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_MusicVideoMetadata_Title : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE MusicVideoMetadata SET DateUpdated = '0001-01-01 00:00:00' WHERE MetadataKind = 0");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE LibraryPath SET LastScan = '0001-01-01 00:00:00' WHERE LibraryId IN
|
||||
(SELECT Id FROM Library WHERE MediaKind = 3)");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,22 +3,26 @@
|
||||
|
||||
@{ var letters = new System.Collections.Generic.HashSet<char>(); }
|
||||
@foreach (TCard card in Cards.Filter(c => !string.IsNullOrWhiteSpace(c.Title)).OrderBy(c => c.SortTitle))
|
||||
{
|
||||
@if (!letters.Contains(card.SortTitle.Head()))
|
||||
{
|
||||
Option<char> maybeLetter = card.SortTitle.ToLowerInvariant().HeadOrNone();
|
||||
if (maybeLetter.IsSome)
|
||||
{
|
||||
char letter = maybeLetter.ValueUnsafe();
|
||||
if (letter >= '0' && letter <= '9')
|
||||
if (char.IsDigit(letter) || !char.IsLetter(letter))
|
||||
{
|
||||
letter = '#';
|
||||
}
|
||||
if (!letters.Contains(letter))
|
||||
{
|
||||
letters.Add(letter);
|
||||
<div id="@($"letter-{letter}")" style="scroll-margin-top: 128px">
|
||||
@ChildContent(card)
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@ChildContent(card)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@using ErsatzTV.Application.MediaCards
|
||||
@using Unit = LanguageExt.Unit
|
||||
@using static LanguageExt.Prelude
|
||||
@inject IMediator Mediator
|
||||
|
||||
<div class="@((ContainerClass ?? "media-card-container mr-6") + " pb-3")" id="@($"item_{Data.MediaItemId}")">
|
||||
@@ -125,8 +126,8 @@
|
||||
return Placeholder;
|
||||
}
|
||||
|
||||
string first = sortTitle?.Substring(0, 1).ToUpperInvariant() ?? string.Empty;
|
||||
return int.TryParse(first, out _) ? "#" : first;
|
||||
char first = Optional(sortTitle).Map(t => t.ToUpperInvariant().HeadOrNone()).Flatten().Match(head => head, () => ' ');
|
||||
return char.IsDigit(first) || !char.IsLetter(first) ? "#" : first.ToString();
|
||||
}
|
||||
|
||||
private string ArtworkForItem() => string.IsNullOrWhiteSpace(Data.Poster)
|
||||
|
||||
Reference in New Issue
Block a user