FIX: null Publications in tasks
This commit is contained in:
parent
16238c590b
commit
42596752d3
@ -26,7 +26,8 @@ public static class Migrate
|
||||
return;
|
||||
|
||||
string tasksJsonString = File.ReadAllText(settings.tasksFilePath);
|
||||
List<TrangaTask> tasks = JsonConvert.DeserializeObject<List<TrangaTask>>(tasksJsonString, new JsonSerializerSettings { Converters = { new TrangaTask.TrangaTaskJsonConverter() } })!;
|
||||
tasks.RemoveAll(t => t.task == TrangaTask.Task.UpdateLibraries);
|
||||
HashSet<TrangaTask> tasks = JsonConvert.DeserializeObject<HashSet<TrangaTask>>(tasksJsonString, new JsonSerializerSettings { Converters = { new TrangaTask.TrangaTaskJsonConverter() } })!;
|
||||
tasks.RemoveWhere(t => t.task == TrangaTask.Task.UpdateLibraries);
|
||||
File.WriteAllText(settings.tasksFilePath, JsonConvert.SerializeObject(tasks));
|
||||
}
|
||||
}
|
@ -30,7 +30,8 @@ public struct Publication
|
||||
|
||||
private static readonly Regex LegalCharacters = new Regex(@"[A-Z]*[a-z]*[0-9]* *\.*-*,*'*\'*\)*\(*~*!*");
|
||||
|
||||
public Publication(string sortName, List<string> authors, string? description, Dictionary<string,string> altTitles, string[] tags, string? posterUrl, string? coverFileNameInCache, Dictionary<string,string>? links, int? year, string? originalLanguage, string status, string publicationId, string? folderName = null, float ignoreChaptersBelow = 0)
|
||||
[JsonConstructor]
|
||||
public Publication(string sortName, List<string> authors, string? description, Dictionary<string,string> altTitles, string[] tags, string? posterUrl, string? coverFileNameInCache, Dictionary<string,string>? links, int? year, string? originalLanguage, string status, string publicationId, string? folderName = null, float? ignoreChaptersBelow = 0)
|
||||
{
|
||||
this.sortName = sortName;
|
||||
this.authors = authors;
|
||||
@ -49,7 +50,7 @@ public struct Publication
|
||||
this.folderName = this.folderName.Substring(0, this.folderName.Length - 1);
|
||||
string onlyLowerLetters = string.Concat(this.sortName.ToLower().Where(Char.IsLetter));
|
||||
this.internalId = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{onlyLowerLetters}{this.year}"));
|
||||
this.ignoreChaptersBelow = ignoreChaptersBelow;
|
||||
this.ignoreChaptersBelow = ignoreChaptersBelow ?? 0f;
|
||||
}
|
||||
|
||||
public string CreatePublicationFolder(string downloadDirectory)
|
||||
|
Loading…
Reference in New Issue
Block a user