瀏覽代碼

update favorites page

Luke Pulverenti 10 年之前
父節點
當前提交
d4fad83ee2

+ 8 - 0
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -464,6 +464,8 @@ namespace MediaBrowser.Controller.Entities
             return sortable;
             return sortable;
         }
         }
 
 
+        public Guid ParentId { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the parent.
         /// Gets or sets the parent.
         /// </summary>
         /// </summary>
@@ -471,6 +473,12 @@ namespace MediaBrowser.Controller.Entities
         [IgnoreDataMember]
         [IgnoreDataMember]
         public Folder Parent { get; set; }
         public Folder Parent { get; set; }
 
 
+        public void SetParent(Folder parent)
+        {
+            Parent = parent;
+            ParentId = parent == null ? Guid.Empty : parent.Id;
+        }
+
         [IgnoreDataMember]
         [IgnoreDataMember]
         public IEnumerable<Folder> Parents
         public IEnumerable<Folder> Parents
         {
         {

+ 4 - 4
MediaBrowser.Controller/Entities/Folder.cs

@@ -134,7 +134,7 @@ namespace MediaBrowser.Controller.Entities
         /// <exception cref="System.InvalidOperationException">Unable to add  + item.Name</exception>
         /// <exception cref="System.InvalidOperationException">Unable to add  + item.Name</exception>
         public async Task AddChild(BaseItem item, CancellationToken cancellationToken)
         public async Task AddChild(BaseItem item, CancellationToken cancellationToken)
         {
         {
-            item.Parent = this;
+            item.SetParent(this);
 
 
             if (item.Id == Guid.Empty)
             if (item.Id == Guid.Empty)
             {
             {
@@ -230,7 +230,7 @@ namespace MediaBrowser.Controller.Entities
         {
         {
             RemoveChildrenInternal(new[] { item });
             RemoveChildrenInternal(new[] { item });
 
 
-            item.Parent = null;
+            item.SetParent(null);
 
 
             return ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken);
             return ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken);
         }
         }
@@ -783,11 +783,11 @@ namespace MediaBrowser.Controller.Entities
                     return LibraryManager.GetOrAddByReferenceItem(item);
                     return LibraryManager.GetOrAddByReferenceItem(item);
                 }
                 }
 
 
-                item.Parent = this;
+                item.SetParent(this);
             }
             }
             else
             else
             {
             {
-                child.Parent = this;
+                child.SetParent(this);
                 LibraryManager.RegisterItem(child);
                 LibraryManager.RegisterItem(child);
                 item = child;
                 item = child;
             }
             }

+ 1 - 2
MediaBrowser.Model/Entities/MediaStream.cs

@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using MediaBrowser.Model.Dlna;
+using MediaBrowser.Model.Dlna;
 using MediaBrowser.Model.Extensions;
 using MediaBrowser.Model.Extensions;
 using System.Diagnostics;
 using System.Diagnostics;
 
 

+ 6 - 8
MediaBrowser.Providers/Manager/ProviderManager.cs

@@ -485,12 +485,11 @@ namespace MediaBrowser.Providers.Manager
             // Give it a dummy path just so that it looks like a file system item
             // Give it a dummy path just so that it looks like a file system item
             var dummy = new T()
             var dummy = new T()
             {
             {
-                Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),
-
-                // Dummy this up to fool the local trailer check
-                Parent = new Folder()
+                Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy")
             };
             };
 
 
+            dummy.SetParent(new Folder());
+
             var options = GetMetadataOptions(dummy);
             var options = GetMetadataOptions(dummy);
 
 
             var summary = new MetadataPluginSummary
             var summary = new MetadataPluginSummary
@@ -727,12 +726,11 @@ namespace MediaBrowser.Providers.Manager
             // Give it a dummy path just so that it looks like a file system item
             // Give it a dummy path just so that it looks like a file system item
             var dummy = new TItemType
             var dummy = new TItemType
             {
             {
-                Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),
-
-                // Dummy this up to fool the local trailer check
-                Parent = new Folder()
+                Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy")
             };
             };
 
 
