From 708d5a416ed373c158b3dc45952a1fd123fb74e8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 18 May 2014 18:26:06 -0400 Subject: [PATCH] updated nuget --- MediaBrowser.Controller/Channels/IChannel.cs | 6 +++++ .../Channels/ChannelManager.cs | 27 ++++++++++++------- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +-- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index 8a21179b11..85744119ca 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -15,6 +15,12 @@ namespace MediaBrowser.Controller.Channels /// The name. string Name { get; } + /// + /// Gets the data version. + /// + /// The data version. + string DataVersion { get; } + /// /// Gets the channel information. /// diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index f1558e9dec..db2728ebe9 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -162,9 +162,9 @@ namespace MediaBrowser.Server.Implementations.Channels var channelGuid = new Guid(item.ChannelId); var channel = _channelEntities.First(i => i.Id == channelGuid); - var internalChannel = _channels.First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase)); + var channelPlugin = GetChannelProvider(channel); - var requiresCallback = internalChannel as IRequiresMediaInfoCallback; + var requiresCallback = channelPlugin as IRequiresMediaInfoCallback; if (requiresCallback != null) { @@ -264,7 +264,9 @@ namespace MediaBrowser.Server.Implementations.Channels var channelId = channel.Id.ToString("N"); - var tasks = items.Select(i => GetChannelItemEntity(i, channelId, cancellationToken)); + var channelPlugin = GetChannelProvider(channel); + + var tasks = items.Select(i => GetChannelItemEntity(i, channelPlugin, channelId, cancellationToken)); return await Task.WhenAll(tasks).ConfigureAwait(false); }); @@ -363,7 +365,9 @@ namespace MediaBrowser.Server.Implementations.Channels var categoryKey = string.IsNullOrWhiteSpace(categoryId) ? "root" : categoryId.GetMD5().ToString("N"); - return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, categoryKey, user.Id.ToString("N") + ".json"); + var version = string.IsNullOrWhiteSpace(channel.DataVersion) ? "0" : channel.DataVersion; + + return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, version, categoryKey, user.Id.ToString("N") + ".json"); } private async Task> GetReturnItems(IEnumerable items, User user, ChannelItemQuery query, CancellationToken cancellationToken) @@ -401,13 +405,14 @@ namespace MediaBrowser.Server.Implementations.Channels }; } - private string GetIdToHash(string externalId) + private string GetIdToHash(string externalId, IChannel channelProvider) { // Increment this as needed to force new downloads - return externalId + "8"; + // Incorporate Name because it's being used to convert channel entity to provider + return externalId + (channelProvider.DataVersion ?? string.Empty) + (channelProvider.Name ?? string.Empty) + "11"; } - private async Task GetChannelItemEntity(ChannelItemInfo info, string internalChannnelId, CancellationToken cancellationToken) + private async Task GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, string internalChannnelId, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(internalChannnelId)) { @@ -418,9 +423,11 @@ namespace MediaBrowser.Server.Implementations.Channels Guid id; var isNew = false; + var idToHash = GetIdToHash(info.Id, channelProvider); + if (info.Type == ChannelItemType.Category) { - id = GetIdToHash(info.Id).GetMBId(typeof(ChannelCategoryItem)); + id = idToHash.GetMBId(typeof(ChannelCategoryItem)); item = _libraryManager.GetItemById(id) as ChannelCategoryItem; @@ -432,7 +439,7 @@ namespace MediaBrowser.Server.Implementations.Channels } else if (info.MediaType == ChannelMediaType.Audio) { - id = GetIdToHash(info.Id).GetMBId(typeof(ChannelCategoryItem)); + id = idToHash.GetMBId(typeof(ChannelCategoryItem)); item = _libraryManager.GetItemById(id) as ChannelAudioItem; @@ -444,7 +451,7 @@ namespace MediaBrowser.Server.Implementations.Channels } else { - id = GetIdToHash(info.Id).GetMBId(typeof(ChannelVideoItem)); + id = idToHash.GetMBId(typeof(ChannelVideoItem)); item = _libraryManager.GetItemById(id) as ChannelVideoItem; diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 798d7169de..69ef27c113 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.369 + 3.0.371 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index bc1fb3896f..9e2af2bcaa 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.369 + 3.0.371 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index ba28896035..34c558302b 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.369 + 3.0.371 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +