Addresses #81
This commit is contained in:
parent
b72da45ae9
commit
1bcbd1517f
@ -29,9 +29,7 @@ public class UpdateMetadata : Job
|
|||||||
if(updatedManga.Equals(this.manga))
|
if(updatedManga.Equals(this.manga))
|
||||||
return Array.Empty<Job>();
|
return Array.Empty<Job>();
|
||||||
|
|
||||||
cachedPublications.Remove(this.manga);
|
this.manga.UpdateMetadata(updatedManga);
|
||||||
this.manga = updatedManga;
|
|
||||||
cachedPublications.Add(updatedManga);
|
|
||||||
this.manga.SaveSeriesInfoJson(settings.downloadLocation, true);
|
this.manga.SaveSeriesInfoJson(settings.downloadLocation, true);
|
||||||
|
|
||||||
if (parentJobId is not null)
|
if (parentJobId is not null)
|
||||||
|
@ -11,23 +11,23 @@ namespace Tranga;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public struct Manga
|
public struct Manga
|
||||||
{
|
{
|
||||||
public string sortName { get; }
|
public string sortName { get; private set; }
|
||||||
public List<string> authors { get; }
|
public List<string> authors { get; }
|
||||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||||
public Dictionary<string,string> altTitles { get; }
|
public Dictionary<string,string> altTitles { get; }
|
||||||
// ReSharper disable once MemberCanBePrivate.Global
|
// ReSharper disable once MemberCanBePrivate.Global
|
||||||
public string? description { get; }
|
public string? description { get; private set; }
|
||||||
public string[] tags { get; }
|
public string[] tags { get; }
|
||||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||||
public string? coverUrl { get; }
|
public string? coverUrl { get; }
|
||||||
public string? coverFileNameInCache { get; set; }
|
public string? coverFileNameInCache { get; }
|
||||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||||
public Dictionary<string,string> links { get; }
|
public Dictionary<string,string> links { get; }
|
||||||
// ReSharper disable once MemberCanBePrivate.Global
|
// ReSharper disable once MemberCanBePrivate.Global
|
||||||
public int? year { get; }
|
public int? year { get; private set; }
|
||||||
public string? originalLanguage { get; }
|
public string? originalLanguage { get; }
|
||||||
// ReSharper disable twice MemberCanBePrivate.Global
|
// ReSharper disable twice MemberCanBePrivate.Global
|
||||||
public string status { get; }
|
public string status { get; private set; }
|
||||||
public ReleaseStatusByte releaseStatus { get; }
|
public ReleaseStatusByte releaseStatus { get; }
|
||||||
public enum ReleaseStatusByte : byte
|
public enum ReleaseStatusByte : byte
|
||||||
{
|
{
|
||||||
@ -72,6 +72,17 @@ public struct Manga
|
|||||||
this.releaseStatus = releaseStatus;
|
this.releaseStatus = releaseStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateMetadata(Manga newManga)
|
||||||
|
{
|
||||||
|
this.sortName = newManga.sortName;
|
||||||
|
this.description = newManga.description;
|
||||||
|
foreach (string author in newManga.authors)
|
||||||
|
if(this.authors.Contains(author))
|
||||||
|
this.authors.Add(author);
|
||||||
|
this.status = newManga.status;
|
||||||
|
this.year = newManga.year;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
public override bool Equals(object? obj)
|
||||||
{
|
{
|
||||||
if (obj is not Manga compareManga)
|
if (obj is not Manga compareManga)
|
||||||
|
Loading…
Reference in New Issue
Block a user