+            dummy.SetParent(new Folder());
+
             var options = GetMetadataOptions(dummy);
             var options = GetMetadataOptions(dummy);
 
 
             var providers = GetMetadataProvidersInternal<TItemType>(dummy, options, searchInfo.IncludeDisabledProviders)
             var providers = GetMetadataProvidersInternal<TItemType>(dummy, options, searchInfo.IncludeDisabledProviders)

+ 2 - 1
MediaBrowser.Providers/TV/DummySeasonProvider.cs

@@ -111,10 +111,11 @@ namespace MediaBrowser.Providers.TV
             {
             {
                 Name = seasonName,
                 Name = seasonName,
                 IndexNumber = seasonNumber,
                 IndexNumber = seasonNumber,
-                Parent = series,
                 Id = (series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName).GetMBId(typeof(Season))
                 Id = (series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName).GetMBId(typeof(Season))
             };
             };
 
 
+            season.SetParent(series);
+            
             await series.AddChild(season, cancellationToken).ConfigureAwait(false);
             await series.AddChild(season, cancellationToken).ConfigureAwait(false);
 
 
             await season.RefreshMetadata(new MetadataRefreshOptions(), cancellationToken).ConfigureAwait(false);
             await season.RefreshMetadata(new MetadataRefreshOptions(), cancellationToken).ConfigureAwait(false);

+ 2 - 1
MediaBrowser.Providers/TV/MissingEpisodeProvider.cs

@@ -406,10 +406,11 @@ namespace MediaBrowser.Providers.TV
                 Name = name,
                 Name = name,
                 IndexNumber = episodeNumber,
                 IndexNumber = episodeNumber,
                 ParentIndexNumber = seasonNumber,
                 ParentIndexNumber = seasonNumber,
-                Parent = season,
                 Id = (series.Id + seasonNumber.ToString(_usCulture) + name).GetMBId(typeof(Episode))
                 Id = (series.Id + seasonNumber.ToString(_usCulture) + name).GetMBId(typeof(Episode))
             };
             };
 
 
+            episode.SetParent(season);
+
             await season.AddChild(episode, cancellationToken).ConfigureAwait(false);
             await season.AddChild(episode, cancellationToken).ConfigureAwait(false);
 
 
             await episode.RefreshMetadata(new MetadataRefreshOptions
             await episode.RefreshMetadata(new MetadataRefreshOptions

+ 9 - 1
MediaBrowser.Providers/TV/SeriesMetadataService.cs

@@ -7,6 +7,7 @@ using MediaBrowser.Controller.Providers;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Providers.Manager;
 using MediaBrowser.Providers.Manager;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -30,7 +31,14 @@ namespace MediaBrowser.Providers.TV
             {
             {
                 var provider = new DummySeasonProvider(ServerConfigurationManager, Logger, _localization, LibraryManager);
                 var provider = new DummySeasonProvider(ServerConfigurationManager, Logger, _localization, LibraryManager);
 
 
-                await provider.Run(item, CancellationToken.None).ConfigureAwait(false);
+                try
+                {
+                    await provider.Run(item, CancellationToken.None).ConfigureAwait(false);
+                }
+                catch (Exception ex)
+                {
+                    Logger.ErrorException("Error in DummySeasonProvider", ex);
+                }
             }
             }
         }
         }
 
 

+ 0 - 1
MediaBrowser.Server.Implementations/Collections/CollectionManager.cs

