aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-12-07 15:23:40 -0700
committercrobibero <cody@robibe.ro>2020-12-07 15:23:40 -0700
commit8517b28eba8c96f8b695a8137c7f9f0d22212400 (patch)
tree6769590290ab17ae74aa532734e6512534b6c637
parent6722fcec363a5f2e6ed85ac0609c250fb078155b (diff)
Make BaseItemDto Guids nullable
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs4
-rw-r--r--MediaBrowser.Model/Dto/BaseItemDto.cs10
-rw-r--r--tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs6
3 files changed, 10 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index 8c9bb6ba01..7842be7164 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -1928,7 +1928,7 @@ namespace Emby.Server.Implementations.LiveTv
foreach (var programDto in currentProgramDtos)
{
- if (currentChannelsDict.TryGetValue(programDto.ChannelId, out BaseItemDto channelDto))
+ if (programDto.ChannelId.HasValue && currentChannelsDict.TryGetValue(programDto.ChannelId.Value, out BaseItemDto channelDto))
{
channelDto.CurrentProgram = programDto;
}
@@ -2018,7 +2018,7 @@ namespace Emby.Server.Implementations.LiveTv
info.DayPattern = _tvDtoService.GetDayPattern(info.Days);
info.Name = program.Name;
- info.ChannelId = programDto.ChannelId;
+ info.ChannelId = programDto.ChannelId ?? Guid.Empty;
info.ChannelName = programDto.ChannelName;
info.StartDate = program.StartDate;
info.Name = program.Name;
diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs
index fac7541773..3f7aac9cd8 100644
--- a/MediaBrowser.Model/Dto/BaseItemDto.cs
+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs
@@ -152,7 +152,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the channel identifier.
/// </summary>
/// <value>The channel identifier.</value>
- public Guid ChannelId { get; set; }
+ public Guid? ChannelId { get; set; }
public string ChannelName { get; set; }
@@ -270,7 +270,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the parent id.
/// </summary>
/// <value>The parent id.</value>
- public Guid ParentId { get; set; }
+ public Guid? ParentId { get; set; }
/// <summary>
/// Gets or sets the type.
@@ -344,13 +344,13 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the series id.
/// </summary>
/// <value>The series id.</value>
- public Guid SeriesId { get; set; }
+ public Guid? SeriesId { get; set; }
/// <summary>
/// Gets or sets the season identifier.
/// </summary>
/// <value>The season identifier.</value>
- public Guid SeasonId { get; set; }
+ public Guid? SeasonId { get; set; }
/// <summary>
/// Gets or sets the special feature count.
@@ -428,7 +428,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the album id.
/// </summary>
/// <value>The album id.</value>
- public Guid AlbumId { get; set; }
+ public Guid? AlbumId { get; set; }
/// <summary>
/// Gets or sets the album image tag.
diff --git a/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs b/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs
index 3c94db4913..663cc3c78f 100644
--- a/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs
+++ b/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs
@@ -3,7 +3,7 @@ using System.Text.Json;
using MediaBrowser.Common.Json.Converters;
using Xunit;
-namespace Jellyfin.Common.Tests.Extensions
+namespace Jellyfin.Common.Tests.Json
{
public class JsonGuidConverterTests
{
@@ -44,9 +44,9 @@ namespace Jellyfin.Common.Tests.Extensions
}
[Fact]
- public void Serialize_EmptyGuid_Null()
+ public void Serialize_EmptyGuid_EmptyGuid()
{
- Assert.Equal("null", JsonSerializer.Serialize(Guid.Empty, _options));
+ Assert.Equal($"\"{Guid.Empty}\"", JsonSerializer.Serialize(Guid.Empty, _options));
}
}
}