aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/AggregateFolder.cs33
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs7
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs30
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs6
-rw-r--r--MediaBrowser.Controller/Playlists/Playlist.cs6
6 files changed, 77 insertions, 7 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index 7b4231010..4aa99ae87 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -67,6 +67,31 @@ namespace MediaBrowser.Controller.Entities
return CreateResolveArgs(directoryService, true).FileSystemChildren;
}
+ private List<Guid> _childrenIds = null;
+ private readonly object _childIdsLock = new object();
+ protected override IEnumerable<BaseItem> LoadChildren()
+ {
+ lock (_childIdsLock)
+ {
+ if (_childrenIds == null || _childrenIds.Count == 0)
+ {
+ var list = base.LoadChildren().ToList();
+ _childrenIds = list.Select(i => i.Id).ToList();
+ return list;
+ }
+
+ return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();
+ }
+ }
+
+ private void ResetCachedChildren()
+ {
+ lock (_childIdsLock)
+ {
+ _childrenIds = null;
+ }
+ }
+
private bool _requiresRefresh;
public override bool RequiresRefresh()
{
@@ -89,6 +114,8 @@ namespace MediaBrowser.Controller.Entities
public override bool BeforeMetadataRefresh()
{
+ ResetCachedChildren();
+
var changed = base.BeforeMetadataRefresh() || _requiresRefresh;
_requiresRefresh = false;
return changed;
@@ -96,9 +123,11 @@ namespace MediaBrowser.Controller.Entities
private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService, bool setPhysicalLocations)
{
+ ResetCachedChildren();
+
var path = ContainingFolderPath;
- var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths , directoryService)
+ var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
{
FileInfo = FileSystem.GetDirectoryInfo(path),
Path = path,
@@ -135,7 +164,7 @@ namespace MediaBrowser.Controller.Entities
return args;
}
-
+
/// <summary>
/// Adds the virtual child.
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 6326bbd4f..1af55a389 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -5,9 +5,11 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
namespace MediaBrowser.Controller.Entities.Audio
@@ -266,6 +268,11 @@ namespace MediaBrowser.Controller.Entities.Audio
Size = i.Size
};
+ if (info.Protocol == MediaProtocol.File)
+ {
+ info.ETag = i.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
+ }
+
if (string.IsNullOrEmpty(info.Container))
{
if (!string.IsNullOrWhiteSpace(i.Path) && locationType != LocationType.Remote && locationType != LocationType.Virtual)
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index bf04c643c..23055690c 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -273,7 +273,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
protected virtual IEnumerable<BaseItem> LoadChildren()
{
- //Logger.Debug("Loading children from {0} {1}", Id, Path);
+ //Logger.Debug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
//just load our children from the repo - the library will be validated and maintained in other processes
return GetCachedChildren();
}
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index ba50a1e0d..742ade200 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -62,11 +62,18 @@ namespace MediaBrowser.Controller.Entities.Movies
return UnratedItem.Movie;
}
- protected override IEnumerable<BaseItem> LoadChildren()
+ protected override IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
{
- var first = LinkedChildren.FirstOrDefault();
+ if (IsLegacyBoxSet)
+ {
+ return base.LoadChildren();
+ }
+ return new List<BaseItem>();
+ }
- if (first != null && first.Type == LinkedChildType.Shortcut)
+ protected override IEnumerable<BaseItem> LoadChildren()
+ {
+ if (IsLegacyBoxSet)
{
return base.LoadChildren();
}
@@ -89,7 +96,22 @@ namespace MediaBrowser.Controller.Entities.Movies
{
get
{
- return true;
+ if (IsLegacyBoxSet)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ [IgnoreDataMember]
+ private bool IsLegacyBoxSet
+ {
+ get
+ {
+ // TODO
+ return false;
}
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 830747d3c..8809f155c 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -12,6 +12,7 @@ using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
namespace MediaBrowser.Controller.Entities
@@ -611,6 +612,11 @@ namespace MediaBrowser.Controller.Entities
SupportsDirectStream = i.VideoType == VideoType.VideoFile
};
+ if (info.Protocol == MediaProtocol.File)
+ {
+ info.ETag = i.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
+ }
+
if (i.IsShortcut)
{
info.Path = i.ShortcutPath;
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index 3e706f1fa..654b97d7d 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Providers;
namespace MediaBrowser.Controller.Playlists
{
@@ -69,6 +70,11 @@ namespace MediaBrowser.Controller.Playlists
return GetPlayableItems(user).Result;
}
+ protected override IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
+ {
+ return new List<BaseItem>();
+ }
+
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
{
var items = GetPlayableItems(user).Result;