The Free Software Media System - Server Backend & API
add Add to collection buttons
Luke Pulverenti1af651bc5602
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.csindex 32ad2ff122..87d257f12e 100644--- a/MediaBrowser.Controller/Channels/Channel.cs+++ b/MediaBrowser.Controller/Channels/Channel.cs@@ -60,7 +60,12 @@ namespace MediaBrowser.Controller.Channelsprotected override string GetInternalMetadataPath(string basePath){- return System.IO.Path.Combine(basePath, "channels", Id.ToString("N"), "metadata");+ return GetInternalMetadataPath(basePath, Id);+ }++ public static string GetInternalMetadataPath(string basePath, Guid id)+ {+ return System.IO.Path.Combine(basePath, "channels", id.ToString("N"), "metadata");}}}diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 6a30df7fe8..2be4f99e9c 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -381,11 +381,6 @@ namespace MediaBrowser.Controller.Entities{var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;- if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder)- {- basePath = System.IO.Path.Combine(basePath, "library");- }-return GetInternalMetadataPath(basePath);}@@ -393,14 +388,10 @@ namespace MediaBrowser.Controller.Entities{var idString = Id.ToString("N");- return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);- }-- public static string GetInternalMetadataPathForId(Guid id)- {- var idString = id.ToString("N");-- var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;+ if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder)+ {+ basePath = System.IO.Path.Combine(basePath, "library");+ }return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);}diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.csindex 166d56c514..deb85ed6a0 100644--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs@@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.Entitiesreturn await GetGameView(user, queryParent, query).ConfigureAwait(false);case CollectionType.BoxSets:- return GetResult(GetMediaFolders(user).SelectMany(i => i.GetRecursiveChildren(user)).OfType<BoxSet>(), queryParent, query);+ return await GetBoxsetView(queryParent, user, query).ConfigureAwait(false);case CollectionType.TvShows:return await GetTvView(queryParent, user, query).ConfigureAwait(false);@@ -526,6 +526,22 @@ namespace MediaBrowser.Controller.Entitiesreturn GetResult(items, queryParent, query);}+ private async Task<QueryResult<BaseItem>> GetBoxsetView(Folder parent, User user, InternalItemsQuery query)+ {+ return GetResult(GetMediaFolders(user).SelectMany(i =>+ {+ var hasCollectionType = i as ICollectionFolder;++ if (hasCollectionType != null && string.Equals(hasCollectionType.CollectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))+ {+ return i.GetChildren(user, true);+ }++ return i.GetRecursiveChildren(user);++ }).OfType<BoxSet>(), parent, query);+ }+private async Task<QueryResult<BaseItem>> GetTvView(Folder parent, User user, InternalItemsQuery query){if (query.Recursive)diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex d9982e7863..823c34a756 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -1,5 +1,6 @@using MediaBrowser.Common.IO;using MediaBrowser.Common.Net;+using MediaBrowser.Controller;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Audio;@@ -58,6 +59,7 @@ namespace MediaBrowser.Providers.Managerprivate IMetadataProvider[] _metadataProviders = { };private IEnumerable<IMetadataSaver> _savers;private IImageSaver[] _imageSavers;+ private readonly IServerApplicationPaths _appPaths;private IExternalId[] _externalIds;@@ -69,13 +71,14 @@ namespace MediaBrowser.Providers.Manager/// <param name="libraryMonitor">The directory watchers.</param>/// <param name="logManager">The log manager.</param>/// <param name="fileSystem">The file system.</param>- public ProviderManager(IHttpClient httpClient, IServerConfigurationManager configurationManager, ILibraryMonitor libraryMonitor, ILogManager logManager, IFileSystem fileSystem)+ public ProviderManager(IHttpClient httpClient, IServerConfigurationManager configurationManager, ILibraryMonitor libraryMonitor, ILogManager logManager, IFileSystem fileSystem, IServerApplicationPaths appPaths){_logger = logManager.GetLogger("ProviderManager");_httpClient = httpClient;ConfigurationManager = configurationManager;_libraryMonitor = libraryMonitor;_fileSystem = fileSystem;+ _appPaths = appPaths;}/// <summary>@@ -467,7 +470,7 @@ namespace MediaBrowser.Providers.Manager// Give it a dummy path just so that it looks like a file system itemvar dummy = new T(){- Path = BaseItem.GetInternalMetadataPathForId(Guid.NewGuid()),+ Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),// Dummy this up to fool the local trailer checkParent = new Folder()@@ -709,7 +712,7 @@ namespace MediaBrowser.Providers.Manager// Give it a dummy path just so that it looks like a file system itemvar dummy = new TItemType{- Path = BaseItem.GetInternalMetadataPathForId(Guid.NewGuid()),+ Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),// Dummy this up to fool the local trailer checkParent = new Folder()diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.csindex a7e248ea46..99ca0b5dac 100644--- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs+++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs@@ -393,7 +393,9 @@ namespace MediaBrowser.Server.Implementations.Channelsprivate async Task<Channel> GetChannel(IChannel channelInfo, CancellationToken cancellationToken){- var path = Path.Combine(_config.ApplicationPaths.ItemsByNamePath, "channels", _fileSystem.GetValidFilename(channelInfo.Name));+ var id = GetInternalChannelId(channelInfo.Name);++ var path = Channel.GetInternalMetadataPath(_config.ApplicationPaths.InternalMetadataPath, id);var fileInfo = new DirectoryInfo(path);@@ -414,8 +416,6 @@ namespace MediaBrowser.Server.Implementations.ChannelsisNew = true;}- var id = GetInternalChannelId(channelInfo.Name);-var item = _libraryManager.GetItemById(id) as Channel;if (item == null)diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.csindex b28c987286..1306188dad 100644--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs@@ -1646,7 +1646,7 @@ namespace MediaBrowser.Server.Implementations.Libraryvar id = GetNewItemId("7_namedview_" + name + user.Id.ToString("N") + parentId, typeof(UserView));- var path = BaseItem.GetInternalMetadataPathForId(id);+ var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", "specialviews", id.ToString("N"));var item = GetItemById(id) as UserView;diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.csindex 67b9d546fd..e3447afc99 100644--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs@@ -4,7 +4,6 @@ using MediaBrowser.Controller.Library;using MediaBrowser.Model.Entities;using System;using System.IO;-using System.Linq;namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies{@@ -46,17 +45,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesreturn null;}- private bool IsInvalid(string collectionType)- {- var validCollectionTypes = new[]- {- CollectionType.Movies,- CollectionType.BoxSets- };-- return !validCollectionTypes.Contains(collectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);- }-/// <summary>/// Sets the initial item values./// </summary>diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.jsonindex 5d37007e06..914924f42b 100644--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json@@ -45,8 +45,14 @@"LabelFailed": "(failed)","ButtonHelp": "Help","ButtonSave": "Save",+ "HeaderAddToCollection": "Add to Collection",+ "NewCollectionNameExample": "Example: Star Wars Collection",+ "OptionSearchForInternetMetadata": "Search the internet for artwork and metadata",+ "LabelSelectCollection": "Select collection:","HeaderDevices": "Devices","ButtonScheduledTasks": "Scheduled tasks",+ "MessageItemsAdded": "Items added",+ "ButtonAddToCollection": "Add to collection","HeaderSelectCertificatePath": "Select Certificate Path","ConfirmMessageScheduledTaskButton": "This operation normally runs automatically as a scheduled task. It can also be run manually here. To configure the scheduled task, see:","HeaderSupporterBenefit": "A supporter membership provides additional benefits such as access to premium plugins, internet channel content, and more. {0}Learn more{1}.",@@ -223,6 +229,7 @@"ButtonRefresh": "Refresh","LabelCurrentPath": "Current path:","HeaderSelectMediaPath": "Select Media Path",+ "HeaderSelectPath": "Select Path","ButtonNetwork": "Network","MessageDirectoryPickerInstruction": "Network paths can be entered manually in the event the Network button fails to locate your devices. For example, {0} or {1}.","HeaderMenu": "Menu",diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.jsonindex 3a5e7c77e7..576e0493e2 100644--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json@@ -55,6 +55,8 @@"HeaderAudio": "Audio","HeaderVideo": "Video","HeaderPaths": "Paths",+ "LabelSyncTempPath": "Temporary file path:",+ "LabelSyncTempPathHelp": "","LabelCustomCertificatePath": "Custom certificate path:","LabelCustomCertificatePathHelp": "Supply your own ssl certificate. If omitted, the server will create a self-signed certificate.","TitleNotifications": "Notifications",@@ -516,10 +518,7 @@"LabelPreferredDisplayLanguageHelp": "Translating Media Browser is an ongoing project and is not yet complete.","LabelReadHowYouCanContribute": "Read about how you can contribute.","HeaderNewCollection": "New Collection",- "HeaderAddToCollection": "Add to Collection","ButtonSubmit": "Submit",- "NewCollectionNameExample": "Example: Star Wars Collection",- "OptionSearchForInternetMetadata": "Search the internet for artwork and metadata","ButtonCreate": "Create","LabelCustomCss": "Custom css:","LabelCustomCssHelp": "Apply your own custom css to the web interface.",@@ -891,6 +890,8 @@"OptionDefaultSort": "Default","OptionCommunityMostWatchedSort": "Most Watched","TabNextUp": "Next Up",+ "HeaderBecomeMediaBrowserSupporter": "Become a Media Browser Supporter",+ "TextAccessPremiumFeatures": "Enjoy Premium Features","MessageNoMovieSuggestionsAvailable": "No movie suggestions are currently available. Start watching and rating your movies, and then come back to view your recommendations.","MessageNoCollectionsAvailable": "Collections allow you to enjoy personalized groupings of Movies, Series, Albums, Books and Games. Click the + button to start creating Collections.","MessageNoPlaylistsAvailable": "Playlists allow you to create lists of content to play consecutively at a time. To add items to playlists, right click or tap and hold, then select Add to Playlist.",@@ -907,7 +908,6 @@"LabelChannelDownloadAge": "Delete content after: (days)","LabelChannelDownloadAgeHelp": "Downloaded content older than this will be deleted. It will remain playable via internet streaming.","ChannelSettingsFormHelp": "Install channels such as Trailers and Vimeo in the plugin catalog.",- "LabelSelectCollection": "Select collection:","ButtonOptions": "Options","ViewTypeMovies": "Movies","ViewTypeTvShows": "TV",@@ -969,6 +969,7 @@"LabelGroupChannelsIntoViews": "Display the following channels directly within my views:","LabelGroupChannelsIntoViewsHelp": "If enabled, these channels will be displayed directly alongside other views. If disabled, they'll be displayed within a separate Channels view.","LabelDisplayCollectionsView": "Display a collections view to show movie collections",+ "LabelDisplayCollectionsViewHelp": "This will create a separate view to display collections that you've created or have access to. To create a collection, right-click or tap-hold any movie and select 'Add to Collection'. ","LabelKodiMetadataEnableExtraThumbs": "Copy extrafanart into extrathumbs","LabelKodiMetadataEnableExtraThumbsHelp": "When downloading images they can be saved into both extrafanart and extrathumbs for maximum Kodi skin compatibility.","TabServices": "Services",diff --git a/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs b/MediaBrowser.Server.Implementations/Themes/AppThemeManager.csindex 9845f38674..2711c08aac 100644--- a/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs+++ b/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs@@ -33,7 +33,7 @@ namespace MediaBrowser.Server.Implementations.Themes{get{- return Path.Combine(_appPaths.ItemsByNamePath, "appthemes");+ return Path.Combine(_appPaths.ProgramDataPath, "appthemes");}}diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.csindex 4fc6ae6fa1..439d74ab90 100644--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs@@ -419,7 +419,7 @@ namespace MediaBrowser.Server.Startup.CommonLibraryMonitor = new LibraryMonitor(LogManager, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager);RegisterSingleInstance(LibraryMonitor);- ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, LibraryMonitor, LogManager, FileSystemManager);+ ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, LibraryMonitor, LogManager, FileSystemManager, ApplicationPaths);RegisterSingleInstance(ProviderManager);SeriesOrderManager = new SeriesOrderManager();diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.csindex 90a5b4ab64..340b02be75 100644--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs@@ -565,7 +565,8 @@ namespace MediaBrowser.WebDashboard.Api"userimage.css","livetv.css","nowplaying.css",- "icons.css"+ "icons.css",+ "materialize.css"};var builder = new StringBuilder();diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csprojindex 1f720eb26c..7613195ea3 100644--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj@@ -96,6 +96,9 @@<Content Include="dashboard-ui\css\images\tour\dashboard\help.png"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>+ <Content Include="dashboard-ui\css\materialize.css">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </Content><Content Include="dashboard-ui\dashboardhosting.html"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>