From 40836f194bc43b6d03277d70e6fb3c79732132a8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 23 May 2014 10:09:58 -0400 Subject: [PATCH] rename channel category to channel folder --- MediaBrowser.Api/ChannelService.cs | 4 +-- MediaBrowser.Api/Images/ImageByNameService.cs | 1 - .../Channels/ChannelAudioItem.cs | 5 ++++ ...elCategoryItem.cs => ChannelFolderItem.cs} | 9 ++++-- .../Channels/ChannelItemType.cs | 2 +- .../Channels/ChannelVideoItem.cs | 5 ++++ .../Channels/InternalChannelItemQuery.cs | 2 +- .../MediaBrowser.Controller.csproj | 2 +- .../Channels/ChannelItemQuery.cs | 2 +- .../Channels/ChannelMediaType.cs | 4 ++- .../Channels/ChannelManager.cs | 30 +++++++++---------- .../MediaBrowser.WebDashboard.csproj | 3 ++ Nuget/MediaBrowser.Common.Internal.nuspec | 4 +-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +-- 15 files changed, 49 insertions(+), 30 deletions(-) rename MediaBrowser.Controller/Channels/{ChannelCategoryItem.cs => ChannelFolderItem.cs} (79%) diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs index 9fa4eec4a..bc3c11374 100644 --- a/MediaBrowser.Api/ChannelService.cs +++ b/MediaBrowser.Api/ChannelService.cs @@ -41,7 +41,7 @@ namespace MediaBrowser.Api { public string Id { get; set; } - public string CategoryId { get; set; } + public string FolderId { get; set; } /// /// Gets or sets the user id. @@ -120,7 +120,7 @@ namespace MediaBrowser.Api StartIndex = request.StartIndex, UserId = request.UserId, ChannelId = request.Id, - CategoryId = request.CategoryId, + FolderId = request.FolderId, SortOrder = request.SortOrder, SortBy = (request.SortBy ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(), Filters = request.GetFilters().ToArray() diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index 6dda2ae7a..c741dd8a8 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using ServiceStack; diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs index 7072d4284..f62573780 100644 --- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs @@ -53,5 +53,10 @@ namespace MediaBrowser.Controller.Channels return base.LocationType; } } + + public override string GetClientTypeName() + { + return "audio.channelItem"; + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs similarity index 79% rename from MediaBrowser.Controller/Channels/ChannelCategoryItem.cs rename to MediaBrowser.Controller/Channels/ChannelFolderItem.cs index c18f74856..56262ab20 100644 --- a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace MediaBrowser.Controller.Channels { - public class ChannelCategoryItem : Folder, IChannelItem + public class ChannelFolderItem : Folder, IChannelItem { public string ExternalId { get; set; } @@ -29,9 +29,14 @@ namespace MediaBrowser.Controller.Channels } } - public ChannelCategoryItem() + public ChannelFolderItem() { Tags = new List(); } + + public override string GetClientTypeName() + { + return "folder.channelItem"; + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelItemType.cs b/MediaBrowser.Controller/Channels/ChannelItemType.cs index ba9d7f414..184ce8a76 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemType.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemType.cs @@ -4,6 +4,6 @@ { Media = 0, - Category = 1 + Folder = 1 } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs index 572e316a0..6d0497c4d 100644 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs @@ -77,5 +77,10 @@ namespace MediaBrowser.Controller.Channels return base.LocationType; } } + + public override string GetClientTypeName() + { + return "video.channelItem"; + } } } diff --git a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs index 3846e8a00..aa8e7b9f1 100644 --- a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs +++ b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs @@ -4,7 +4,7 @@ namespace MediaBrowser.Controller.Channels { public class InternalChannelItemQuery { - public string CategoryId { get; set; } + public string FolderId { get; set; } public User User { get; set; } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index fa7842a68..a198f1091 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -68,7 +68,7 @@ Properties\SharedVersion.cs - + diff --git a/MediaBrowser.Model/Channels/ChannelItemQuery.cs b/MediaBrowser.Model/Channels/ChannelItemQuery.cs index 2da955e88..632db5581 100644 --- a/MediaBrowser.Model/Channels/ChannelItemQuery.cs +++ b/MediaBrowser.Model/Channels/ChannelItemQuery.cs @@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Channels /// Gets or sets the category identifier. /// /// The category identifier. - public string CategoryId { get; set; } + public string FolderId { get; set; } /// /// Gets or sets the user identifier. diff --git a/MediaBrowser.Model/Channels/ChannelMediaType.cs b/MediaBrowser.Model/Channels/ChannelMediaType.cs index 5d2201aaf..102cb6644 100644 --- a/MediaBrowser.Model/Channels/ChannelMediaType.cs +++ b/MediaBrowser.Model/Channels/ChannelMediaType.cs @@ -4,6 +4,8 @@ { Audio = 0, - Video = 1 + Video = 1, + + Photo = 2 } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 06408d525..db5c6b439 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -278,7 +278,7 @@ namespace MediaBrowser.Server.Implementations.Channels ? null : _userManager.GetUserById(new Guid(query.UserId)); - var itemsResult = await GetChannelItems(channelProvider, user, query.CategoryId, providerStartIndex, providerLimit, cancellationToken) + var itemsResult = await GetChannelItems(channelProvider, user, query.FolderId, providerStartIndex, providerLimit, cancellationToken) .ConfigureAwait(false); var providerTotalRecordCount = providerLimit.HasValue ? itemsResult.TotalRecordCount : null; @@ -301,9 +301,9 @@ namespace MediaBrowser.Server.Implementations.Channels } private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1); - private async Task GetChannelItems(IChannel channel, User user, string categoryId, int? startIndex, int? limit, CancellationToken cancellationToken) + private async Task GetChannelItems(IChannel channel, User user, string folderId, int? startIndex, int? limit, CancellationToken cancellationToken) { - var cachePath = GetChannelDataCachePath(channel, user, categoryId); + var cachePath = GetChannelDataCachePath(channel, user, folderId); try { @@ -358,11 +358,11 @@ namespace MediaBrowser.Server.Implementations.Channels Limit = limit }; - if (!string.IsNullOrWhiteSpace(categoryId)) + if (!string.IsNullOrWhiteSpace(folderId)) { - var categoryItem = (IChannelItem)_libraryManager.GetItemById(new Guid(categoryId)); + var categoryItem = (IChannelItem)_libraryManager.GetItemById(new Guid(folderId)); - query.CategoryId = categoryItem.ExternalId; + query.FolderId = categoryItem.ExternalId; } var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false); @@ -394,15 +394,15 @@ namespace MediaBrowser.Server.Implementations.Channels } } - private string GetChannelDataCachePath(IChannel channel, User user, string categoryId) + private string GetChannelDataCachePath(IChannel channel, User user, string folderId) { var channelId = GetInternalChannelId(channel.Name).ToString("N"); - var categoryKey = string.IsNullOrWhiteSpace(categoryId) ? "root" : categoryId.GetMD5().ToString("N"); + var folderKey = string.IsNullOrWhiteSpace(folderId) ? "root" : folderId.GetMD5().ToString("N"); var version = string.IsNullOrWhiteSpace(channel.DataVersion) ? "0" : channel.DataVersion; - return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, version, categoryKey, user.Id.ToString("N") + ".json"); + return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, version, folderKey, user.Id.ToString("N") + ".json"); } private async Task> GetReturnItems(IEnumerable items, int? totalCountFromProvider, User user, ChannelItemQuery query, CancellationToken cancellationToken) @@ -448,7 +448,7 @@ namespace MediaBrowser.Server.Implementations.Channels { // Increment this as needed to force new downloads // Incorporate Name because it's being used to convert channel entity to provider - return externalId + (channelProvider.DataVersion ?? string.Empty) + (channelProvider.Name ?? string.Empty) + "11"; + return externalId + (channelProvider.DataVersion ?? string.Empty) + (channelProvider.Name ?? string.Empty) + "12"; } private async Task GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Channel internalChannel, CancellationToken cancellationToken) @@ -459,21 +459,21 @@ namespace MediaBrowser.Server.Implementations.Channels var idToHash = GetIdToHash(info.Id, channelProvider); - if (info.Type == ChannelItemType.Category) + if (info.Type == ChannelItemType.Folder) { - id = idToHash.GetMBId(typeof(ChannelCategoryItem)); + id = idToHash.GetMBId(typeof(ChannelFolderItem)); - item = _libraryManager.GetItemById(id) as ChannelCategoryItem; + item = _libraryManager.GetItemById(id) as ChannelFolderItem; if (item == null) { isNew = true; - item = new ChannelCategoryItem(); + item = new ChannelFolderItem(); } } else if (info.MediaType == ChannelMediaType.Audio) { - id = idToHash.GetMBId(typeof(ChannelCategoryItem)); + id = idToHash.GetMBId(typeof(ChannelFolderItem)); item = _libraryManager.GetItemById(id) as ChannelAudioItem; diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 3c97f8d4b..84e9645c2 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -172,6 +172,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index b2bb75a9a..5f90fd709 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.372 + 3.0.374 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 348d67d07..bb936bc0c 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.372 + 3.0.374 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 08c81391f..e3bc343ab 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.372 + 3.0.374 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 - +