@@ -75,7 +75,6 @@ namespace MediaBrowser.Server.Implementations.Collections
                 var collection = new BoxSet
                 var collection = new BoxSet
                 {
                 {
                     Name = name,
                     Name = name,
-                    Parent = parentFolder,
                     Path = path,
                     Path = path,
                     IsLocked = options.IsLocked,
                     IsLocked = options.IsLocked,
                     ProviderIds = options.ProviderIds,
                     ProviderIds = options.ProviderIds,

+ 2 - 2
MediaBrowser.Server.Implementations/Library/ResolverHelper.cs

@@ -34,7 +34,7 @@ namespace MediaBrowser.Server.Implementations.Library
             // If the resolver didn't specify this
             // If the resolver didn't specify this
             if (parent != null)
             if (parent != null)
             {
             {
-                item.Parent = parent;
+                item.SetParent(parent);
             }
             }
 
 
             item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
             item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
@@ -68,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.Library
             // If the resolver didn't specify this
             // If the resolver didn't specify this
             if (args.Parent != null)
             if (args.Parent != null)
             {
             {
-                item.Parent = args.Parent;
+                item.SetParent(args.Parent);
             }
             }
 
 
             item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
             item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());

+ 14 - 3
MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs

@@ -1,4 +1,3 @@
-using System.Runtime.Serialization;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Controller.Entities.TV;
@@ -14,6 +13,7 @@ using System.Data;
 using System.Globalization;
 using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
+using System.Runtime.Serialization;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
@@ -154,6 +154,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
             _connection.AddColumn(_logger, "TypedBaseItems", "ParentIndexNumber", "INT");
             _connection.AddColumn(_logger, "TypedBaseItems", "ParentIndexNumber", "INT");
             _connection.AddColumn(_logger, "TypedBaseItems", "PremiereDate", "DATETIME");
             _connection.AddColumn(_logger, "TypedBaseItems", "PremiereDate", "DATETIME");
             _connection.AddColumn(_logger, "TypedBaseItems", "ProductionYear", "INT");
             _connection.AddColumn(_logger, "TypedBaseItems", "ProductionYear", "INT");
+            _connection.AddColumn(_logger, "TypedBaseItems", "ParentId", "GUID");
 
 
             PrepareStatements();
             PrepareStatements();
 
 
@@ -193,10 +194,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
                 "Overview",
                 "Overview",
                 "ParentIndexNumber",
                 "ParentIndexNumber",
                 "PremiereDate",
                 "PremiereDate",
-                "ProductionYear"
+                "ProductionYear",
+                "ParentId"
             };
             };
             _saveItemCommand = _connection.CreateCommand();
             _saveItemCommand = _connection.CreateCommand();
-            _saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21)";
+            _saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22)";
             for (var i = 1; i <= saveColumns.Count; i++)
             for (var i = 1; i <= saveColumns.Count; i++)
             {
             {
                 _saveItemCommand.Parameters.Add(_saveItemCommand, "@" + i.ToString(CultureInfo.InvariantCulture));
                 _saveItemCommand.Parameters.Add(_saveItemCommand, "@" + i.ToString(CultureInfo.InvariantCulture));
@@ -330,6 +332,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
                     _saveItemCommand.GetParameter(index++).Value = item.PremiereDate;
                     _saveItemCommand.GetParameter(index++).Value = item.PremiereDate;
                     _saveItemCommand.GetParameter(index++).Value = item.ProductionYear;
                     _saveItemCommand.GetParameter(index++).Value = item.ProductionYear;
 
 
+                    if (item.ParentId == Guid.Empty)
+                    {
+                        _saveItemCommand.GetParameter(index++).Value = null;
+                    }
+                    else
+                    {
+                        _saveItemCommand.GetParameter(index++).Value = item.ParentId;
+                    }
+
                     _saveItemCommand.Transaction = transaction;
                     _saveItemCommand.Transaction = transaction;
 
 
                     _saveItemCommand.ExecuteNonQuery();
                     _saveItemCommand.ExecuteNonQuery();

+ 0 - 1
MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs

@@ -113,7 +113,6 @@ namespace MediaBrowser.Server.Implementations.Playlists
                 var playlist = new Playlist
                 var playlist = new Playlist
                 {
                 {
                     Name = name,
                     Name = name,
-                    Parent = parentFolder,
                     Path = path
                     Path = path
                 };
                 };
 
 

+ 6 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -193,6 +193,9 @@
     <Content Include="dashboard-ui\scripts\mypreferenceshome.js">
     <Content Include="dashboard-ui\scripts\mypreferenceshome.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\scripts\secondaryitems.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\scripts\shared.js">
     <Content Include="dashboard-ui\scripts\shared.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
@@ -202,6 +205,9 @@
     <Content Include="dashboard-ui\scripts\sharingwidget.js">
     <Content Include="dashboard-ui\scripts\sharingwidget.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\secondaryitems.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\shared.html">
     <Content Include="dashboard-ui\shared.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>