浏览代码

add Add to collection buttons

Luke Pulverenti 10 年之前
父节点
当前提交
1af651bc56

+ 6 - 1
MediaBrowser.Controller/Channels/Channel.cs

@@ -60,7 +60,12 @@ namespace MediaBrowser.Controller.Channels
 
         protected 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");
         }
     }
 }

+ 4 - 13
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);
         }

+ 17 - 1
MediaBrowser.Controller/Entities/UserViewBuilder.cs

@@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.Entities
                     return 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.Entities
             return 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)

+ 6 - 3
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.Manager
         private 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 item
             var dummy = new T()
             {
-                Path = BaseItem.GetInternalMetadataPathForId(Guid.NewGuid()),
+                Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),
 
                 // Dummy this up to fool the local trailer check
                 Parent = new Folder()
@@ -709,7 +712,7 @@ namespace MediaBrowser.Providers.Manager
             // Give it a dummy path just so that it looks like a file system item
             var dummy = new TItemType
             {
-                Path = BaseItem.GetInternalMetadataPathForId(Guid.NewGuid()),
+                Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),
 
                 // Dummy this up to fool the local trailer check
                 Parent = new Folder()

+ 3 - 3
MediaBrowser.Server.Implementations/Channels/ChannelManager.cs

@@ -393,7 +393,9 @@ namespace MediaBrowser.Server.Implementations.Channels
 
         private 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.Channels
                 isNew = true;
             }
 
-            var id = GetInternalChannelId(channelInfo.Name);
-
             var item = _libraryManager.GetItemById(id) as Channel;
 
             if (item == null)

+ 1 - 1
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -1646,7 +1646,7 @@ namespace MediaBrowser.Server.Implementations.Library
 
             var 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;
 

+ 0 - 12
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.Movies
             return 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>

+ 7 - 0
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",

+ 5 - 4
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",

+ 1 - 1
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");
             }
         }
 

+ 1 - 1
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -419,7 +419,7 @@ namespace MediaBrowser.Server.Startup.Common
             LibraryMonitor = 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();

+ 2 - 1
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();

+ 3 - 0
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>