mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 06:18:28 +01:00
stub out objects for per library settings
This commit is contained in:
@@ -47,7 +47,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableForceSaveOnDateModifiedChange
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
@@ -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 =>
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableForceSaveOnDateModifiedChange
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableForceSaveOnDateModifiedChange
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
bool RequiresRefresh();
|
||||
|
||||
bool EnableForceSaveOnDateModifiedChange { get; }
|
||||
bool EnableRefreshOnDateModifiedChange { get; }
|
||||
|
||||
string PresentationUniqueKey { get; set; }
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableForceSaveOnDateModifiedChange
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user