Use series Order string instead of parsed float in template tags (#1056)
This commit is contained in:
parent
7741e3caff
commit
663f70b8bf
@ -126,8 +126,8 @@ namespace AaxDecrypter
|
||||
if (DownloadOptions.SeriesName is string series)
|
||||
AaxFile.AppleTags.AppleListBox.EditOrAddFreeformTag(tagDomain, "SERIES", series);
|
||||
|
||||
if (DownloadOptions.SeriesNumber is float part)
|
||||
AaxFile.AppleTags.AppleListBox.EditOrAddFreeformTag(tagDomain, "PART", part.ToString());
|
||||
if (DownloadOptions.SeriesNumber is string part)
|
||||
AaxFile.AppleTags.AppleListBox.EditOrAddFreeformTag(tagDomain, "PART", part);
|
||||
}
|
||||
|
||||
OnRetrievedTitle(AaxFile.AppleTags.TitleSansUnabridged);
|
||||
|
||||
@ -43,7 +43,7 @@ namespace AaxDecrypter
|
||||
string? Publisher { get; }
|
||||
string? Language { get; }
|
||||
string? SeriesName { get; }
|
||||
float? SeriesNumber { get; }
|
||||
string? SeriesNumber { get; }
|
||||
NAudio.Lame.LameConfig? LameConfig { get; }
|
||||
bool Downsample { get; }
|
||||
bool MatchSourceBitrate { get; }
|
||||
|
||||
@ -26,7 +26,7 @@ namespace FileLiberator
|
||||
public string Language => LibraryBook.Book.Language;
|
||||
public string? AudibleProductId => LibraryBookDto.AudibleProductId;
|
||||
public string? SeriesName => LibraryBookDto.FirstSeries?.Name;
|
||||
public float? SeriesNumber => LibraryBookDto.FirstSeries?.Number;
|
||||
public string? SeriesNumber => LibraryBookDto.FirstSeries?.Number;
|
||||
public NAudio.Lame.LameConfig? LameConfig { get; }
|
||||
public string UserAgent => AudibleApi.Resources.Download_User_Agent;
|
||||
public bool StripUnabridged => Config.AllowLibationFixup && Config.StripUnabridged;
|
||||
|
||||
@ -83,7 +83,7 @@ namespace FileLiberator
|
||||
.Select(sb
|
||||
=> new SeriesDto(
|
||||
sb.Series.Name,
|
||||
sb.Book.IsEpisodeParent() ? null : sb.Index,
|
||||
sb.Book.IsEpisodeParent() ? null : sb.Order,
|
||||
sb.Series.AudibleSeriesId)
|
||||
).ToList();
|
||||
}
|
||||
|
||||
@ -7,9 +7,9 @@ public record SeriesDto : IFormattable
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
public float? Number { get; }
|
||||
public string? Number { get; }
|
||||
public string AudibleSeriesId { get; }
|
||||
public SeriesDto(string name, float? number, string audibleSeriesId)
|
||||
public SeriesDto(string name, string? number, string audibleSeriesId)
|
||||
{
|
||||
Name = name;
|
||||
Number = number;
|
||||
|
||||
@ -68,7 +68,7 @@ namespace LibationFileManager.Templates
|
||||
YearPublished = 2017,
|
||||
Authors = [new("Arthur Conan Doyle", "B000AQ43GQ"), new("Stephen Fry - introductions", "B000APAGVS")],
|
||||
Narrators = [new("Stephen Fry", null)],
|
||||
Series = [new("Sherlock Holmes", 1, "B08376S3R2"), new("Some Other Series", 1, "B000000000")],
|
||||
Series = [new("Sherlock Holmes", "1-6", "B08376S3R2"), new("Book Collection", "1", "B000000000")],
|
||||
Codec = "AAC-LC",
|
||||
LibationVersion = Configuration.LibationVersion?.ToVersionString(),
|
||||
FileVersion = "36217811",
|
||||
|
||||
@ -24,7 +24,7 @@ namespace TemplatesTests
|
||||
public static class Shared
|
||||
{
|
||||
public static LibraryBookDto GetLibraryBook()
|
||||
=> GetLibraryBook([new SeriesDto("Sherlock Holmes", 1, "B08376S3R2")]);
|
||||
=> GetLibraryBook([new SeriesDto("Sherlock Holmes", "1", "B08376S3R2")]);
|
||||
|
||||
public static LibraryBookDto GetLibraryBook(IEnumerable<SeriesDto> series)
|
||||
=> new()
|
||||
@ -367,12 +367,13 @@ namespace TemplatesTests
|
||||
|
||||
|
||||
[TestMethod]
|
||||
[DataRow("<series>", "Series A, Series B, Series C")]
|
||||
[DataRow("<series[]>", "Series A, Series B, Series C")]
|
||||
[DataRow("<series>", "Series A, Series B, Series C, Series D")]
|
||||
[DataRow("<series[]>", "Series A, Series B, Series C, Series D")]
|
||||
[DataRow("<series[max(1)]>", "Series A")]
|
||||
[DataRow("<series[max(2)]>", "Series A, Series B")]
|
||||
[DataRow("<series[max(3)]>", "Series A, Series B, Series C")]
|
||||
[DataRow("<series[format({N}, {#}, {ID}) separator(; )]>", "Series A, 1, B1; Series B, 6, B2; Series C, 2, B3")]
|
||||
[DataRow("<series[max(4)]>", "Series A, Series B, Series C, Series D")]
|
||||
[DataRow("<series[format({N}, {#}, {ID}) separator(; )]>", "Series A, 1, B1; Series B, 6, B2; Series C, 2, B3; Series D, 1-5, B4")]
|
||||
[DataRow("<series[format({N}, {#}, {ID}) separator(; ) max(3)]>", "Series A, 1, B1; Series B, 6, B2; Series C, 2, B3")]
|
||||
[DataRow("<series[format({N}, {#}, {ID}) separator(; ) max(2)]>", "Series A, 1, B1; Series B, 6, B2")]
|
||||
[DataRow("<first series>", "Series A")]
|
||||
@ -383,9 +384,10 @@ namespace TemplatesTests
|
||||
var bookDto = GetLibraryBook();
|
||||
bookDto.Series =
|
||||
[
|
||||
new("Series A", 1, "B1"),
|
||||
new("Series B", 6, "B2"),
|
||||
new("Series C", 2, "B3")
|
||||
new("Series A", "1", "B1"),
|
||||
new("Series B", "6", "B2"),
|
||||
new("Series C", "2", "B3"),
|
||||
new("Series D", "1-5", "B4"),
|
||||
];
|
||||
|
||||
Templates.TryGetTemplate<Templates.FileTemplate>(template, out var fileTemplate).Should().BeTrue();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user