From 5aa222d799009eec5203a576f56902307e564d1f Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 29 Feb 2020 22:06:39 +0100 Subject: [PATCH] Removing usless | at the begining of externals id --- Kyoo.Common/Models/Episode.cs | 3 ++- Kyoo.Common/Models/People.cs | 3 ++- Kyoo.Common/Models/Season.cs | 3 ++- Kyoo.Common/Models/Show.cs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Kyoo.Common/Models/Episode.cs b/Kyoo.Common/Models/Episode.cs index 18d093ba..a08396ea 100644 --- a/Kyoo.Common/Models/Episode.cs +++ b/Kyoo.Common/Models/Episode.cs @@ -1,6 +1,7 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Linq; namespace Kyoo.Models { @@ -103,7 +104,7 @@ namespace Kyoo.Models if (Runtime == -1) Runtime = other.Runtime; ImgPrimary ??= other.ImgPrimary; - ExternalIDs = string.Join('|', ExternalIDs, other.ExternalIDs); + ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x))); return this; } } diff --git a/Kyoo.Common/Models/People.cs b/Kyoo.Common/Models/People.cs index 81642ad9..78b935fb 100644 --- a/Kyoo.Common/Models/People.cs +++ b/Kyoo.Common/Models/People.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Newtonsoft.Json; namespace Kyoo.Models @@ -29,7 +30,7 @@ namespace Kyoo.Models Slug ??= other.Slug; Name ??= other.Name; ImgPrimary ??= other.ImgPrimary; - ExternalIDs += '|' + other.ExternalIDs; + ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x))); return this; } } diff --git a/Kyoo.Common/Models/Season.cs b/Kyoo.Common/Models/Season.cs index 1ecf15a1..2a9a8212 100644 --- a/Kyoo.Common/Models/Season.cs +++ b/Kyoo.Common/Models/Season.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Newtonsoft.Json; namespace Kyoo.Models @@ -44,7 +45,7 @@ namespace Kyoo.Models Overview ??= other.Overview; Year ??= other.Year; ImgPrimary ??= other.ImgPrimary; - ExternalIDs = string.Join('|', ExternalIDs, other.ExternalIDs); + ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x))); return this; } } diff --git a/Kyoo.Common/Models/Show.cs b/Kyoo.Common/Models/Show.cs index 28c31eaa..f377bd37 100644 --- a/Kyoo.Common/Models/Show.cs +++ b/Kyoo.Common/Models/Show.cs @@ -123,7 +123,7 @@ namespace Kyoo.Models ImgBackdrop ??= other.ImgBackdrop; if (other.Studio != null) Studio ??= other.Studio; - ExternalIDs = string.Join('|', ExternalIDs, other.ExternalIDs); + ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x))); return this; } }