#367 : New template option "year": year published to audible
This commit is contained in:
parent
99564d9c25
commit
d64e043fe8
@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>8.4.6.1</Version>
|
<Version>8.5.0.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Octokit" Version="4.0.0" />
|
<PackageReference Include="Octokit" Version="4.0.0" />
|
||||||
|
|||||||
@ -31,6 +31,7 @@ namespace FileLiberator
|
|||||||
AudibleProductId = libraryBook.Book.AudibleProductId,
|
AudibleProductId = libraryBook.Book.AudibleProductId,
|
||||||
Title = libraryBook.Book.Title ?? "",
|
Title = libraryBook.Book.Title ?? "",
|
||||||
Locale = libraryBook.Book.Locale,
|
Locale = libraryBook.Book.Locale,
|
||||||
|
YearPublished = libraryBook.Book.DatePublished?.Year,
|
||||||
|
|
||||||
Authors = libraryBook.Book.Authors.Select(c => c.Name).ToList(),
|
Authors = libraryBook.Book.Authors.Select(c => c.Name).ToList(),
|
||||||
|
|
||||||
|
|||||||
@ -138,6 +138,7 @@ namespace LibationAvalonia.Dialogs
|
|||||||
AudibleProductId = "123456789",
|
AudibleProductId = "123456789",
|
||||||
Title = "A Study in Scarlet: A Sherlock Holmes Novel",
|
Title = "A Study in Scarlet: A Sherlock Holmes Novel",
|
||||||
Locale = "us",
|
Locale = "us",
|
||||||
|
YearPublished = 2017,
|
||||||
Authors = new List<string> { "Arthur Conan Doyle", "Stephen Fry - introductions" },
|
Authors = new List<string> { "Arthur Conan Doyle", "Stephen Fry - introductions" },
|
||||||
Narrators = new List<string> { "Stephen Fry" },
|
Narrators = new List<string> { "Stephen Fry" },
|
||||||
SeriesName = "Sherlock Holmes",
|
SeriesName = "Sherlock Holmes",
|
||||||
|
|||||||
@ -9,6 +9,7 @@ namespace LibationFileManager
|
|||||||
public string AudibleProductId { get; set; }
|
public string AudibleProductId { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Locale { get; set; }
|
public string Locale { get; set; }
|
||||||
|
public int? YearPublished { get; set; }
|
||||||
|
|
||||||
public IEnumerable<string> Authors { get; set; }
|
public IEnumerable<string> Authors { get; set; }
|
||||||
public string AuthorNames => string.Join(", ", Authors);
|
public string AuthorNames => string.Join(", ", Authors);
|
||||||
|
|||||||
@ -39,6 +39,7 @@ namespace LibationFileManager
|
|||||||
public static TemplateTags Channels { get; } = new TemplateTags("channels", "Number of audio channels");
|
public static TemplateTags Channels { get; } = new TemplateTags("channels", "Number of audio channels");
|
||||||
public static TemplateTags Account { get; } = new TemplateTags("account", "Audible account of this book");
|
public static TemplateTags Account { get; } = new TemplateTags("account", "Audible account of this book");
|
||||||
public static TemplateTags Locale { get; } = new TemplateTags("locale", "Region/country");
|
public static TemplateTags Locale { get; } = new TemplateTags("locale", "Region/country");
|
||||||
|
public static TemplateTags YearPublished { get; } = new TemplateTags("year", "Year published");
|
||||||
|
|
||||||
// Special case. Isn't mapped to a replacement in Templates.cs
|
// Special case. Isn't mapped to a replacement in Templates.cs
|
||||||
// Included here for display by EditTemplateDialog
|
// Included here for display by EditTemplateDialog
|
||||||
|
|||||||
@ -142,6 +142,7 @@ namespace LibationFileManager
|
|||||||
fileNamingTemplate.AddParameterReplacement(TemplateTags.Channels, libraryBookDto.Channels);
|
fileNamingTemplate.AddParameterReplacement(TemplateTags.Channels, libraryBookDto.Channels);
|
||||||
fileNamingTemplate.AddParameterReplacement(TemplateTags.Account, libraryBookDto.Account);
|
fileNamingTemplate.AddParameterReplacement(TemplateTags.Account, libraryBookDto.Account);
|
||||||
fileNamingTemplate.AddParameterReplacement(TemplateTags.Locale, libraryBookDto.Locale);
|
fileNamingTemplate.AddParameterReplacement(TemplateTags.Locale, libraryBookDto.Locale);
|
||||||
|
fileNamingTemplate.AddParameterReplacement(TemplateTags.YearPublished, libraryBookDto.YearPublished?.ToString() ?? "1900");
|
||||||
|
|
||||||
return fileNamingTemplate;
|
return fileNamingTemplate;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,6 +76,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
AudibleProductId = "123456789",
|
AudibleProductId = "123456789",
|
||||||
Title = "A Study in Scarlet: A Sherlock Holmes Novel",
|
Title = "A Study in Scarlet: A Sherlock Holmes Novel",
|
||||||
Locale = "us",
|
Locale = "us",
|
||||||
|
YearPublished = 2017,
|
||||||
Authors = new List<string> { "Arthur Conan Doyle", "Stephen Fry - introductions" },
|
Authors = new List<string> { "Arthur Conan Doyle", "Stephen Fry - introductions" },
|
||||||
Narrators = new List<string> { "Stephen Fry" },
|
Narrators = new List<string> { "Stephen Fry" },
|
||||||
SeriesName = "Sherlock Holmes",
|
SeriesName = "Sherlock Holmes",
|
||||||
|
|||||||
@ -29,6 +29,7 @@ namespace TemplatesTests
|
|||||||
AudibleProductId = "asin",
|
AudibleProductId = "asin",
|
||||||
Title = "A Study in Scarlet: A Sherlock Holmes Novel",
|
Title = "A Study in Scarlet: A Sherlock Holmes Novel",
|
||||||
Locale = "us",
|
Locale = "us",
|
||||||
|
YearPublished = 2017,
|
||||||
Authors = new List<string> { "Arthur Conan Doyle", "Stephen Fry - introductions" },
|
Authors = new List<string> { "Arthur Conan Doyle", "Stephen Fry - introductions" },
|
||||||
Narrators = new List<string> { "Stephen Fry" },
|
Narrators = new List<string> { "Stephen Fry" },
|
||||||
SeriesName = seriesName ?? "",
|
SeriesName = seriesName ?? "",
|
||||||
@ -87,6 +88,7 @@ namespace TemplatesTests
|
|||||||
[DataRow("f", @"C:\foo\bar", "ext", @"C:\foo\bar\f.ext")]
|
[DataRow("f", @"C:\foo\bar", "ext", @"C:\foo\bar\f.ext")]
|
||||||
[DataRow("<id>", @"C:\foo\bar", "ext", @"C:\foo\bar\asin.ext")]
|
[DataRow("<id>", @"C:\foo\bar", "ext", @"C:\foo\bar\asin.ext")]
|
||||||
[DataRow("<bitrate> - <samplerate> - <channels>", @"C:\foo\bar", "ext", @"C:\foo\bar\128 - 44100 - 2.ext")]
|
[DataRow("<bitrate> - <samplerate> - <channels>", @"C:\foo\bar", "ext", @"C:\foo\bar\128 - 44100 - 2.ext")]
|
||||||
|
[DataRow("<year> - <channels>", @"C:\foo\bar", "ext", @"C:\foo\bar\2017 - 2.ext")]
|
||||||
public void Tests(string template, string dirFullPath, string extension, string expected)
|
public void Tests(string template, string dirFullPath, string extension, string expected)
|
||||||
=> Templates.getFileNamingTemplate(GetLibraryBook(), template, dirFullPath, extension)
|
=> Templates.getFileNamingTemplate(GetLibraryBook(), template, dirFullPath, extension)
|
||||||
.GetFilePath(Replacements)
|
.GetFilePath(Replacements)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user