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);
|
Match match = Regex.Match(fileName, PATTERN);
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
metadata.Artist = match.Groups[1].Value;
|
metadata.Artist = match.Groups[1].Value.Trim();
|
||||||
metadata.Title = match.Groups[2].Value;
|
metadata.Title = match.Groups[2].Value.Trim();
|
||||||
metadata.Genres = new List<Genre>();
|
metadata.Genres = new List<Genre>();
|
||||||
metadata.Tags = new List<Tag>();
|
metadata.Tags = new List<Tag>();
|
||||||
metadata.Studios = new List<Studio>();
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,21 +4,25 @@
|
|||||||
@{ var letters = new System.Collections.Generic.HashSet<char>(); }
|
@{ var letters = new System.Collections.Generic.HashSet<char>(); }
|
||||||
@foreach (TCard card in Cards.Filter(c => !string.IsNullOrWhiteSpace(c.Title)).OrderBy(c => c.SortTitle))
|
@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)
|
||||||
{
|
{
|
||||||
Option<char> maybeLetter = card.SortTitle.ToLowerInvariant().HeadOrNone();
|
char letter = maybeLetter.ValueUnsafe();
|
||||||
if (maybeLetter.IsSome)
|
if (char.IsDigit(letter) || !char.IsLetter(letter))
|
||||||
|
{
|
||||||
|
letter = '#';
|
||||||
|
}
|
||||||
|
if (!letters.Contains(letter))
|
||||||
{
|
{
|
||||||
char letter = maybeLetter.ValueUnsafe();
|
|
||||||
if (letter >= '0' && letter <= '9')
|
|
||||||
{
|
|
||||||
letter = '#';
|
|
||||||
}
|
|
||||||
letters.Add(letter);
|
letters.Add(letter);
|
||||||
<div id="@($"letter-{letter}")" style="scroll-margin-top: 128px">
|
<div id="@($"letter-{letter}")" style="scroll-margin-top: 128px">
|
||||||
@ChildContent(card)
|
@ChildContent(card)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@ChildContent(card)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@using ErsatzTV.Application.MediaCards
|
@using ErsatzTV.Application.MediaCards
|
||||||
@using Unit = LanguageExt.Unit
|
@using Unit = LanguageExt.Unit
|
||||||
|
@using static LanguageExt.Prelude
|
||||||
@inject IMediator Mediator
|
@inject IMediator Mediator
|
||||||
|
|
||||||
<div class="@((ContainerClass ?? "media-card-container mr-6") + " pb-3")" id="@($"item_{Data.MediaItemId}")">
|
<div class="@((ContainerClass ?? "media-card-container mr-6") + " pb-3")" id="@($"item_{Data.MediaItemId}")">
|
||||||
@@ -125,8 +126,8 @@
|
|||||||
return Placeholder;
|
return Placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
string first = sortTitle?.Substring(0, 1).ToUpperInvariant() ?? string.Empty;
|
char first = Optional(sortTitle).Map(t => t.ToUpperInvariant().HeadOrNone()).Flatten().Match(head => head, () => ' ');
|
||||||
return int.TryParse(first, out _) ? "#" : first;
|
return char.IsDigit(first) || !char.IsLetter(first) ? "#" : first.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ArtworkForItem() => string.IsNullOrWhiteSpace(Data.Poster)
|
private string ArtworkForItem() => string.IsNullOrWhiteSpace(Data.Poster)
|
||||||
|
|||||||
Reference in New Issue
Block a user