Skip to content

Commit

Permalink
Prevent the same artist to appear multiple times on tiles.
Browse files Browse the repository at this point in the history
close #75
  • Loading branch information
maforget committed May 28, 2024
1 parent a875b6c commit ff6a42f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ComicRack.Engine/ComicBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using cYo.Projects.ComicRack.Engine.IO;
using cYo.Projects.ComicRack.Engine.IO.Provider;
using cYo.Projects.ComicRack.Engine.Sync;
using SharpCompress.Common;

namespace cYo.Projects.ComicRack.Engine
{
Expand Down Expand Up @@ -1059,12 +1060,15 @@ public string ArtistInfo
{
get
{
StringBuilder stringBuilder = new StringBuilder(base.Writer);
AppendString(stringBuilder, "/", base.Penciller);
AppendString(stringBuilder, "/", base.Inker);
AppendString(stringBuilder, "/", base.Colorist);
AppendString(stringBuilder, "/", base.Letterer);
AppendString(stringBuilder, "/", base.CoverArtist);
HashSet<string> uniqueNames = new HashSet<string>();
StringBuilder stringBuilder = new StringBuilder();
AppendUniqueArtist(stringBuilder, "/", base.Writer, uniqueNames);
AppendUniqueArtist(stringBuilder, "/", base.Penciller, uniqueNames);
AppendUniqueArtist(stringBuilder, "/", base.Inker, uniqueNames);
AppendUniqueArtist(stringBuilder, "/", base.Colorist, uniqueNames);
AppendUniqueArtist(stringBuilder, "/", base.Letterer, uniqueNames);
AppendUniqueArtist(stringBuilder, "/", base.CoverArtist, uniqueNames);

return stringBuilder.ToString();
}
}
Expand Down Expand Up @@ -2647,9 +2651,9 @@ public static string FormatTitle(string textFormat, string series, string title
return fileName ?? string.Empty;
}

private static void AppendString(StringBuilder s, string delimiter, string text)
private static void AppendUniqueArtist(StringBuilder s, string delimiter, string text, HashSet<string> uniqueNames)
{
if (!string.IsNullOrEmpty(text))
if (!string.IsNullOrEmpty(text) && uniqueNames.Add(text))
{
if (s.Length != 0)
{
Expand Down

0 comments on commit ff6a42f

Please sign in to comment.