aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs2
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs6
-rw-r--r--MediaBrowser.Controller/Entities/Book.cs2
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs60
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Game.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasMetadata.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs13
-rw-r--r--MediaBrowser.Controller/Entities/Photo.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs7
10 files changed, 89 insertions, 11 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 1897511af..6326bbd4f 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -47,7 +47,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
[IgnoreDataMember]
- public override bool EnableForceSaveOnDateModifiedChange
+ public override bool EnableRefreshOnDateModifiedChange
{
get { return true; }
}
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 1d623c3ac..cc3646cdc 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -455,7 +455,7 @@ namespace MediaBrowser.Controller.Entities
public DateTime DateLastRefreshed { get; set; }
[IgnoreDataMember]
- public virtual bool EnableForceSaveOnDateModifiedChange
+ public virtual bool EnableRefreshOnDateModifiedChange
{
get { return false; }
}
@@ -951,7 +951,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => !i.IsDirectory && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase))
);
- return LibraryManager.ResolvePaths(files, directoryService, null)
+ return LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
.OfType<Audio.Audio>()
.Select(audio =>
{
@@ -981,7 +981,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => string.Equals(i.Name, ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
.SelectMany(i => directoryService.GetFiles(i.FullName));
- return LibraryManager.ResolvePaths(files, directoryService, null)
+ return LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
.OfType<Video>()
.Select(item =>
{
diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs
index 59ab95437..56f9fa784 100644
--- a/MediaBrowser.Controller/Entities/Book.cs
+++ b/MediaBrowser.Controller/Entities/Book.cs
@@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public override bool EnableForceSaveOnDateModifiedChange
+ public override bool EnableRefreshOnDateModifiedChange
{
get { return true; }
}
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 8bf9919f2..68ba22356 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -3,11 +3,14 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Model.Serialization;
using MoreLinq;
namespace MediaBrowser.Controller.Entities
@@ -18,6 +21,8 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public class CollectionFolder : Folder, ICollectionFolder
{
+ public static IXmlSerializer XmlSerializer { get; set; }
+
public CollectionFolder()
{
PhysicalLocationsList = new List<string>();
@@ -39,6 +44,61 @@ namespace MediaBrowser.Controller.Entities
public string CollectionType { get; set; }
+ private readonly Dictionary<string, LibraryOptions> _libraryOptions = new Dictionary<string, LibraryOptions>();
+ public LibraryOptions GetLibraryOptions()
+ {
+ lock (_libraryOptions)
+ {
+ LibraryOptions options;
+ if (!_libraryOptions.TryGetValue(Path, out options))
+ {
+ options = LoadLibraryOptions();
+ _libraryOptions[Path] = options;
+ }
+
+ return options;
+ }
+ }
+
+ private LibraryOptions LoadLibraryOptions()
+ {
+ try
+ {
+ var result = XmlSerializer.DeserializeFromFile(typeof(LibraryOptions), GetLibraryOptionsPath(Path)) as LibraryOptions;
+
+ if (result == null)
+ {
+ return new LibraryOptions();
+ }
+
+ return result;
+ }
+ catch (FileNotFoundException)
+ {
+ return new LibraryOptions();
+ }
+ catch (DirectoryNotFoundException)
+ {
+ return new LibraryOptions();
+ }
+ catch (Exception ex)
+ {
+ Logger.ErrorException("Error loading library options", ex);
+
+ return new LibraryOptions();
+ }
+ }
+
+ private static string GetLibraryOptionsPath(string path)
+ {
+ return System.IO.Path.Combine(path, "options.xml");
+ }
+
+ public static void SaveLibraryOptions(string path, LibraryOptions options)
+ {
+ XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
+ }
+
/// <summary>
/// Allow different display preferences for each collection folder
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index c1728ce38..bf04c643c 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -273,6 +273,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
protected virtual IEnumerable<BaseItem> LoadChildren()
{
+ //Logger.Debug("Loading children from {0} {1}", Id, Path);
//just load our children from the repo - the library will be validated and maintained in other processes
return GetCachedChildren();
}
@@ -643,8 +644,9 @@ namespace MediaBrowser.Controller.Entities
protected virtual IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
{
var collectionType = LibraryManager.GetContentType(this);
+ var libraryOptions = LibraryManager.GetLibraryOptions(this);
- return LibraryManager.ResolvePaths(GetFileSystemChildren(directoryService), directoryService, this, collectionType);
+ return LibraryManager.ResolvePaths(GetFileSystemChildren(directoryService), directoryService, this, libraryOptions, collectionType);
}
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index 54386a179..24910498f 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public override bool EnableForceSaveOnDateModifiedChange
+ public override bool EnableRefreshOnDateModifiedChange
{
get { return true; }
}
diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs
index c7a3c7778..d5891c655 100644
--- a/MediaBrowser.Controller/Entities/IHasMetadata.cs
+++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs
@@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.Entities
bool RequiresRefresh();
- bool EnableForceSaveOnDateModifiedChange { get; }
+ bool EnableRefreshOnDateModifiedChange { get; }
string PresentationUniqueKey { get; set; }
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index 4effc162e..ba50a1e0d 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -62,6 +62,19 @@ namespace MediaBrowser.Controller.Entities.Movies
return UnratedItem.Movie;
}
+ protected override IEnumerable<BaseItem> LoadChildren()
+ {
+ var first = LinkedChildren.FirstOrDefault();
+
+ if (first != null && first.Type == LinkedChildType.Shortcut)
+ {
+ return base.LoadChildren();
+ }
+
+ // Save a trip to the database
+ return new List<BaseItem>();
+ }
+
[IgnoreDataMember]
public override bool IsPreSorted
{
diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs
index 804ea04a5..965616eb5 100644
--- a/MediaBrowser.Controller/Entities/Photo.cs
+++ b/MediaBrowser.Controller/Entities/Photo.cs
@@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public override bool EnableForceSaveOnDateModifiedChange
+ public override bool EnableRefreshOnDateModifiedChange
{
get { return true; }
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 7110b76cc..830747d3c 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -55,9 +55,12 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
- public override bool EnableForceSaveOnDateModifiedChange
+ public override bool EnableRefreshOnDateModifiedChange
{
- get { return true; }
+ get
+ {
+ return VideoType == VideoType.VideoFile || VideoType == VideoType.Iso;
+ }
}
public int? TotalBitrate { get; set; }