mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-08-07 04:42:17 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de45d008c7 | ||
|
|
c267332027 | ||
|
|
4829e85faf | ||
|
|
2acb9ca7e5 | ||
|
|
b260554a2a | ||
|
|
41a4055cd9 | ||
|
|
c6e9ba9bf9 | ||
|
|
5059333b38 | ||
|
|
b4015030cf | ||
|
|
7f5cf8f018 | ||
|
|
2c9ccd9c78 | ||
|
|
cebf218db4 | ||
|
|
530b44a0e6 | ||
|
|
b3dc5a7054 |
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>6.4.4.1</Version>
|
<Version>6.6.1.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -50,16 +50,48 @@ namespace AppScaffolding
|
|||||||
public static void RunPostConfigMigrations(Configuration config)
|
public static void RunPostConfigMigrations(Configuration config)
|
||||||
{
|
{
|
||||||
AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||||
|
PopulateMissingConfigValues(config);
|
||||||
|
|
||||||
//
|
//
|
||||||
// migrations go below here
|
// migrations go below here
|
||||||
//
|
//
|
||||||
|
|
||||||
Migrations.migrate_to_v5_2_0__post_config(config);
|
Migrations.migrate_to_v6_5_2(config);
|
||||||
Migrations.migrate_to_v5_7_1(config);
|
}
|
||||||
Migrations.migrate_to_v6_1_2(config);
|
|
||||||
Migrations.migrate_to_v6_2_0(config);
|
public static void PopulateMissingConfigValues(Configuration config)
|
||||||
Migrations.migrate_to_v6_2_9(config);
|
{
|
||||||
|
config.InProgress ??= Configuration.WinTemp;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.AllowLibationFixup)))
|
||||||
|
config.AllowLibationFixup = true;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.DecryptToLossy)))
|
||||||
|
config.DecryptToLossy = false;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.BadBook)))
|
||||||
|
config.BadBook = Configuration.BadBookAction.Ask;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.DownloadEpisodes)))
|
||||||
|
config.DownloadEpisodes = true;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.ImportEpisodes)))
|
||||||
|
config.ImportEpisodes = true;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.SplitFilesByChapter)))
|
||||||
|
config.SplitFilesByChapter = false;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.FolderTemplate)))
|
||||||
|
config.FolderTemplate = Templates.Folder.DefaultTemplate;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.FileTemplate)))
|
||||||
|
config.FileTemplate = Templates.File.DefaultTemplate;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.ChapterFileTemplate)))
|
||||||
|
config.ChapterFileTemplate = Templates.ChapterFile.DefaultTemplate;
|
||||||
|
|
||||||
|
if (!config.Exists(nameof(config.ShowImportedStats)))
|
||||||
|
config.ShowImportedStats = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Initialize logging. Run after migration</summary>
|
/// <summary>Initialize logging. Run after migration</summary>
|
||||||
@@ -312,52 +344,11 @@ namespace AppScaffolding
|
|||||||
"WinTemp" => Path.GetFullPath(Path.Combine(Path.GetTempPath(), "Libation")),
|
"WinTemp" => Path.GetFullPath(Path.Combine(Path.GetTempPath(), "Libation")),
|
||||||
_ => path
|
_ => path
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void migrate_to_v5_2_0__post_config(Configuration config)
|
|
||||||
{
|
|
||||||
if (!config.Exists(nameof(config.AllowLibationFixup)))
|
|
||||||
config.AllowLibationFixup = true;
|
|
||||||
|
|
||||||
if (!config.Exists(nameof(config.DecryptToLossy)))
|
|
||||||
config.DecryptToLossy = false;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// add config.BadBook
|
public static void migrate_to_v6_5_2(Configuration config)
|
||||||
public static void migrate_to_v5_7_1(Configuration config)
|
|
||||||
{
|
{
|
||||||
if (!config.Exists(nameof(config.BadBook)))
|
// example
|
||||||
config.BadBook = Configuration.BadBookAction.Ask;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add config.DownloadEpisodes , config.ImportEpisodes
|
|
||||||
public static void migrate_to_v6_1_2(Configuration config)
|
|
||||||
{
|
|
||||||
if (!config.Exists(nameof(config.DownloadEpisodes)))
|
|
||||||
config.DownloadEpisodes = true;
|
|
||||||
|
|
||||||
if (!config.Exists(nameof(config.ImportEpisodes)))
|
|
||||||
config.ImportEpisodes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add config.SplitFilesByChapter
|
|
||||||
public static void migrate_to_v6_2_0(Configuration config)
|
|
||||||
{
|
|
||||||
if (!config.Exists(nameof(config.SplitFilesByChapter)))
|
|
||||||
config.SplitFilesByChapter = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add file naming templates
|
|
||||||
public static void migrate_to_v6_2_9(Configuration config)
|
|
||||||
{
|
|
||||||
if (!config.Exists(nameof(config.FolderTemplate)))
|
|
||||||
config.FolderTemplate = Templates.Folder.DefaultTemplate;
|
|
||||||
|
|
||||||
if (!config.Exists(nameof(config.FileTemplate)))
|
|
||||||
config.FileTemplate = Templates.File.DefaultTemplate;
|
|
||||||
|
|
||||||
if (!config.Exists(nameof(config.ChapterFileTemplate)))
|
|
||||||
config.ChapterFileTemplate = Templates.ChapterFile.DefaultTemplate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CsvHelper" Version="27.1.1" />
|
<PackageReference Include="CsvHelper" Version="27.2.1" />
|
||||||
<PackageReference Include="NPOI" Version="2.5.5" />
|
<PackageReference Include="NPOI" Version="2.5.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AudibleApi" Version="2.3.5.1" />
|
<PackageReference Include="AudibleApi" Version="2.5.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@@ -12,13 +12,13 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dinah.EntityFrameworkCore" Version="1.0.7.1" />
|
<PackageReference Include="Dinah.EntityFrameworkCore" Version="4.0.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.11">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.11" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.11">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -120,17 +120,36 @@ namespace DtoImporterService
|
|||||||
|
|
||||||
var category = DbContext.Categories.Local.SingleOrDefault(c => c.AudibleCategoryId == lastCategory);
|
var category = DbContext.Categories.Local.SingleOrDefault(c => c.AudibleCategoryId == lastCategory);
|
||||||
|
|
||||||
var book = DbContext.Books.Add(new Book(
|
Book book;
|
||||||
new AudibleProductId(item.ProductId),
|
try
|
||||||
item.TitleWithSubtitle,
|
{
|
||||||
item.Description,
|
book = DbContext.Books.Add(new Book(
|
||||||
item.LengthInMinutes,
|
new AudibleProductId(item.ProductId),
|
||||||
contentType,
|
item.TitleWithSubtitle,
|
||||||
authors,
|
item.Description,
|
||||||
narrators,
|
item.LengthInMinutes,
|
||||||
category,
|
contentType,
|
||||||
importItem.LocaleName)
|
authors,
|
||||||
).Entity;
|
narrators,
|
||||||
|
category,
|
||||||
|
importItem.LocaleName)
|
||||||
|
).Entity;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error adding book. {@DebugInfo}", new {
|
||||||
|
item.ProductId,
|
||||||
|
item.TitleWithSubtitle,
|
||||||
|
item.Description,
|
||||||
|
item.LengthInMinutes,
|
||||||
|
contentType,
|
||||||
|
QtyAuthors = authors?.Count,
|
||||||
|
QtyNarrators = narrators?.Count,
|
||||||
|
Category = category?.Name,
|
||||||
|
importItem.LocaleName
|
||||||
|
});
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
var publisherName = item.Publisher;
|
var publisherName = item.Publisher;
|
||||||
if (!string.IsNullOrWhiteSpace(publisherName))
|
if (!string.IsNullOrWhiteSpace(publisherName))
|
||||||
|
|||||||
@@ -73,7 +73,15 @@ namespace DtoImporterService
|
|||||||
var category = DbContext.Categories.Local.FirstOrDefault(c => c.AudibleCategoryId == id);
|
var category = DbContext.Categories.Local.FirstOrDefault(c => c.AudibleCategoryId == id);
|
||||||
if (category is null)
|
if (category is null)
|
||||||
{
|
{
|
||||||
category = DbContext.Categories.Add(new Category(new AudibleCategoryId(id), name)).Entity;
|
try
|
||||||
|
{
|
||||||
|
category = DbContext.Categories.Add(new Category(new AudibleCategoryId(id), name)).Entity;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error adding category. {@DebugInfo}", new { id, name });
|
||||||
|
throw;
|
||||||
|
}
|
||||||
qtyNew++;
|
qtyNew++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,16 @@ namespace DtoImporterService
|
|||||||
foreach (var name in newPeople)
|
foreach (var name in newPeople)
|
||||||
{
|
{
|
||||||
var p = groupby.Single(g => g.Name == name).People.First();
|
var p = groupby.Single(g => g.Name == name).People.First();
|
||||||
DbContext.Contributors.Add(new Contributor(p.Name, p.Asin));
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbContext.Contributors.Add(new Contributor(p.Name, p.Asin));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error adding person. {@DebugInfo}", new { p?.Name, p?.Asin });
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newPeople.Count;
|
return newPeople.Count;
|
||||||
@@ -99,7 +108,17 @@ namespace DtoImporterService
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var pub in newPublishers)
|
foreach (var pub in newPublishers)
|
||||||
DbContext.Contributors.Add(new Contributor(pub));
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbContext.Contributors.Add(new Contributor(pub));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error adding publisher. {@DebugInfo}", new { pub });
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return newPublishers.Count;
|
return newPublishers.Count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -35,18 +35,38 @@ namespace DtoImporterService
|
|||||||
// CURRENT SOLUTION: don't re-insert
|
// CURRENT SOLUTION: don't re-insert
|
||||||
|
|
||||||
var currentLibraryProductIds = DbContext.LibraryBooks.Select(l => l.Book.AudibleProductId).ToList();
|
var currentLibraryProductIds = DbContext.LibraryBooks.Select(l => l.Book.AudibleProductId).ToList();
|
||||||
var newItems = importItems.Where(dto => !currentLibraryProductIds.Contains(dto.DtoItem.ProductId)).ToList();
|
var newItems = importItems
|
||||||
|
.Where(dto => !currentLibraryProductIds
|
||||||
|
.Contains(dto.DtoItem.ProductId))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
foreach (var newItem in newItems)
|
// if 2 accounts try to import the same book in the same transaction: error since we're only tracking and pulling by asin.
|
||||||
|
// just use the first
|
||||||
|
var groupby = newItems.GroupBy(
|
||||||
|
i => i.DtoItem.ProductId,
|
||||||
|
i => i,
|
||||||
|
(key, g) => new { ProductId = key, ImportItems = g.ToList() }
|
||||||
|
)
|
||||||
|
.ToList();
|
||||||
|
foreach (var gb in groupby)
|
||||||
{
|
{
|
||||||
|
var newItem = gb.ImportItems.First();
|
||||||
|
|
||||||
var libraryBook = new LibraryBook(
|
var libraryBook = new LibraryBook(
|
||||||
DbContext.Books.Local.Single(b => b.AudibleProductId == newItem.DtoItem.ProductId),
|
DbContext.Books.Local.Single(b => b.AudibleProductId == newItem.DtoItem.ProductId),
|
||||||
newItem.DtoItem.DateAdded,
|
newItem.DtoItem.DateAdded,
|
||||||
newItem.AccountId);
|
newItem.AccountId);
|
||||||
DbContext.LibraryBooks.Add(libraryBook);
|
try
|
||||||
|
{
|
||||||
|
DbContext.LibraryBooks.Add(libraryBook);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error adding library book. {@DebugInfo}", new { libraryBook.Book, libraryBook.Account });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var qtyNew = newItems.Count;
|
var qtyNew = groupby.Count;
|
||||||
return qtyNew;
|
return qtyNew;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,15 @@ namespace DtoImporterService
|
|||||||
var series = DbContext.Series.Local.FirstOrDefault(c => c.AudibleSeriesId == s.SeriesId);
|
var series = DbContext.Series.Local.FirstOrDefault(c => c.AudibleSeriesId == s.SeriesId);
|
||||||
if (series is null)
|
if (series is null)
|
||||||
{
|
{
|
||||||
series = DbContext.Series.Add(new DataLayer.Series(new AudibleSeriesId(s.SeriesId))).Entity;
|
try
|
||||||
|
{
|
||||||
|
series = DbContext.Series.Add(new DataLayer.Series(new AudibleSeriesId(s.SeriesId))).Entity;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error(ex, "Error adding series. {@DebugInfo}", new { s?.SeriesId });
|
||||||
|
throw;
|
||||||
|
}
|
||||||
qtyNew++;
|
qtyNew++;
|
||||||
}
|
}
|
||||||
series.UpdateName(s.SeriesName);
|
series.UpdateName(s.SeriesName);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dinah.Core" Version="3.0.2.1" />
|
<PackageReference Include="Dinah.Core" Version="4.0.3.1" />
|
||||||
<PackageReference Include="Polly" Version="7.2.2" />
|
<PackageReference Include="Polly" Version="7.2.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
+52
-11
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Dinah.Core;
|
using Dinah.Core;
|
||||||
using Polly;
|
using Polly;
|
||||||
using Polly.Retry;
|
using Polly.Retry;
|
||||||
@@ -65,6 +66,8 @@ namespace FileManager
|
|||||||
|
|
||||||
var fullfilename = fileStem.Truncate(MAX_FILENAME_LENGTH - extension.Length) + extension;
|
var fullfilename = fileStem.Truncate(MAX_FILENAME_LENGTH - extension.Length) + extension;
|
||||||
|
|
||||||
|
fullfilename = removeInvalidWhitespace(fullfilename);
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (File.Exists(fullfilename))
|
while (File.Exists(fullfilename))
|
||||||
{
|
{
|
||||||
@@ -86,34 +89,72 @@ namespace FileManager
|
|||||||
{
|
{
|
||||||
ArgumentValidator.EnsureNotNull(path, nameof(path));
|
ArgumentValidator.EnsureNotNull(path, nameof(path));
|
||||||
|
|
||||||
var invalidChars = Path.GetInvalidPathChars().Union(new[] {
|
path = replaceInvalidChars(path, illegalCharacterReplacements);
|
||||||
|
path = standardizeSlashes(path);
|
||||||
|
path = replaceColons(path, illegalCharacterReplacements);
|
||||||
|
path = removeDoubleSlashes(path);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static char[] invalidChars { get; } = Path.GetInvalidPathChars().Union(new[] {
|
||||||
'*', '?',
|
'*', '?',
|
||||||
// these are weird. If you run Path.GetInvalidPathChars() in C# interactive, these characters are included.
|
// these are weird. If you run Path.GetInvalidPathChars() in Visual Studio's "C# Interactive", then these characters are included.
|
||||||
// In live code, Path.GetInvalidPathChars() does not include them
|
// In live code, Path.GetInvalidPathChars() does not include them
|
||||||
'"', '<', '>'
|
'"', '<', '>'
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
private static string replaceInvalidChars(string path, string illegalCharacterReplacements)
|
||||||
|
=> string.Join(illegalCharacterReplacements ?? "", path.Split(invalidChars));
|
||||||
|
|
||||||
var fixedPath = string
|
private static string standardizeSlashes(string path)
|
||||||
.Join(illegalCharacterReplacements ?? "", path.Split(invalidChars))
|
=> path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||||
.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
|
||||||
|
|
||||||
|
private static string replaceColons(string path, string illegalCharacterReplacements)
|
||||||
|
{
|
||||||
// replace all colons except within the first 2 chars
|
// replace all colons except within the first 2 chars
|
||||||
var builder = new System.Text.StringBuilder();
|
var builder = new System.Text.StringBuilder();
|
||||||
for (var i = 0; i < fixedPath.Length; i++)
|
for (var i = 0; i < path.Length; i++)
|
||||||
{
|
{
|
||||||
var c = fixedPath[i];
|
var c = path[i];
|
||||||
if (i >= 2 && c == ':')
|
if (i >= 2 && c == ':')
|
||||||
builder.Append(illegalCharacterReplacements);
|
builder.Append(illegalCharacterReplacements);
|
||||||
else
|
else
|
||||||
builder.Append(c);
|
builder.Append(c);
|
||||||
}
|
}
|
||||||
fixedPath = builder.ToString();
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string removeDoubleSlashes(string path)
|
||||||
|
{
|
||||||
|
if (path.Length < 2)
|
||||||
|
return path;
|
||||||
|
|
||||||
|
// exception: don't try to condense the initial dbl bk slashes in a path. eg: \\192.168.0.1
|
||||||
|
|
||||||
|
var remainder = path[1..];
|
||||||
var dblSeparator = $"{Path.DirectorySeparatorChar}{Path.DirectorySeparatorChar}";
|
var dblSeparator = $"{Path.DirectorySeparatorChar}{Path.DirectorySeparatorChar}";
|
||||||
while (fixedPath.Contains(dblSeparator))
|
while (remainder.Contains(dblSeparator))
|
||||||
fixedPath = fixedPath.Replace(dblSeparator, $"{Path.DirectorySeparatorChar}");
|
remainder = remainder.Replace(dblSeparator, $"{Path.DirectorySeparatorChar}");
|
||||||
|
|
||||||
return fixedPath;
|
return path[0] + remainder;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string removeInvalidWhitespace_pattern { get; } = $@"\s*\{Path.DirectorySeparatorChar}\s*";
|
||||||
|
private static Regex removeInvalidWhitespace_regex { get; } = new(removeInvalidWhitespace_pattern, RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
|
||||||
|
|
||||||
|
/// <summary>no part of the path may begin or end in whitespace</summary>
|
||||||
|
private static string removeInvalidWhitespace(string fullfilename)
|
||||||
|
{
|
||||||
|
// no whitespace at beginning or end
|
||||||
|
// replace whitespace around path slashes
|
||||||
|
// regex (with space added for clarity)
|
||||||
|
// \s* \\ \s* => \
|
||||||
|
fullfilename = fullfilename.Trim();
|
||||||
|
|
||||||
|
fullfilename = removeInvalidWhitespace_regex.Replace(fullfilename, @"\");
|
||||||
|
|
||||||
|
fullfilename = removeDoubleSlashes(fullfilename);
|
||||||
|
return fullfilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.28803.156
|
VisualStudioVersion = 17.0.31903.59
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{03C8835F-936C-4AF7-87AE-FF92BDBE8B9B}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{03C8835F-936C-4AF7-87AE-FF92BDBE8B9B}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@@ -62,7 +62,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileLiberator.Tests", "_Tes
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileManager.Tests", "_Tests\FileManager.Tests\FileManager.Tests.csproj", "{F2E04270-4551-41C4-99FF-E7125BED708C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileManager.Tests", "_Tests\FileManager.Tests\FileManager.Tests.csproj", "{F2E04270-4551-41C4-99FF-E7125BED708C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibationFileManager.Tests", "_Tests\LibationFileManager.Tests\LibationFileManager.Tests.csproj", "{EB781571-8548-477E-82AD-FB9FAB548D2F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibationFileManager.Tests", "_Tests\LibationFileManager.Tests\LibationFileManager.Tests.csproj", "{EB781571-8548-477E-82AD-FB9FAB548D2F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<PublishTrimmed>true</PublishTrimmed>
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
<PublishReadyToRun>true</PublishReadyToRun>
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace LibationFileManager
|
|||||||
{
|
{
|
||||||
// primary lookup
|
// primary lookup
|
||||||
var cachedFile = FilePathCache.GetFirstPath(productId, FileType);
|
var cachedFile = FilePathCache.GetFirstPath(productId, FileType);
|
||||||
if (cachedFile != null)
|
if (cachedFile is not null && File.Exists(cachedFile))
|
||||||
return cachedFile;
|
return cachedFile;
|
||||||
|
|
||||||
// secondary lookup attempt
|
// secondary lookup attempt
|
||||||
|
|||||||
@@ -133,6 +133,13 @@ namespace LibationFileManager
|
|||||||
set => persistentDictionary.SetString(nameof(BadBook), value.ToString());
|
set => persistentDictionary.SetString(nameof(BadBook), value.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Description("Show number of newly imported titles? When unchecked, no pop-up will appear after library scan.")]
|
||||||
|
public bool ShowImportedStats
|
||||||
|
{
|
||||||
|
get => persistentDictionary.GetNonString<bool>(nameof(ShowImportedStats));
|
||||||
|
set => persistentDictionary.SetNonString(nameof(ShowImportedStats), value);
|
||||||
|
}
|
||||||
|
|
||||||
[Description("Import episodes? (eg: podcasts) When unchecked, episodes will not be imported into Libation.")]
|
[Description("Import episodes? (eg: podcasts) When unchecked, episodes will not be imported into Libation.")]
|
||||||
public bool ImportEpisodes
|
public bool ImportEpisodes
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ namespace LibationFileManager
|
|||||||
{
|
{
|
||||||
// not customizable. don't move to config
|
// not customizable. don't move to config
|
||||||
private static string databasePath => Path.Combine(Configuration.Instance.LibationFiles, "LibationContext.db");
|
private static string databasePath => Path.Combine(Configuration.Instance.LibationFiles, "LibationContext.db");
|
||||||
public static string ConnectionString => $"Data Source={databasePath};Foreign Keys=False;";
|
public static string ConnectionString => $"Data Source={databasePath};Foreign Keys=False;Pooling=False;";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
+145
-132
@@ -28,140 +28,152 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginExternalDialog));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginExternalDialog));
|
||||||
this.submitBtn = new System.Windows.Forms.Button();
|
this.submitBtn = new System.Windows.Forms.Button();
|
||||||
this.localeLbl = new System.Windows.Forms.Label();
|
this.localeLbl = new System.Windows.Forms.Label();
|
||||||
this.usernameLbl = new System.Windows.Forms.Label();
|
this.usernameLbl = new System.Windows.Forms.Label();
|
||||||
this.loginUrlLbl = new System.Windows.Forms.Label();
|
this.loginUrlLbl = new System.Windows.Forms.Label();
|
||||||
this.loginUrlTb = new System.Windows.Forms.TextBox();
|
this.loginUrlTb = new System.Windows.Forms.TextBox();
|
||||||
this.copyBtn = new System.Windows.Forms.Button();
|
this.copyBtn = new System.Windows.Forms.Button();
|
||||||
this.launchBrowserBtn = new System.Windows.Forms.Button();
|
this.launchBrowserBtn = new System.Windows.Forms.Button();
|
||||||
this.instructionsLbl = new System.Windows.Forms.Label();
|
this.instructionsLbl = new System.Windows.Forms.Label();
|
||||||
this.responseUrlTb = new System.Windows.Forms.TextBox();
|
this.responseUrlTb = new System.Windows.Forms.TextBox();
|
||||||
this.SuspendLayout();
|
this.tldrLbl = new System.Windows.Forms.Label();
|
||||||
//
|
this.SuspendLayout();
|
||||||
// submitBtn
|
//
|
||||||
//
|
// submitBtn
|
||||||
this.submitBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
//
|
||||||
this.submitBtn.Location = new System.Drawing.Point(665, 400);
|
this.submitBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.submitBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
this.submitBtn.Location = new System.Drawing.Point(665, 458);
|
||||||
this.submitBtn.Name = "submitBtn";
|
this.submitBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.submitBtn.Size = new System.Drawing.Size(88, 27);
|
this.submitBtn.Name = "submitBtn";
|
||||||
this.submitBtn.TabIndex = 8;
|
this.submitBtn.Size = new System.Drawing.Size(88, 27);
|
||||||
this.submitBtn.Text = "Submit";
|
this.submitBtn.TabIndex = 8;
|
||||||
this.submitBtn.UseVisualStyleBackColor = true;
|
this.submitBtn.Text = "Submit";
|
||||||
this.submitBtn.Click += new System.EventHandler(this.submitBtn_Click);
|
this.submitBtn.UseVisualStyleBackColor = true;
|
||||||
//
|
this.submitBtn.Click += new System.EventHandler(this.submitBtn_Click);
|
||||||
// localeLbl
|
//
|
||||||
//
|
// localeLbl
|
||||||
this.localeLbl.AutoSize = true;
|
//
|
||||||
this.localeLbl.Location = new System.Drawing.Point(14, 10);
|
this.localeLbl.AutoSize = true;
|
||||||
this.localeLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.localeLbl.Location = new System.Drawing.Point(14, 10);
|
||||||
this.localeLbl.Name = "localeLbl";
|
this.localeLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.localeLbl.Size = new System.Drawing.Size(61, 15);
|
this.localeLbl.Name = "localeLbl";
|
||||||
this.localeLbl.TabIndex = 0;
|
this.localeLbl.Size = new System.Drawing.Size(61, 15);
|
||||||
this.localeLbl.Text = "Locale: {0}";
|
this.localeLbl.TabIndex = 0;
|
||||||
//
|
this.localeLbl.Text = "Locale: {0}";
|
||||||
// usernameLbl
|
//
|
||||||
//
|
// usernameLbl
|
||||||
this.usernameLbl.AutoSize = true;
|
//
|
||||||
this.usernameLbl.Location = new System.Drawing.Point(14, 25);
|
this.usernameLbl.AutoSize = true;
|
||||||
this.usernameLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.usernameLbl.Location = new System.Drawing.Point(14, 25);
|
||||||
this.usernameLbl.Name = "usernameLbl";
|
this.usernameLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.usernameLbl.Size = new System.Drawing.Size(80, 15);
|
this.usernameLbl.Name = "usernameLbl";
|
||||||
this.usernameLbl.TabIndex = 1;
|
this.usernameLbl.Size = new System.Drawing.Size(80, 15);
|
||||||
this.usernameLbl.Text = "Username: {0}";
|
this.usernameLbl.TabIndex = 1;
|
||||||
//
|
this.usernameLbl.Text = "Username: {0}";
|
||||||
// loginUrlLbl
|
//
|
||||||
//
|
// loginUrlLbl
|
||||||
this.loginUrlLbl.AutoSize = true;
|
//
|
||||||
this.loginUrlLbl.Location = new System.Drawing.Point(14, 61);
|
this.loginUrlLbl.AutoSize = true;
|
||||||
this.loginUrlLbl.Name = "loginUrlLbl";
|
this.loginUrlLbl.Location = new System.Drawing.Point(14, 61);
|
||||||
this.loginUrlLbl.Size = new System.Drawing.Size(180, 15);
|
this.loginUrlLbl.Name = "loginUrlLbl";
|
||||||
this.loginUrlLbl.TabIndex = 2;
|
this.loginUrlLbl.Size = new System.Drawing.Size(180, 15);
|
||||||
this.loginUrlLbl.Text = "Paste this URL into your browser:";
|
this.loginUrlLbl.TabIndex = 2;
|
||||||
//
|
this.loginUrlLbl.Text = "Paste this URL into your browser:";
|
||||||
// loginUrlTb
|
//
|
||||||
//
|
// loginUrlTb
|
||||||
this.loginUrlTb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
//
|
||||||
|
this.loginUrlTb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.loginUrlTb.Location = new System.Drawing.Point(14, 79);
|
this.loginUrlTb.Location = new System.Drawing.Point(14, 79);
|
||||||
this.loginUrlTb.Multiline = true;
|
this.loginUrlTb.Multiline = true;
|
||||||
this.loginUrlTb.Name = "loginUrlTb";
|
this.loginUrlTb.Name = "loginUrlTb";
|
||||||
this.loginUrlTb.ReadOnly = true;
|
this.loginUrlTb.ReadOnly = true;
|
||||||
this.loginUrlTb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
this.loginUrlTb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
this.loginUrlTb.Size = new System.Drawing.Size(739, 92);
|
this.loginUrlTb.Size = new System.Drawing.Size(739, 117);
|
||||||
this.loginUrlTb.TabIndex = 3;
|
this.loginUrlTb.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// copyBtn
|
// copyBtn
|
||||||
//
|
//
|
||||||
this.copyBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.copyBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.copyBtn.Location = new System.Drawing.Point(14, 177);
|
this.copyBtn.Location = new System.Drawing.Point(14, 202);
|
||||||
this.copyBtn.Name = "copyBtn";
|
this.copyBtn.Name = "copyBtn";
|
||||||
this.copyBtn.Size = new System.Drawing.Size(165, 23);
|
this.copyBtn.Size = new System.Drawing.Size(165, 23);
|
||||||
this.copyBtn.TabIndex = 4;
|
this.copyBtn.TabIndex = 4;
|
||||||
this.copyBtn.Text = "Copy URL to clipboard";
|
this.copyBtn.Text = "Copy URL to clipboard";
|
||||||
this.copyBtn.UseVisualStyleBackColor = true;
|
this.copyBtn.UseVisualStyleBackColor = true;
|
||||||
this.copyBtn.Click += new System.EventHandler(this.copyBtn_Click);
|
this.copyBtn.Click += new System.EventHandler(this.copyBtn_Click);
|
||||||
//
|
//
|
||||||
// launchBrowserBtn
|
// launchBrowserBtn
|
||||||
//
|
//
|
||||||
this.launchBrowserBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.launchBrowserBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.launchBrowserBtn.Location = new System.Drawing.Point(588, 177);
|
this.launchBrowserBtn.Location = new System.Drawing.Point(589, 202);
|
||||||
this.launchBrowserBtn.Name = "launchBrowserBtn";
|
this.launchBrowserBtn.Name = "launchBrowserBtn";
|
||||||
this.launchBrowserBtn.Size = new System.Drawing.Size(165, 23);
|
this.launchBrowserBtn.Size = new System.Drawing.Size(165, 23);
|
||||||
this.launchBrowserBtn.TabIndex = 5;
|
this.launchBrowserBtn.TabIndex = 5;
|
||||||
this.launchBrowserBtn.Text = "Launch in browser";
|
this.launchBrowserBtn.Text = "Launch in browser";
|
||||||
this.launchBrowserBtn.UseVisualStyleBackColor = true;
|
this.launchBrowserBtn.UseVisualStyleBackColor = true;
|
||||||
this.launchBrowserBtn.Click += new System.EventHandler(this.launchBrowserBtn_Click);
|
this.launchBrowserBtn.Click += new System.EventHandler(this.launchBrowserBtn_Click);
|
||||||
//
|
//
|
||||||
// instructionsLbl
|
// instructionsLbl
|
||||||
//
|
//
|
||||||
this.instructionsLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.instructionsLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.instructionsLbl.AutoSize = true;
|
this.instructionsLbl.AutoSize = true;
|
||||||
this.instructionsLbl.Location = new System.Drawing.Point(14, 203);
|
this.instructionsLbl.Location = new System.Drawing.Point(14, 261);
|
||||||
this.instructionsLbl.Name = "instructionsLbl";
|
this.instructionsLbl.Name = "instructionsLbl";
|
||||||
this.instructionsLbl.Size = new System.Drawing.Size(436, 90);
|
this.instructionsLbl.Size = new System.Drawing.Size(436, 90);
|
||||||
this.instructionsLbl.TabIndex = 6;
|
this.instructionsLbl.TabIndex = 6;
|
||||||
this.instructionsLbl.Text = resources.GetString("instructionsLbl.Text");
|
this.instructionsLbl.Text = resources.GetString("instructionsLbl.Text");
|
||||||
//
|
//
|
||||||
// responseUrlTb
|
// responseUrlTb
|
||||||
//
|
//
|
||||||
this.responseUrlTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
this.responseUrlTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.responseUrlTb.Location = new System.Drawing.Point(14, 296);
|
this.responseUrlTb.Location = new System.Drawing.Point(14, 354);
|
||||||
this.responseUrlTb.Multiline = true;
|
this.responseUrlTb.Multiline = true;
|
||||||
this.responseUrlTb.Name = "responseUrlTb";
|
this.responseUrlTb.Name = "responseUrlTb";
|
||||||
this.responseUrlTb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
this.responseUrlTb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
this.responseUrlTb.Size = new System.Drawing.Size(739, 98);
|
this.responseUrlTb.Size = new System.Drawing.Size(739, 98);
|
||||||
this.responseUrlTb.TabIndex = 7;
|
this.responseUrlTb.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// LoginExternalDialog
|
// tldrLbl
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.submitBtn;
|
this.tldrLbl.AutoSize = true;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.tldrLbl.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.tldrLbl.Location = new System.Drawing.Point(14, 237);
|
||||||
this.ClientSize = new System.Drawing.Size(766, 440);
|
this.tldrLbl.Name = "tldrLbl";
|
||||||
this.Controls.Add(this.responseUrlTb);
|
this.tldrLbl.Size = new System.Drawing.Size(421, 15);
|
||||||
this.Controls.Add(this.instructionsLbl);
|
this.tldrLbl.TabIndex = 9;
|
||||||
this.Controls.Add(this.launchBrowserBtn);
|
this.tldrLbl.Text = "tl;dr : an ERROR on Amazon is GOOD. Sorry, I can\'t control their weird login";
|
||||||
this.Controls.Add(this.copyBtn);
|
//
|
||||||
this.Controls.Add(this.loginUrlTb);
|
// LoginExternalDialog
|
||||||
this.Controls.Add(this.loginUrlLbl);
|
//
|
||||||
this.Controls.Add(this.usernameLbl);
|
this.AcceptButton = this.submitBtn;
|
||||||
this.Controls.Add(this.localeLbl);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.Controls.Add(this.submitBtn);
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
this.ClientSize = new System.Drawing.Size(766, 498);
|
||||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
this.Controls.Add(this.tldrLbl);
|
||||||
this.MaximizeBox = false;
|
this.Controls.Add(this.responseUrlTb);
|
||||||
this.MinimizeBox = false;
|
this.Controls.Add(this.instructionsLbl);
|
||||||
this.Name = "LoginExternalDialog";
|
this.Controls.Add(this.launchBrowserBtn);
|
||||||
this.ShowIcon = false;
|
this.Controls.Add(this.copyBtn);
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.Controls.Add(this.loginUrlTb);
|
||||||
this.Text = "Audible External Login";
|
this.Controls.Add(this.loginUrlLbl);
|
||||||
this.ResumeLayout(false);
|
this.Controls.Add(this.usernameLbl);
|
||||||
this.PerformLayout();
|
this.Controls.Add(this.localeLbl);
|
||||||
|
this.Controls.Add(this.submitBtn);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "LoginExternalDialog";
|
||||||
|
this.ShowIcon = false;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "Audible External Login";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,5 +187,6 @@
|
|||||||
private System.Windows.Forms.Button launchBrowserBtn;
|
private System.Windows.Forms.Button launchBrowserBtn;
|
||||||
private System.Windows.Forms.Label instructionsLbl;
|
private System.Windows.Forms.Label instructionsLbl;
|
||||||
private System.Windows.Forms.TextBox responseUrlTb;
|
private System.Windows.Forms.TextBox responseUrlTb;
|
||||||
}
|
private System.Windows.Forms.Label tldrLbl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+503
-490
File diff suppressed because it is too large.
Load diff
@@ -27,6 +27,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
loggingLevelCb.SelectedItem = config.LogLevel;
|
loggingLevelCb.SelectedItem = config.LogLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.showImportedStatsCb.Text = desc(nameof(config.ShowImportedStats));
|
||||||
this.importEpisodesCb.Text = desc(nameof(config.ImportEpisodes));
|
this.importEpisodesCb.Text = desc(nameof(config.ImportEpisodes));
|
||||||
this.downloadEpisodesCb.Text = desc(nameof(config.DownloadEpisodes));
|
this.downloadEpisodesCb.Text = desc(nameof(config.DownloadEpisodes));
|
||||||
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
||||||
@@ -46,6 +47,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
"Books");
|
"Books");
|
||||||
booksSelectControl.SelectDirectory(config.Books);
|
booksSelectControl.SelectDirectory(config.Books);
|
||||||
|
|
||||||
|
showImportedStatsCb.Checked = config.ShowImportedStats;
|
||||||
importEpisodesCb.Checked = config.ImportEpisodes;
|
importEpisodesCb.Checked = config.ImportEpisodes;
|
||||||
downloadEpisodesCb.Checked = config.DownloadEpisodes;
|
downloadEpisodesCb.Checked = config.DownloadEpisodes;
|
||||||
allowLibationFixupCbox.Checked = config.AllowLibationFixup;
|
allowLibationFixupCbox.Checked = config.AllowLibationFixup;
|
||||||
@@ -166,6 +168,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
MessageBoxVerboseLoggingWarning.ShowIfTrue();
|
MessageBoxVerboseLoggingWarning.ShowIfTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.ShowImportedStats = showImportedStatsCb.Checked;
|
||||||
config.ImportEpisodes = importEpisodesCb.Checked;
|
config.ImportEpisodes = importEpisodesCb.Checked;
|
||||||
config.DownloadEpisodes = downloadEpisodesCb.Checked;
|
config.DownloadEpisodes = downloadEpisodesCb.Checked;
|
||||||
config.AllowLibationFixup = allowLibationFixupCbox.Checked;
|
config.AllowLibationFixup = allowLibationFixupCbox.Checked;
|
||||||
|
|||||||
@@ -334,7 +334,8 @@ namespace LibationWinForms
|
|||||||
var totalProcessed = dialog.TotalBooksProcessed;
|
var totalProcessed = dialog.TotalBooksProcessed;
|
||||||
var newAdded = dialog.NewBooksAdded;
|
var newAdded = dialog.NewBooksAdded;
|
||||||
|
|
||||||
MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}");
|
if (Configuration.Instance.ShowImportedStats)
|
||||||
|
MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net5.0-windows</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ApplicationIcon>libation.ico</ApplicationIcon>
|
<ApplicationIcon>libation.ico</ApplicationIcon>
|
||||||
<AssemblyName>Libation</AssemblyName>
|
<AssemblyName>Libation</AssemblyName>
|
||||||
|
|
||||||
<PublishTrimmed>true</PublishTrimmed>
|
|
||||||
<PublishReadyToRun>true</PublishReadyToRun>
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
@@ -29,7 +28,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dinah.Core.WindowsDesktop" Version="2.1.2.1" />
|
<PackageReference Include="Dinah.Core.WindowsDesktop" Version="4.0.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ namespace LibationWinForms
|
|||||||
//// Only use while debugging. Acts erratically in the wild
|
//// Only use while debugging. Acts erratically in the wild
|
||||||
//AllocConsole();
|
//AllocConsole();
|
||||||
|
|
||||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
ApplicationConfiguration.Initialize();
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
|
|
||||||
//***********************************************//
|
//***********************************************//
|
||||||
// //
|
// //
|
||||||
@@ -140,9 +138,10 @@ namespace LibationWinForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INIT DEFAULT SETTINGS
|
||||||
// if 'new user' was clicked, or if 'returning user' chose new install: show basic settings dialog
|
// if 'new user' was clicked, or if 'returning user' chose new install: show basic settings dialog
|
||||||
config.Books ??= Path.Combine(defaultLibationFilesDir, "Books");
|
config.Books ??= Path.Combine(defaultLibationFilesDir, "Books");
|
||||||
config.InProgress ??= Configuration.WinTemp;
|
AppScaffolding.LibationScaffolding.PopulateMissingConfigValues(config);
|
||||||
|
|
||||||
if (new SettingsDialog().ShowDialog() != DialogResult.OK)
|
if (new SettingsDialog().ShowDialog() != DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
- [The bad](#the-bad)
|
- [The bad](#the-bad)
|
||||||
- [The ugly](#the-ugly)
|
- [The ugly](#the-ugly)
|
||||||
2. [Getting started](#getting-started)
|
2. [Getting started](#getting-started)
|
||||||
|
- [Download Libation](#download-libation-1)
|
||||||
|
- [Installation](#installation)
|
||||||
- [Create Accounts](#create-accounts)
|
- [Create Accounts](#create-accounts)
|
||||||
- [Import your library](#import-your-library)
|
- [Import your library](#import-your-library)
|
||||||
- [Download your books -- DRM-free!](#download-your-books----drm-free)
|
- [Download your books -- DRM-free!](#download-your-books----drm-free)
|
||||||
@@ -64,7 +66,11 @@ I made this for myself and I want to share it with the great programming and aud
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
#### [Download Libation](https://github.com/rmcrackan/Libation/releases)
|
### [Download Libation](https://github.com/rmcrackan/Libation/releases)
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
To install Libation, extract the zip file to a folder, for example `C:\Libation`, and then run Libation.exe from that folder to begin the configuration process and configure your account(s).
|
||||||
|
|
||||||
### Create Accounts
|
### Create Accounts
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="Moq" Version="4.16.1" />
|
<PackageReference Include="Moq" Version="4.16.1" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
<PackageReference Include="FluentAssertions" Version="6.2.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="Moq" Version="4.16.1" />
|
<PackageReference Include="Moq" Version="4.16.1" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
Reference in new issue
Block a user