mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
type discovery without attributes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.ScheduledTasks;
|
||||
@@ -66,16 +67,27 @@ namespace MediaBrowser.Controller.IO
|
||||
/// <value>The logger.</value>
|
||||
private ILogger Logger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the task manager.
|
||||
/// </summary>
|
||||
/// <value>The task manager.</value>
|
||||
private ITaskManager TaskManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoryWatchers" /> class.
|
||||
/// </summary>
|
||||
public DirectoryWatchers(ILogger logger)
|
||||
public DirectoryWatchers(ILogger logger, ITaskManager taskManager)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
if (taskManager == null)
|
||||
{
|
||||
throw new ArgumentNullException("taskManager");
|
||||
}
|
||||
|
||||
TaskManager = taskManager;
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
@@ -421,7 +433,7 @@ namespace MediaBrowser.Controller.IO
|
||||
// If the root folder changed, run the library task so the user can see it
|
||||
if (itemsToRefresh.Any(i => i is AggregateFolder))
|
||||
{
|
||||
Kernel.Instance.TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||
TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
336
MediaBrowser.Controller/IO/FileSystem.cs
Normal file
336
MediaBrowser.Controller/IO/FileSystem.cs
Normal file
@@ -0,0 +1,336 @@
|
||||
using MediaBrowser.Common.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Controller.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FileSystem
|
||||
/// </summary>
|
||||
public static class FileSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets information about a path
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.Nullable{WIN32_FIND_DATA}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
||||
/// <exception cref="System.IO.IOException">GetFileData failed for + path</exception>
|
||||
public static WIN32_FIND_DATA? GetFileData(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
WIN32_FIND_DATA data;
|
||||
var handle = NativeMethods.FindFirstFileEx(path, FINDEX_INFO_LEVELS.FindExInfoBasic, out data,
|
||||
FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, FindFirstFileExFlags.NONE);
|
||||
|
||||
var getFilename = false;
|
||||
|
||||
if (handle == NativeMethods.INVALID_HANDLE_VALUE && !Path.HasExtension(path))
|
||||
{
|
||||
if (!path.EndsWith("*", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
NativeMethods.FindClose(handle);
|
||||
|
||||
handle = NativeMethods.FindFirstFileEx(Path.Combine(path, "*"), FINDEX_INFO_LEVELS.FindExInfoBasic, out data,
|
||||
FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, FindFirstFileExFlags.NONE);
|
||||
|
||||
getFilename = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (handle == IntPtr.Zero)
|
||||
{
|
||||
throw new IOException("GetFileData failed for " + path);
|
||||
}
|
||||
|
||||
NativeMethods.FindClose(handle);
|
||||
|
||||
// According to MSDN documentation, this will default to 1601 for paths that don't exist.
|
||||
if (data.CreationTimeUtc.Year == 1601)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (getFilename)
|
||||
{
|
||||
data.cFileName = Path.GetFileName(path);
|
||||
}
|
||||
|
||||
data.Path = path;
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all files within a folder
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="searchPattern">The search pattern.</param>
|
||||
/// <returns>IEnumerable{WIN32_FIND_DATA}.</returns>
|
||||
public static IEnumerable<WIN32_FIND_DATA> GetFiles(string path, string searchPattern = "*")
|
||||
{
|
||||
return GetFileSystemEntries(path, searchPattern, includeDirectories: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all sub-directories within a folder
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>IEnumerable{WIN32_FIND_DATA}.</returns>
|
||||
public static IEnumerable<WIN32_FIND_DATA> GetDirectories(string path)
|
||||
{
|
||||
return GetFileSystemEntries(path, includeFiles: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all file system entries within a foler
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="searchPattern">The search pattern.</param>
|
||||
/// <param name="includeFiles">if set to <c>true</c> [include files].</param>
|
||||
/// <param name="includeDirectories">if set to <c>true</c> [include directories].</param>
|
||||
/// <returns>IEnumerable{WIN32_FIND_DATA}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
||||
/// <exception cref="System.IO.IOException">GetFileSystemEntries failed</exception>
|
||||
public static IEnumerable<WIN32_FIND_DATA> GetFileSystemEntries(string path, string searchPattern = "*", bool includeFiles = true, bool includeDirectories = true)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
var lpFileName = Path.Combine(path, searchPattern);
|
||||
|
||||
WIN32_FIND_DATA lpFindFileData;
|
||||
var handle = NativeMethods.FindFirstFileEx(lpFileName, FINDEX_INFO_LEVELS.FindExInfoBasic, out lpFindFileData,
|
||||
FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, FindFirstFileExFlags.FIND_FIRST_EX_LARGE_FETCH);
|
||||
|
||||
if (handle == IntPtr.Zero)
|
||||
{
|
||||
var hr = Marshal.GetLastWin32Error();
|
||||
if (hr != 2 && hr != 0x12)
|
||||
{
|
||||
throw new IOException("GetFileSystemEntries failed");
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (IncludeInFindFileOutput(lpFindFileData.cFileName, lpFindFileData.dwFileAttributes, includeFiles, includeDirectories))
|
||||
{
|
||||
lpFindFileData.Path = Path.Combine(path, lpFindFileData.cFileName);
|
||||
|
||||
yield return lpFindFileData;
|
||||
}
|
||||
|
||||
while (NativeMethods.FindNextFile(handle, out lpFindFileData) != IntPtr.Zero)
|
||||
{
|
||||
if (IncludeInFindFileOutput(lpFindFileData.cFileName, lpFindFileData.dwFileAttributes, includeFiles, includeDirectories))
|
||||
{
|
||||
lpFindFileData.Path = Path.Combine(path, lpFindFileData.cFileName);
|
||||
yield return lpFindFileData;
|
||||
}
|
||||
}
|
||||
|
||||
NativeMethods.FindClose(handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Includes the in find file output.
|
||||
/// </summary>
|
||||
/// <param name="cFileName">Name of the c file.</param>
|
||||
/// <param name="attributes">The attributes.</param>
|
||||
/// <param name="includeFiles">if set to <c>true</c> [include files].</param>
|
||||
/// <param name="includeDirectories">if set to <c>true</c> [include directories].</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
public static bool IncludeInFindFileOutput(string cFileName, FileAttributes attributes, bool includeFiles, bool includeDirectories)
|
||||
{
|
||||
if (cFileName.Equals(".", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (cFileName.Equals("..", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!includeFiles && !attributes.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!includeDirectories && attributes.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The space char
|
||||
/// </summary>
|
||||
private const char SpaceChar = ' ';
|
||||
/// <summary>
|
||||
/// The invalid file name chars
|
||||
/// </summary>
|
||||
private static readonly char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();
|
||||
|
||||
/// <summary>
|
||||
/// Takes a filename and removes invalid characters
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
||||
public static string GetValidFilename(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
throw new ArgumentNullException("filename");
|
||||
}
|
||||
|
||||
foreach (var c in InvalidFileNameChars)
|
||||
{
|
||||
filename = filename.Replace(c, SpaceChar);
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the shortcut.
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
||||
public static string ResolveShortcut(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
throw new ArgumentNullException("filename");
|
||||
}
|
||||
|
||||
var link = new ShellLink();
|
||||
((IPersistFile)link).Load(filename, NativeMethods.STGM_READ);
|
||||
// TODO: if I can get hold of the hwnd call resolve first. This handles moved and renamed files.
|
||||
// ((IShellLinkW)link).Resolve(hwnd, 0)
|
||||
var sb = new StringBuilder(NativeMethods.MAX_PATH);
|
||||
WIN32_FIND_DATA data;
|
||||
((IShellLinkW)link).GetPath(sb, sb.Capacity, out data, 0);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a shortcut file pointing to a specified path
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath">The shortcut path.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
/// <exception cref="System.ArgumentNullException">shortcutPath</exception>
|
||||
public static void CreateShortcut(string shortcutPath, string target)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shortcutPath))
|
||||
{
|
||||
throw new ArgumentNullException("shortcutPath");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(target))
|
||||
{
|
||||
throw new ArgumentNullException("target");
|
||||
}
|
||||
|
||||
var link = new ShellLink();
|
||||
|
||||
((IShellLinkW)link).SetPath(target);
|
||||
|
||||
((IPersistFile)link).Save(shortcutPath, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified filename is shortcut.
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
||||
public static bool IsShortcut(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
throw new ArgumentNullException("filename");
|
||||
}
|
||||
|
||||
return string.Equals(Path.GetExtension(filename), ".lnk", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies all.
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
/// <exception cref="System.ArgumentNullException">source</exception>
|
||||
/// <exception cref="System.ArgumentException">The source and target directories are the same</exception>
|
||||
public static void CopyAll(string source, string target)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (string.IsNullOrEmpty(target))
|
||||
{
|
||||
throw new ArgumentNullException("target");
|
||||
}
|
||||
|
||||
if (source.Equals(target, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
throw new ArgumentException("The source and target directories are the same");
|
||||
}
|
||||
|
||||
// Check if the target directory exists, if not, create it.
|
||||
if (!Directory.Exists(target))
|
||||
{
|
||||
Directory.CreateDirectory(target);
|
||||
}
|
||||
|
||||
foreach (var file in Directory.EnumerateFiles(source))
|
||||
{
|
||||
File.Copy(file, Path.Combine(target, Path.GetFileName(file)), true);
|
||||
}
|
||||
|
||||
// Copy each subdirectory using recursion.
|
||||
foreach (var dir in Directory.EnumerateDirectories(source))
|
||||
{
|
||||
CopyAll(dir, Path.Combine(target, Path.GetFileName(dir)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the ini file.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>NameValueCollection.</returns>
|
||||
public static NameValueCollection ParseIniFile(string path)
|
||||
{
|
||||
var values = new NameValueCollection();
|
||||
|
||||
foreach (var line in File.ReadAllLines(path))
|
||||
{
|
||||
var data = line.Split('=');
|
||||
|
||||
if (data.Length < 2) continue;
|
||||
|
||||
var key = data[0];
|
||||
|
||||
var value = data.Length == 2 ? data[1] : string.Join(string.Empty, data, 1, data.Length - 1);
|
||||
|
||||
values[key] = value;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
@@ -26,17 +27,18 @@ namespace MediaBrowser.Controller.IO
|
||||
/// The _logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileSystemManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public FileSystemManager(Kernel kernel, ILogger logger)
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
public FileSystemManager(Kernel kernel, ILogger logger, ITaskManager taskManager)
|
||||
: base(kernel)
|
||||
{
|
||||
_logger = logger;
|
||||
DirectoryWatchers = new DirectoryWatchers(logger);
|
||||
DirectoryWatchers = new DirectoryWatchers(logger, taskManager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@@ -17,14 +15,10 @@ using MediaBrowser.Controller.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Updates;
|
||||
using MediaBrowser.Controller.Weather;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -183,7 +177,6 @@ namespace MediaBrowser.Controller
|
||||
/// Gets the list of Localized string files
|
||||
/// </summary>
|
||||
/// <value>The string files.</value>
|
||||
[ImportMany(typeof(LocalizedStringData))]
|
||||
public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -208,7 +201,6 @@ namespace MediaBrowser.Controller
|
||||
/// Gets the list of currently registered metadata prvoiders
|
||||
/// </summary>
|
||||
/// <value>The metadata providers enumerable.</value>
|
||||
[ImportMany(typeof(BaseMetadataProvider))]
|
||||
public BaseMetadataProvider[] MetadataProviders { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -222,8 +214,7 @@ namespace MediaBrowser.Controller
|
||||
/// Gets the list of currently registered entity resolvers
|
||||
/// </summary>
|
||||
/// <value>The entity resolvers enumerable.</value>
|
||||
[ImportMany(typeof(IBaseItemResolver))]
|
||||
internal IBaseItemResolver[] EntityResolvers { get; private set; }
|
||||
internal IEnumerable<IBaseItemResolver> EntityResolvers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of BasePluginFolders added by plugins
|
||||
@@ -322,14 +313,11 @@ namespace MediaBrowser.Controller
|
||||
/// <summary>
|
||||
/// Composes the exported values.
|
||||
/// </summary>
|
||||
/// <param name="container">The container.</param>
|
||||
protected override void RegisterExportedValues(CompositionContainer container)
|
||||
protected override void RegisterExportedValues()
|
||||
{
|
||||
container.ComposeExportedValue("kernel", this);
|
||||
|
||||
ApplicationHost.Register(this);
|
||||
|
||||
base.RegisterExportedValues(container);
|
||||
base.RegisterExportedValues();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -338,6 +326,15 @@ namespace MediaBrowser.Controller
|
||||
/// <param name="allTypes">All types.</param>
|
||||
protected override void FindParts(Type[] allTypes)
|
||||
{
|
||||
InstallationManager = (InstallationManager)ApplicationHost.CreateInstance(typeof(InstallationManager));
|
||||
FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager));
|
||||
LibraryManager = (LibraryManager)ApplicationHost.CreateInstance(typeof(LibraryManager));
|
||||
UserManager = (UserManager)ApplicationHost.CreateInstance(typeof(UserManager));
|
||||
ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager));
|
||||
ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager));
|
||||
UserDataManager = (UserDataManager)ApplicationHost.CreateInstance(typeof(UserDataManager));
|
||||
PluginSecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager));
|
||||
|
||||
base.FindParts(allTypes);
|
||||
|
||||
EntityResolutionIgnoreRules = GetExports<IResolutionIgnoreRule>(allTypes);
|
||||
@@ -348,8 +345,11 @@ namespace MediaBrowser.Controller
|
||||
WeatherProviders = GetExports<IWeatherProvider>(allTypes);
|
||||
IntroProviders = GetExports<IIntroProvider>(allTypes);
|
||||
PluginConfigurationPages = GetExports<IPluginConfigurationPage>(allTypes);
|
||||
ImageEnhancers = GetExports<IImageEnhancer>(allTypes);
|
||||
ImageEnhancers = GetExports<IImageEnhancer>(allTypes).OrderBy(e => e.Priority).ToArray();
|
||||
PluginFolderCreators = GetExports<IVirtualFolderCreator>(allTypes);
|
||||
StringFiles = GetExports<LocalizedStringData>(allTypes);
|
||||
EntityResolvers = GetExports<IBaseItemResolver>(allTypes).OrderBy(e => e.Priority).ToArray();
|
||||
MetadataProviders = GetExports<BaseMetadataProvider>(allTypes).OrderBy(e => e.Priority).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -365,14 +365,6 @@ namespace MediaBrowser.Controller
|
||||
await base.ReloadInternal().ConfigureAwait(false);
|
||||
|
||||
ReloadResourcePools();
|
||||
InstallationManager = (InstallationManager)ApplicationHost.CreateInstance(typeof(InstallationManager));
|
||||
FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager));
|
||||
LibraryManager = (LibraryManager)ApplicationHost.CreateInstance(typeof(LibraryManager));
|
||||
UserManager = (UserManager)ApplicationHost.CreateInstance(typeof(UserManager));
|
||||
ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager));
|
||||
ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager));
|
||||
UserDataManager = (UserDataManager)ApplicationHost.CreateInstance(typeof(UserDataManager));
|
||||
PluginSecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager));
|
||||
|
||||
ReloadFileSystemManager();
|
||||
|
||||
@@ -441,15 +433,6 @@ namespace MediaBrowser.Controller
|
||||
DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository);
|
||||
var displayPreferencesRepoTask = DisplayPreferencesRepository.Initialize();
|
||||
|
||||
// Sort the resolvers by priority
|
||||
EntityResolvers = EntityResolvers.OrderBy(e => e.Priority).ToArray();
|
||||
|
||||
// Sort the providers by priority
|
||||
MetadataProviders = MetadataProviders.OrderBy(e => e.Priority).ToArray();
|
||||
|
||||
// Sort the image processors by priority
|
||||
ImageEnhancers = ImageEnhancers.OrderBy(e => e.Priority).ToArray();
|
||||
|
||||
await Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -488,7 +471,7 @@ namespace MediaBrowser.Controller
|
||||
{
|
||||
DisposeFileSystemManager();
|
||||
|
||||
FileSystemManager = new FileSystemManager(this, Logger);
|
||||
FileSystemManager = new FileSystemManager(this, Logger, TaskManager);
|
||||
FileSystemManager.StartWatchers();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using MediaBrowser.Common.Localization;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
|
||||
namespace MediaBrowser.Controller.Localization
|
||||
{
|
||||
[Export(typeof(LocalizedStringData))]
|
||||
public class BaseStrings : LocalizedStringData
|
||||
{
|
||||
public BaseStrings()
|
||||
|
||||
51
MediaBrowser.Controller/Localization/LocalizedStringData.cs
Normal file
51
MediaBrowser.Controller/Localization/LocalizedStringData.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MediaBrowser.Controller.Localization
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LocalizedStringData
|
||||
/// </summary>
|
||||
public class LocalizedStringData
|
||||
{
|
||||
/// <summary>
|
||||
/// The this version
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public string ThisVersion = "1.0000";
|
||||
/// <summary>
|
||||
/// The prefix
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public string Prefix = "";
|
||||
/// <summary>
|
||||
/// The file name
|
||||
/// </summary>
|
||||
public string FileName; //this is public so it will serialize and we know where to save ourselves
|
||||
/// <summary>
|
||||
/// The version
|
||||
/// </summary>
|
||||
public string Version = ""; //this will get saved so we can check it against us for changes
|
||||
|
||||
/// <summary>
|
||||
/// Saves this instance.
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
Save(FileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the specified file.
|
||||
/// </summary>
|
||||
/// <param name="file">The file.</param>
|
||||
public void Save(string file)
|
||||
{
|
||||
var xs = new XmlSerializer(GetType());
|
||||
using (var fs = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
xs.Serialize(fs, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
<HintPath>..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
@@ -108,6 +107,7 @@
|
||||
<Compile Include="Entities\CollectionFolder.cs" />
|
||||
<Compile Include="Entities\Year.cs" />
|
||||
<Compile Include="Extensions\XmlExtensions.cs" />
|
||||
<Compile Include="IO\FileSystem.cs" />
|
||||
<Compile Include="IO\FileSystemManager.cs" />
|
||||
<Compile Include="IO\NetworkShares.cs" />
|
||||
<Compile Include="Library\ChildrenChangedEventArgs.cs" />
|
||||
@@ -118,6 +118,7 @@
|
||||
<Compile Include="Localization\AURatingsDictionary.cs" />
|
||||
<Compile Include="Localization\BaseStrings.cs" />
|
||||
<Compile Include="Localization\GBRatingsDictionary.cs" />
|
||||
<Compile Include="Localization\LocalizedStringData.cs" />
|
||||
<Compile Include="Localization\LocalizedStrings.cs" />
|
||||
<Compile Include="Localization\NLRatingsDictionary.cs" />
|
||||
<Compile Include="Localization\Ratings.cs" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <summary>
|
||||
/// Provides metadata for Folders and all subclasses by parsing folder.xml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FolderProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -14,7 +13,6 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <summary>
|
||||
/// Provides images for all types by looking for standard images - folder, backdrop, logo, etc.
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class ImageFromMediaLocationProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <summary>
|
||||
/// Provides images for generic types by looking for standard images in the IBN
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class ImagesByNameProvider : ImageFromMediaLocationProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
/// <summary>
|
||||
/// Uses ffmpeg to create video images
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFMpegAudioImageProvider : BaseFFMpegImageProvider<Audio>
|
||||
{
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
/// <summary>
|
||||
/// Uses ffmpeg to create video images
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFMpegVideoImageProvider : BaseFFMpegImageProvider<Video>
|
||||
{
|
||||
/// <summary>
|
||||
@@ -23,8 +21,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
/// Initializes a new instance of the <see cref="FFMpegVideoImageProvider" /> class.
|
||||
/// </summary>
|
||||
/// <param name="isoManager">The iso manager.</param>
|
||||
[ImportingConstructor]
|
||||
public FFMpegVideoImageProvider([Import("isoManager")] IIsoManager isoManager)
|
||||
public FFMpegVideoImageProvider(IIsoManager isoManager)
|
||||
{
|
||||
_isoManager = isoManager;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using MediaBrowser.Controller.MediaInfo;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
/// <summary>
|
||||
/// Extracts audio information using ffprobe
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFProbeAudioInfoProvider : BaseFFProbeProvider<Audio>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,6 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
/// <summary>
|
||||
/// Extracts video information using ffprobe
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFProbeVideoInfoProvider : BaseFFProbeProvider<Video>
|
||||
{
|
||||
/// <summary>
|
||||
@@ -43,8 +41,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
/// <param name="isoManager">The iso manager.</param>
|
||||
/// <param name="blurayExaminer">The bluray examiner.</param>
|
||||
/// <exception cref="System.ArgumentNullException">blurayExaminer</exception>
|
||||
[ImportingConstructor]
|
||||
public FFProbeVideoInfoProvider([Import("isoManager")] IIsoManager isoManager, [Import("blurayExaminer")] IBlurayExaminer blurayExaminer)
|
||||
public FFProbeVideoInfoProvider(IIsoManager isoManager, IBlurayExaminer blurayExaminer)
|
||||
: base()
|
||||
{
|
||||
if (blurayExaminer == null)
|
||||
|
||||
@@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
/// <summary>
|
||||
/// Class FanArtMovieProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class FanArtMovieProvider : FanartBaseProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,6 @@ using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -29,7 +28,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
/// <summary>
|
||||
/// Class MovieDbProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class MovieDbProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
/// <summary>
|
||||
/// Class MovieProviderFromJson
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class MovieProviderFromJson : MovieDbProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
/// <summary>
|
||||
/// Class MovieProviderFromXml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class MovieProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
/// <summary>
|
||||
/// Class PersonProviderFromJson
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class PersonProviderFromJson : TmdbPersonProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -4,7 +4,6 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
/// <summary>
|
||||
/// Class TmdbPersonProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class TmdbPersonProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <summary>
|
||||
/// Class SortNameProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class SortNameProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
/// <summary>
|
||||
/// Class EpisodeImageFromMediaLocationProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class EpisodeImageFromMediaLocationProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
/// <summary>
|
||||
/// Class EpisodeProviderFromXml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class EpisodeProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,7 +11,6 @@ using System.Xml;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers.TV
|
||||
{
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class FanArtTVProvider : FanartBaseProvider
|
||||
{
|
||||
protected string FanArtBaseUrl = "http://api.fanart.tv/webservice/series/{0}/{1}/xml/all/1/1";
|
||||
|
||||
@@ -5,7 +5,6 @@ using MediaBrowser.Controller.Resolvers.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -18,7 +17,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
/// <summary>
|
||||
/// Class RemoteEpisodeProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class RemoteEpisodeProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -16,7 +15,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
/// <summary>
|
||||
/// Class RemoteSeasonProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class RemoteSeasonProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
@@ -20,7 +19,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
/// <summary>
|
||||
/// Class RemoteSeriesProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class RemoteSeriesProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
/// <summary>
|
||||
/// Class SeriesProviderFromXml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class SeriesProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Audio
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class AudioResolver
|
||||
/// </summary>
|
||||
public class AudioResolver : BaseItemResolver<Entities.Audio.Audio>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Last; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Entities.Audio.Audio.</returns>
|
||||
protected override Entities.Audio.Audio Resolve(ItemResolveArgs args)
|
||||
{
|
||||
// Return audio if the path is a file and has a matching extension
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Audio
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class MusicAlbumResolver
|
||||
/// </summary>
|
||||
public class MusicAlbumResolver : BaseItemResolver<MusicAlbum>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>MusicAlbum.</returns>
|
||||
protected override MusicAlbum Resolve(ItemResolveArgs args)
|
||||
{
|
||||
if (!args.IsDirectory) return null;
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Audio
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class MusicArtistResolver
|
||||
/// </summary>
|
||||
public class MusicArtistResolver : BaseItemResolver<MusicArtist>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>MusicArtist.</returns>
|
||||
protected override MusicArtist Resolve(ItemResolveArgs args)
|
||||
{
|
||||
if (!args.IsDirectory) return null;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
@@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
/// <summary>
|
||||
/// Provides the core resolver ignore rules
|
||||
/// </summary>
|
||||
[Export(typeof(IResolutionIgnoreRule))]
|
||||
public class CoreResolutionIgnoreRule : IResolutionIgnoreRule
|
||||
{
|
||||
/// <summary>
|
||||
@@ -27,6 +25,11 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
"extrafanart"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Shoulds the ignore.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
public bool ShouldIgnore(ItemResolveArgs args)
|
||||
{
|
||||
// Ignore hidden files and folders
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FolderResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class FolderResolver : BaseFolderResolver<Folder>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
@@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
/// <summary>
|
||||
/// Class LocalTrailerResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class LocalTrailerResolver : BaseVideoResolver<Trailer>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
@@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
/// <summary>
|
||||
/// Class BoxSetResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class BoxSetResolver : BaseFolderResolver<BoxSet>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,6 @@ using MediaBrowser.Controller.Providers.Movies;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
@@ -14,7 +13,6 @@ namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
/// <summary>
|
||||
/// Class MovieResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class MovieResolver : BaseVideoResolver<Movie>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class EpisodeResolver
|
||||
/// </summary>
|
||||
public class EpisodeResolver : BaseVideoResolver<Episode>
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Episode.</returns>
|
||||
protected override Episode Resolve(ItemResolveArgs args)
|
||||
{
|
||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
||||
@@ -40,6 +46,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the initial item values.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
protected override void SetInitialItemValues(Episode item, ItemResolveArgs args)
|
||||
{
|
||||
base.SetInitialItemValues(item, args);
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class SeasonResolver
|
||||
/// </summary>
|
||||
public class SeasonResolver : BaseFolderResolver<Season>
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Season.</returns>
|
||||
protected override Season Resolve(ItemResolveArgs args)
|
||||
{
|
||||
if (args.Parent is Series && args.IsDirectory)
|
||||
@@ -21,6 +27,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the initial item values.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
protected override void SetInitialItemValues(Season item, ItemResolveArgs args)
|
||||
{
|
||||
base.SetInitialItemValues(item, args);
|
||||
|
||||
@@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
@@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||
/// <summary>
|
||||
/// Class SeriesResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class SeriesResolver : BaseFolderResolver<Series>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
@@ -10,7 +9,6 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
/// <summary>
|
||||
/// Resolves a Path into a Video
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class VideoResolver : BaseVideoResolver<Video>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.ScheduledTasks
|
||||
{
|
||||
[Export(typeof(IScheduledTask))]
|
||||
/// <summary>
|
||||
/// Class ChapterImagesTask
|
||||
/// </summary>
|
||||
class ChapterImagesTask : BaseScheduledTask<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChapterImagesTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger"></param>
|
||||
public ChapterImagesTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
|
||||
: base(kernel, taskManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -16,9 +14,18 @@ namespace MediaBrowser.Controller.ScheduledTasks
|
||||
/// <summary>
|
||||
/// Class ImageCleanupTask
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
public class ImageCleanupTask : BaseScheduledTask<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ImageCleanupTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger"></param>
|
||||
public ImageCleanupTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
|
||||
: base(kernel, taskManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -10,9 +10,18 @@ namespace MediaBrowser.Controller.ScheduledTasks
|
||||
/// <summary>
|
||||
/// Class PeopleValidationTask
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
public class PeopleValidationTask : BaseScheduledTask<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger"></param>
|
||||
public PeopleValidationTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
|
||||
: base(kernel, taskManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -14,9 +13,18 @@ namespace MediaBrowser.Controller.ScheduledTasks
|
||||
/// <summary>
|
||||
/// Plugin Update Task
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
public class PluginUpdateTask : BaseScheduledTask<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginUpdateTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger"></param>
|
||||
public PluginUpdateTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
|
||||
: base(kernel, taskManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -11,9 +11,18 @@ namespace MediaBrowser.Controller.ScheduledTasks
|
||||
/// <summary>
|
||||
/// Class RefreshMediaLibraryTask
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
public class RefreshMediaLibraryTask : BaseScheduledTask<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RefreshMediaLibraryTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger"></param>
|
||||
public RefreshMediaLibraryTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
|
||||
: base(kernel, taskManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default triggers.
|
||||
/// </summary>
|
||||
@@ -22,7 +31,7 @@ namespace MediaBrowser.Controller.ScheduledTasks
|
||||
{
|
||||
return new BaseTaskTrigger[] {
|
||||
|
||||
new StartupTrigger(Kernel),
|
||||
new StartupTrigger(),
|
||||
|
||||
new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user