mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts: MediaBrowser.ServerApplication/CorePlugins/MediaBrowser.Api.dll MediaBrowser.ServerApplication/CorePlugins/MediaBrowser.ApiInteraction.Javascript.dll MediaBrowser.ServerApplication/CorePlugins/MediaBrowser.Server.Sqlite.dll MediaBrowser.ServerApplication/CorePlugins/MediaBrowser.Server.WorldWeatherOnline.dll MediaBrowser.ServerApplication/CorePlugins/MediaBrowser.WebDashboard.dll
This commit is contained in:
commit
33ed929b52
159 changed files with 3573 additions and 3367 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -32,6 +32,7 @@ local.properties
|
||||||
## Media Browser
|
## Media Browser
|
||||||
#################
|
#################
|
||||||
ProgramData*/
|
ProgramData*/
|
||||||
|
CorePlugins*/
|
||||||
ProgramData-Server*/
|
ProgramData-Server*/
|
||||||
ProgramData-UI*/
|
ProgramData-UI*/
|
||||||
|
|
||||||
|
@ -145,6 +146,7 @@ publish/
|
||||||
# NuGet Packages Directory
|
# NuGet Packages Directory
|
||||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||||
packages/
|
packages/
|
||||||
|
dlls/
|
||||||
|
|
||||||
# Windows Azure Build Output
|
# Windows Azure Build Output
|
||||||
csx
|
csx
|
||||||
|
|
12
MediaBrowser.Api/Api.cs
Normal file
12
MediaBrowser.Api/Api.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Api
|
||||||
|
{
|
||||||
|
class Api
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,9 @@
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -59,7 +57,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class EnvironmentService
|
/// Class EnvironmentService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class EnvironmentService : BaseRestService
|
public class EnvironmentService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Connectivity;
|
using MediaBrowser.Model.Connectivity;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
@ -13,7 +12,6 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a handler to set played status for an item
|
/// Provides a handler to set played status for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
public class PlaybackCheckInHandler : BaseSerializationHandler<Kernel, UserItemDataDto>
|
public class PlaybackCheckInHandler : BaseSerializationHandler<Kernel, UserItemDataDto>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes changes to the user's media library
|
/// Makes changes to the user's media library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
public class UpdateMediaLibraryHandler : BaseActionHandler<Kernel>
|
public class UpdateMediaLibraryHandler : BaseActionHandler<Kernel>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -114,7 +113,6 @@ namespace MediaBrowser.Api.Images
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ImageService
|
/// Class ImageService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class ImageService : BaseRestService
|
public class ImageService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Api.Images
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class UploadImageHandler
|
/// Class UploadImageHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
class UploadImageHandler : BaseActionHandler<Kernel>
|
class UploadImageHandler : BaseActionHandler<Kernel>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using MediaBrowser.Common.Mef;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -8,7 +7,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
|
@ -97,7 +95,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class LibraryService
|
/// Class LibraryService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class LibraryService : BaseRestService
|
public class LibraryService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -213,7 +210,7 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
var kernel = (Kernel)Kernel;
|
var kernel = (Kernel)Kernel;
|
||||||
|
|
||||||
var allTypes = kernel.Assemblies.SelectMany(MefUtils.GetTypes).Where(t => !t.IsAbstract && t.IsSubclassOf(typeof(BaseItem)));
|
var allTypes = kernel.AllTypes.Where(t => !t.IsAbstract && t.IsSubclassOf(typeof(BaseItem)));
|
||||||
|
|
||||||
if (request.HasInternetProvider)
|
if (request.HasInternetProvider)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Model.Globalization;
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -38,7 +37,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class CulturesService
|
/// Class CulturesService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class LocalizationService : BaseRestService
|
public class LocalizationService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Updates;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -93,7 +92,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class PackageService
|
/// Class PackageService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class PackageService : BaseRestService
|
public class PackageService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Model.Plugins;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Plugin
|
/// Class Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IPlugin))]
|
|
||||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -7,10 +7,8 @@ using MediaBrowser.Model.Plugins;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ServiceStack.Text.Controller;
|
using ServiceStack.Text.Controller;
|
||||||
|
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
|
@ -119,7 +117,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class PluginsService
|
/// Class PluginsService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class PluginService : BaseRestService
|
public class PluginService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Tasks;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ServiceStack.Text.Controller;
|
using ServiceStack.Text.Controller;
|
||||||
|
@ -83,9 +82,19 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ScheduledTasksService
|
/// Class ScheduledTasksService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class ScheduledTaskService : BaseRestService
|
public class ScheduledTaskService : BaseRestService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the task manager.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The task manager.</value>
|
||||||
|
private ITaskManager TaskManager { get; set; }
|
||||||
|
|
||||||
|
public ScheduledTaskService(ITaskManager taskManager)
|
||||||
|
{
|
||||||
|
TaskManager = taskManager;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the specified request.
|
/// Gets the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -93,7 +102,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <returns>IEnumerable{TaskInfo}.</returns>
|
/// <returns>IEnumerable{TaskInfo}.</returns>
|
||||||
public object Get(GetScheduledTasks request)
|
public object Get(GetScheduledTasks request)
|
||||||
{
|
{
|
||||||
var result = Kernel.ScheduledTasks.OrderBy(i => i.Name)
|
var result = TaskManager.ScheduledTasks.OrderBy(i => i.Name)
|
||||||
.Select(ScheduledTaskHelpers.GetTaskInfo).ToList();
|
.Select(ScheduledTaskHelpers.GetTaskInfo).ToList();
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
|
@ -106,7 +115,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <returns>IEnumerable{TaskInfo}.</returns>
|
/// <returns>IEnumerable{TaskInfo}.</returns>
|
||||||
public object Get(GetScheduledTask request)
|
public object Get(GetScheduledTask request)
|
||||||
{
|
{
|
||||||
var task = Kernel.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);
|
||||||
|
|
||||||
if (task == null)
|
if (task == null)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +133,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Post(StartScheduledTask request)
|
public void Post(StartScheduledTask request)
|
||||||
{
|
{
|
||||||
var task = Kernel.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);
|
||||||
|
|
||||||
if (task == null)
|
if (task == null)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +149,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Delete(StopScheduledTask request)
|
public void Delete(StopScheduledTask request)
|
||||||
{
|
{
|
||||||
var task = Kernel.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == request.Id);
|
||||||
|
|
||||||
if (task == null)
|
if (task == null)
|
||||||
{
|
{
|
||||||
|
@ -160,8 +169,8 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
||||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||||
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
||||||
|
|
||||||
var task = Kernel.ScheduledTasks.FirstOrDefault(i => i.Id == id);
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == id);
|
||||||
|
|
||||||
if (task == null)
|
if (task == null)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +179,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
|
|
||||||
var triggerInfos = JsonSerializer.DeserializeFromStream<TaskTriggerInfo[]>(request.RequestStream);
|
var triggerInfos = JsonSerializer.DeserializeFromStream<TaskTriggerInfo[]>(request.RequestStream);
|
||||||
|
|
||||||
task.Triggers = triggerInfos.Select(t => ScheduledTaskHelpers.GetTrigger(t, Kernel));
|
task.Triggers = triggerInfos.Select(ScheduledTaskHelpers.GetTrigger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Common.ScheduledTasks;
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -13,9 +11,14 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ScheduledTasksWebSocketListener
|
/// Class ScheduledTasksWebSocketListener
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IWebSocketListener))]
|
|
||||||
public class ScheduledTasksWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<TaskInfo>, object>
|
public class ScheduledTasksWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<TaskInfo>, object>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the task manager.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The task manager.</value>
|
||||||
|
private ITaskManager TaskManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -33,13 +36,12 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ScheduledTasksWebSocketListener" /> class.
|
/// Initializes a new instance of the <see cref="ScheduledTasksWebSocketListener" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
[ImportingConstructor]
|
/// <param name="taskManager">The task manager.</param>
|
||||||
public ScheduledTasksWebSocketListener([Import("kernel")] Kernel kernel, [Import("logger")] ILogger logger)
|
public ScheduledTasksWebSocketListener(ILogger logger, ITaskManager taskManager)
|
||||||
: base(logger)
|
: base(logger)
|
||||||
{
|
{
|
||||||
_kernel = kernel;
|
TaskManager = taskManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -49,7 +51,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// <returns>Task{IEnumerable{TaskInfo}}.</returns>
|
/// <returns>Task{IEnumerable{TaskInfo}}.</returns>
|
||||||
protected override Task<IEnumerable<TaskInfo>> GetDataToSend(object state)
|
protected override Task<IEnumerable<TaskInfo>> GetDataToSend(object state)
|
||||||
{
|
{
|
||||||
return Task.FromResult(_kernel.ScheduledTasks.OrderBy(i => i.Name)
|
return Task.FromResult(TaskManager.ScheduledTasks.OrderBy(i => i.Name)
|
||||||
.Select(ScheduledTaskHelpers.GetTaskInfo));
|
.Select(ScheduledTaskHelpers.GetTaskInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Api.Streaming
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Providers a progressive streaming audio api
|
/// Providers a progressive streaming audio api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
public class AudioHandler : BaseProgressiveStreamingHandler<Audio>
|
public class AudioHandler : BaseProgressiveStreamingHandler<Audio>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -859,11 +859,11 @@ namespace MediaBrowser.Api.Streaming
|
||||||
{
|
{
|
||||||
var video = LibraryItem as Video;
|
var video = LibraryItem as Video;
|
||||||
|
|
||||||
if (video != null && video.VideoType == VideoType.Iso &&
|
//if (video != null && video.VideoType == VideoType.Iso &&
|
||||||
video.IsoType.HasValue && Kernel.IsoManager.CanMount(video.Path))
|
// video.IsoType.HasValue && Kernel.IsoManager.CanMount(video.Path))
|
||||||
{
|
//{
|
||||||
IsoMount = await Kernel.IsoManager.Mount(video.Path, CancellationToken.None).ConfigureAwait(false);
|
// IsoMount = await Kernel.IsoManager.Mount(video.Path, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
//}
|
||||||
|
|
||||||
var process = new Process
|
var process = new Process
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Streaming
|
namespace MediaBrowser.Api.Streaming
|
||||||
|
@ -10,7 +9,6 @@ namespace MediaBrowser.Api.Streaming
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class HlsAudioPlaylistHandler
|
/// Class HlsAudioPlaylistHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
public class HlsAudioPlaylistHandler : BaseHlsPlaylistHandler<Audio>
|
public class HlsAudioPlaylistHandler : BaseHlsPlaylistHandler<Audio>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Api.Streaming
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class HlsSegmentHandler
|
/// Class HlsSegmentHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
public class HlsSegmentHandler : BaseHandler<Kernel>
|
public class HlsSegmentHandler : BaseHandler<Kernel>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Streaming
|
namespace MediaBrowser.Api.Streaming
|
||||||
|
@ -9,7 +8,6 @@ namespace MediaBrowser.Api.Streaming
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class HlsVideoPlaylistHandler
|
/// Class HlsVideoPlaylistHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
public class HlsVideoPlaylistHandler : BaseHlsPlaylistHandler<Video>
|
public class HlsVideoPlaylistHandler : BaseHlsPlaylistHandler<Video>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
using System.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using System.Threading;
|
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Streaming
|
namespace MediaBrowser.Api.Streaming
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Providers a progressive streaming video api
|
/// Providers a progressive streaming video api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHttpServerHandler))]
|
|
||||||
class VideoHandler : BaseProgressiveStreamingHandler<Video>
|
class VideoHandler : BaseProgressiveStreamingHandler<Video>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -47,7 +46,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class SystemInfoService
|
/// Class SystemInfoService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class SystemService : BaseRestService
|
public class SystemService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -22,7 +21,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class GenresService
|
/// Class GenresService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class GenresService : BaseItemsByNameService<Genre>
|
public class GenresService : BaseItemsByNameService<Genre>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -8,7 +8,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -144,7 +143,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ItemsService
|
/// Class ItemsService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class ItemsService : BaseRestService
|
public class ItemsService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class PersonsService
|
/// Class PersonsService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class PersonsService : BaseItemsByNameService<Person>
|
public class PersonsService : BaseItemsByNameService<Person>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -22,7 +20,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class StudiosService
|
/// Class StudiosService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class StudiosService : BaseItemsByNameService<Studio>
|
public class StudiosService : BaseItemsByNameService<Studio>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -9,7 +9,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -252,7 +251,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class UserLibraryService
|
/// Class UserLibraryService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class UserLibraryService : BaseRestService
|
public class UserLibraryService : BaseRestService
|
||||||
{
|
{
|
||||||
public object Get(GetSpecialFeatures request)
|
public object Get(GetSpecialFeatures request)
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -23,7 +22,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class YearsService
|
/// Class YearsService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class YearsService : BaseItemsByNameService<Year>
|
public class YearsService : BaseItemsByNameService<Year>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Dto;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -134,7 +133,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class UsersService
|
/// Class UsersService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class UserService : BaseRestService
|
public class UserService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.Weather;
|
using MediaBrowser.Model.Weather;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -24,7 +23,6 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class WeatherService
|
/// Class WeatherService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class WeatherService : BaseRestService
|
public class WeatherService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Api.WebSocket
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ScheduledTasksWebSocketListener
|
/// Class ScheduledTasksWebSocketListener
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IWebSocketListener))]
|
|
||||||
public class LogFileWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<string>, LogFileWebSocketState>
|
public class LogFileWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<string>, LogFileWebSocketState>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -36,8 +34,7 @@ namespace MediaBrowser.Api.WebSocket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
[ImportingConstructor]
|
public LogFileWebSocketListener(ILogger logger, Kernel kernel)
|
||||||
public LogFileWebSocketListener([Import("logger")] ILogger logger, [Import("kernel")] Kernel kernel)
|
|
||||||
: base(logger)
|
: base(logger)
|
||||||
{
|
{
|
||||||
_kernel = kernel;
|
_kernel = kernel;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.WebSocket
|
namespace MediaBrowser.Api.WebSocket
|
||||||
|
@ -10,7 +9,6 @@ namespace MediaBrowser.Api.WebSocket
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class SystemInfoWebSocketListener
|
/// Class SystemInfoWebSocketListener
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IWebSocketListener))]
|
|
||||||
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<SystemInfo, object>
|
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<SystemInfo, object>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -32,8 +30,7 @@ namespace MediaBrowser.Api.WebSocket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
[ImportingConstructor]
|
public SystemInfoWebSocketListener(Kernel kernel, ILogger logger)
|
||||||
public SystemInfoWebSocketListener([Import("kernel")] Kernel kernel, [Import("logger")] ILogger logger)
|
|
||||||
: base(logger)
|
: base(logger)
|
||||||
{
|
{
|
||||||
_kernel = kernel;
|
_kernel = kernel;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -25,7 +24,6 @@ namespace MediaBrowser.ApiInteraction.Javascript
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class JavascriptApiClientService
|
/// Class JavascriptApiClientService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IRestfulService))]
|
|
||||||
public class JavascriptApiClientService : BaseRestService
|
public class JavascriptApiClientService : BaseRestService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -68,7 +68,6 @@
|
||||||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
|
|
@ -98,6 +98,9 @@
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.0-rc\tools\Microsoft.Bcl.Build.targets" />
|
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.0-rc\tools\Microsoft.Bcl.Build.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -656,7 +656,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <returns>Task{DtoUserItemData}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
||||||
public Task<UserItemDataDto> ReportPlaybackStartAsync(string itemId, Guid userId)
|
public Task<UserItemDataDto> ReportPlaybackStartAsync(string itemId, Guid userId)
|
||||||
{
|
{
|
||||||
|
@ -686,7 +686,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="positionTicks">The position ticks.</param>
|
/// <param name="positionTicks">The position ticks.</param>
|
||||||
/// <returns>Task{DtoUserItemData}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
||||||
public Task<UserItemDataDto> ReportPlaybackProgressAsync(string itemId, Guid userId, long? positionTicks)
|
public Task<UserItemDataDto> ReportPlaybackProgressAsync(string itemId, Guid userId, long? positionTicks)
|
||||||
{
|
{
|
||||||
|
@ -718,7 +718,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="positionTicks">The position ticks.</param>
|
/// <param name="positionTicks">The position ticks.</param>
|
||||||
/// <returns>Task{DtoUserItemData}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
||||||
public Task<UserItemDataDto> ReportPlaybackStoppedAsync(string itemId, Guid userId, long? positionTicks)
|
public Task<UserItemDataDto> ReportPlaybackStoppedAsync(string itemId, Guid userId, long? positionTicks)
|
||||||
{
|
{
|
||||||
|
@ -749,7 +749,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <returns>Task{DtoUserItemData}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
||||||
public Task ClearUserItemRatingAsync(string itemId, Guid userId)
|
public Task ClearUserItemRatingAsync(string itemId, Guid userId)
|
||||||
{
|
{
|
||||||
|
@ -774,7 +774,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="likes">if set to <c>true</c> [likes].</param>
|
/// <param name="likes">if set to <c>true</c> [likes].</param>
|
||||||
/// <returns>Task{DtoUserItemData}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
/// <exception cref="System.ArgumentNullException">itemId</exception>
|
||||||
public Task<UserItemDataDto> UpdateUserItemRatingAsync(string itemId, Guid userId, bool likes)
|
public Task<UserItemDataDto> UpdateUserItemRatingAsync(string itemId, Guid userId, bool likes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,6 +75,9 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using MediaBrowser.Common.Events;
|
using MediaBrowser.Common.Events;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Localization;
|
|
||||||
using MediaBrowser.Common.Mef;
|
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Common.ScheduledTasks;
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
|
@ -11,8 +9,6 @@ using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.ComponentModel.Composition.Hosting;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -183,36 +179,14 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// Gets the list of currently loaded plugins
|
/// Gets the list of currently loaded plugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugins.</value>
|
/// <value>The plugins.</value>
|
||||||
[ImportMany(typeof(IPlugin))]
|
|
||||||
public IEnumerable<IPlugin> Plugins { get; protected set; }
|
public IEnumerable<IPlugin> Plugins { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the list of Scheduled Tasks
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The scheduled tasks.</value>
|
|
||||||
[ImportMany(typeof(IScheduledTask))]
|
|
||||||
public IEnumerable<IScheduledTask> ScheduledTasks { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the web socket listeners.
|
/// Gets the web socket listeners.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The web socket listeners.</value>
|
/// <value>The web socket listeners.</value>
|
||||||
[ImportMany(typeof(IWebSocketListener))]
|
|
||||||
public IEnumerable<IWebSocketListener> WebSocketListeners { get; private set; }
|
public IEnumerable<IWebSocketListener> WebSocketListeners { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the list of Localized string files
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The string files.</value>
|
|
||||||
[ImportMany(typeof(LocalizedStringData))]
|
|
||||||
public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the MEF CompositionContainer
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The composition container.</value>
|
|
||||||
private CompositionContainer CompositionContainer { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _HTTP manager
|
/// The _HTTP manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -225,25 +199,17 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// <value>The TCP manager.</value>
|
/// <value>The TCP manager.</value>
|
||||||
public TcpManager TcpManager { get; private set; }
|
public TcpManager TcpManager { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the task manager.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The task manager.</value>
|
|
||||||
public TaskManager TaskManager { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the iso manager.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The iso manager.</value>
|
|
||||||
public IIsoManager IsoManager { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the rest services.
|
/// Gets the rest services.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The rest services.</value>
|
/// <value>The rest services.</value>
|
||||||
[ImportMany(typeof(IRestfulService))]
|
|
||||||
public IEnumerable<IRestfulService> RestServices { get; private set; }
|
public IEnumerable<IRestfulService> RestServices { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The disposable parts
|
||||||
|
/// </summary>
|
||||||
|
private readonly List<IDisposable> _disposableParts = new List<IDisposable>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _protobuf serializer initialized
|
/// The _protobuf serializer initialized
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -265,7 +231,7 @@ namespace MediaBrowser.Common.Kernel
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Lazy load
|
// Lazy load
|
||||||
LazyInitializer.EnsureInitialized(ref _protobufSerializer, ref _protobufSerializerInitialized, ref _protobufSerializerSyncLock, () => DynamicProtobufSerializer.Create(Assemblies));
|
LazyInitializer.EnsureInitialized(ref _protobufSerializer, ref _protobufSerializerInitialized, ref _protobufSerializerSyncLock, () => DynamicProtobufSerializer.Create(AllTypes));
|
||||||
return _protobufSerializer;
|
return _protobufSerializer;
|
||||||
}
|
}
|
||||||
private set
|
private set
|
||||||
|
@ -335,30 +301,36 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// <value>The application host.</value>
|
/// <value>The application host.</value>
|
||||||
protected IApplicationHost ApplicationHost { get; private set; }
|
protected IApplicationHost ApplicationHost { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the task manager.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The task manager.</value>
|
||||||
|
protected ITaskManager TaskManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the assemblies.
|
/// Gets the assemblies.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The assemblies.</value>
|
/// <value>The assemblies.</value>
|
||||||
public Assembly[] Assemblies { get; private set; }
|
protected Assembly[] Assemblies { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all types.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>All types.</value>
|
||||||
|
public Type[] AllTypes { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BaseKernel{TApplicationPathsType}" /> class.
|
/// Initializes a new instance of the <see cref="BaseKernel{TApplicationPathsType}" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appHost">The app host.</param>
|
/// <param name="appHost">The app host.</param>
|
||||||
/// <param name="isoManager">The iso manager.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">isoManager</exception>
|
/// <exception cref="System.ArgumentNullException">isoManager</exception>
|
||||||
protected BaseKernel(IApplicationHost appHost, IIsoManager isoManager, ILogger logger)
|
protected BaseKernel(IApplicationHost appHost, ILogger logger)
|
||||||
{
|
{
|
||||||
if (appHost == null)
|
if (appHost == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("appHost");
|
throw new ArgumentNullException("appHost");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isoManager == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("isoManager");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (logger == null)
|
if (logger == null)
|
||||||
{
|
{
|
||||||
|
@ -366,7 +338,6 @@ namespace MediaBrowser.Common.Kernel
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationHost = appHost;
|
ApplicationHost = appHost;
|
||||||
IsoManager = isoManager;
|
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +390,7 @@ namespace MediaBrowser.Common.Kernel
|
||||||
await OnConfigurationLoaded().ConfigureAwait(false);
|
await OnConfigurationLoaded().ConfigureAwait(false);
|
||||||
|
|
||||||
DisposeTaskManager();
|
DisposeTaskManager();
|
||||||
TaskManager = new TaskManager(this, Logger);
|
TaskManager = new TaskManager(Logger);
|
||||||
|
|
||||||
Logger.Info("Loading Plugins");
|
Logger.Info("Loading Plugins");
|
||||||
await ReloadComposableParts().ConfigureAwait(false);
|
await ReloadComposableParts().ConfigureAwait(false);
|
||||||
|
@ -460,25 +431,82 @@ namespace MediaBrowser.Common.Kernel
|
||||||
|
|
||||||
Assemblies = GetComposablePartAssemblies().ToArray();
|
Assemblies = GetComposablePartAssemblies().ToArray();
|
||||||
|
|
||||||
CompositionContainer = MefUtils.GetSafeCompositionContainer(Assemblies.Select(i => new AssemblyCatalog(i)));
|
AllTypes = Assemblies.SelectMany(GetTypes).ToArray();
|
||||||
|
|
||||||
ComposeExportedValues(CompositionContainer);
|
ComposeParts(AllTypes);
|
||||||
|
|
||||||
CompositionContainer.ComposeParts(this);
|
|
||||||
|
|
||||||
await OnComposablePartsLoaded().ConfigureAwait(false);
|
await OnComposablePartsLoaded().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
CompositionContainer.Catalog.Dispose();
|
/// <summary>
|
||||||
|
/// Composes the parts.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="allTypes">All types.</param>
|
||||||
|
private void ComposeParts(IEnumerable<Type> allTypes)
|
||||||
|
{
|
||||||
|
var concreteTypes = allTypes.Where(t => t.IsClass && !t.IsAbstract && !t.IsInterface && !t.IsGenericType).ToArray();
|
||||||
|
|
||||||
|
RegisterExportedValues();
|
||||||
|
|
||||||
|
FindParts(concreteTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Composes the parts with ioc container.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="allTypes">All types.</param>
|
||||||
|
protected virtual void FindParts(Type[] allTypes)
|
||||||
|
{
|
||||||
|
RestServices = GetExports<IRestfulService>(allTypes);
|
||||||
|
WebSocketListeners = GetExports<IWebSocketListener>(allTypes);
|
||||||
|
Plugins = GetExports<IPlugin>(allTypes);
|
||||||
|
|
||||||
|
var tasks = GetExports<IScheduledTask>(allTypes, false);
|
||||||
|
|
||||||
|
TaskManager.AddTasks(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the exports.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="allTypes">All types.</param>
|
||||||
|
/// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
|
||||||
|
/// <returns>IEnumerable{``0}.</returns>
|
||||||
|
protected IEnumerable<T> GetExports<T>(Type[] allTypes, bool manageLiftime = true)
|
||||||
|
{
|
||||||
|
var currentType = typeof(T);
|
||||||
|
|
||||||
|
Logger.Info("Composing instances of " + currentType.Name);
|
||||||
|
|
||||||
|
var parts = allTypes.Where(currentType.IsAssignableFrom).Select(Instantiate).Cast<T>().ToArray();
|
||||||
|
|
||||||
|
if (manageLiftime)
|
||||||
|
{
|
||||||
|
_disposableParts.AddRange(parts.OfType<IDisposable>());
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Instantiates the specified type.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type.</param>
|
||||||
|
/// <returns>System.Object.</returns>
|
||||||
|
private object Instantiate(Type type)
|
||||||
|
{
|
||||||
|
return ApplicationHost.CreateInstance(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Composes the exported values.
|
/// Composes the exported values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="container">The container.</param>
|
/// <param name="container">The container.</param>
|
||||||
protected virtual void ComposeExportedValues(CompositionContainer container)
|
protected virtual void RegisterExportedValues()
|
||||||
{
|
{
|
||||||
container.ComposeExportedValue("logger", Logger);
|
ApplicationHost.Register<IKernel>(this);
|
||||||
container.ComposeExportedValue("appHost", ApplicationHost);
|
ApplicationHost.Register(TaskManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -545,6 +573,31 @@ namespace MediaBrowser.Common.Kernel
|
||||||
yield return GetType().Assembly;
|
yield return GetType().Assembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of types within an assembly
|
||||||
|
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assembly">The assembly.</param>
|
||||||
|
/// <returns>IEnumerable{Type}.</returns>
|
||||||
|
/// <exception cref="System.ArgumentNullException">assembly</exception>
|
||||||
|
private static IEnumerable<Type> GetTypes(Assembly assembly)
|
||||||
|
{
|
||||||
|
if (assembly == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("assembly");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return assembly.GetTypes();
|
||||||
|
}
|
||||||
|
catch (ReflectionTypeLoadException ex)
|
||||||
|
{
|
||||||
|
// If it fails we can still get a list of the Types it was able to resolve
|
||||||
|
return ex.Types.Where(t => t != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires after MEF finishes finding composable parts within plugin assemblies
|
/// Fires after MEF finishes finding composable parts within plugin assemblies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -553,11 +606,6 @@ namespace MediaBrowser.Common.Kernel
|
||||||
{
|
{
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
foreach (var task in ScheduledTasks)
|
|
||||||
{
|
|
||||||
task.Initialize(this, Logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start-up each plugin
|
// Start-up each plugin
|
||||||
Parallel.ForEach(Plugins, plugin =>
|
Parallel.ForEach(Plugins, plugin =>
|
||||||
{
|
{
|
||||||
|
@ -608,22 +656,11 @@ namespace MediaBrowser.Common.Kernel
|
||||||
{
|
{
|
||||||
DisposeTcpManager();
|
DisposeTcpManager();
|
||||||
DisposeTaskManager();
|
DisposeTaskManager();
|
||||||
DisposeIsoManager();
|
|
||||||
DisposeHttpManager();
|
DisposeHttpManager();
|
||||||
|
|
||||||
DisposeComposableParts();
|
DisposeComposableParts();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
_disposableParts.Clear();
|
||||||
/// Disposes the iso manager.
|
|
||||||
/// </summary>
|
|
||||||
private void DisposeIsoManager()
|
|
||||||
{
|
|
||||||
if (IsoManager != null)
|
|
||||||
{
|
|
||||||
IsoManager.Dispose();
|
|
||||||
IsoManager = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,9 +705,9 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void DisposeComposableParts()
|
protected virtual void DisposeComposableParts()
|
||||||
{
|
{
|
||||||
if (CompositionContainer != null)
|
foreach (var part in _disposableParts)
|
||||||
{
|
{
|
||||||
CompositionContainer.Dispose();
|
part.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,33 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task UpdateApplication(CancellationToken cancellationToken, IProgress<double> progress);
|
Task UpdateApplication(CancellationToken cancellationToken, IProgress<double> progress);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an instance of type and resolves all constructor dependancies
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type.</param>
|
||||||
|
/// <returns>System.Object.</returns>
|
||||||
|
object CreateInstance(Type type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a service that other classes can use as a dependancy.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="obj">The obj.</param>
|
||||||
|
void Register<T>(T obj) where T : class;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolves this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns>``0.</returns>
|
||||||
|
T Resolve<T>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolves this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns>``0.</returns>
|
||||||
|
T TryResolve<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Common.ScheduledTasks;
|
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Kernel
|
namespace MediaBrowser.Common.Kernel
|
||||||
|
@ -69,12 +67,6 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// <returns>SystemInfo.</returns>
|
/// <returns>SystemInfo.</returns>
|
||||||
SystemInfo GetSystemInfo();
|
SystemInfo GetSystemInfo();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the scheduled tasks.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The scheduled tasks.</value>
|
|
||||||
IEnumerable<IScheduledTask> ScheduledTasks { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reloads the logger.
|
/// Reloads the logger.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -133,12 +125,6 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// <value>The TCP manager.</value>
|
/// <value>The TCP manager.</value>
|
||||||
TcpManager TcpManager { get; }
|
TcpManager TcpManager { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the task manager.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The task manager.</value>
|
|
||||||
TaskManager TaskManager { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the web socket listeners.
|
/// Gets the web socket listeners.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -160,12 +146,6 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler<EventArgs> ConfigurationUpdated;
|
event EventHandler<EventArgs> ConfigurationUpdated;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the assemblies.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The assemblies.</value>
|
|
||||||
Assembly[] Assemblies { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the rest services.
|
/// Gets the rest services.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
<Reference Include="Alchemy">
|
<Reference Include="Alchemy">
|
||||||
<HintPath>..\packages\Alchemy.2.2.1\lib\net40\Alchemy.dll</HintPath>
|
<HintPath>..\packages\Alchemy.2.2.1\lib\net40\Alchemy.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MoreLinq">
|
|
||||||
<HintPath>..\packages\morelinq.1.0.15631-beta\lib\net35\MoreLinq.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NLog">
|
<Reference Include="NLog">
|
||||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -92,7 +89,6 @@
|
||||||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Management" />
|
<Reference Include="System.Management" />
|
||||||
|
@ -128,7 +124,6 @@
|
||||||
<Compile Include="Events\GenericEventArgs.cs" />
|
<Compile Include="Events\GenericEventArgs.cs" />
|
||||||
<Compile Include="Extensions\NamedLock.cs" />
|
<Compile Include="Extensions\NamedLock.cs" />
|
||||||
<Compile Include="Extensions\ResourceNotFoundException.cs" />
|
<Compile Include="Extensions\ResourceNotFoundException.cs" />
|
||||||
<Compile Include="IO\FileSystem.cs" />
|
|
||||||
<Compile Include="IO\FileSystemRepository.cs" />
|
<Compile Include="IO\FileSystemRepository.cs" />
|
||||||
<Compile Include="IO\IIsoManager.cs" />
|
<Compile Include="IO\IIsoManager.cs" />
|
||||||
<Compile Include="IO\IIsoMount.cs" />
|
<Compile Include="IO\IIsoMount.cs" />
|
||||||
|
@ -141,8 +136,6 @@
|
||||||
<Compile Include="Kernel\IApplicationHost.cs" />
|
<Compile Include="Kernel\IApplicationHost.cs" />
|
||||||
<Compile Include="Kernel\IKernel.cs" />
|
<Compile Include="Kernel\IKernel.cs" />
|
||||||
<Compile Include="Kernel\TcpManager.cs" />
|
<Compile Include="Kernel\TcpManager.cs" />
|
||||||
<Compile Include="Localization\LocalizedStringData.cs" />
|
|
||||||
<Compile Include="Mef\MefUtils.cs" />
|
|
||||||
<Compile Include="Net\AlchemyWebSocket.cs" />
|
<Compile Include="Net\AlchemyWebSocket.cs" />
|
||||||
<Compile Include="Net\BaseRestService.cs" />
|
<Compile Include="Net\BaseRestService.cs" />
|
||||||
<Compile Include="Net\Handlers\BaseActionHandler.cs" />
|
<Compile Include="Net\Handlers\BaseActionHandler.cs" />
|
||||||
|
@ -150,6 +143,7 @@
|
||||||
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
|
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
|
||||||
<Compile Include="Net\HttpManager.cs" />
|
<Compile Include="Net\HttpManager.cs" />
|
||||||
<Compile Include="Net\IRestfulService.cs" />
|
<Compile Include="Net\IRestfulService.cs" />
|
||||||
|
<Compile Include="Net\IUdpServer.cs" />
|
||||||
<Compile Include="Net\IWebSocket.cs" />
|
<Compile Include="Net\IWebSocket.cs" />
|
||||||
<Compile Include="Net\MimeTypes.cs" />
|
<Compile Include="Net\MimeTypes.cs" />
|
||||||
<Compile Include="Net\NativeWebSocket.cs" />
|
<Compile Include="Net\NativeWebSocket.cs" />
|
||||||
|
@ -165,6 +159,7 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ScheduledTasks\ITaskManager.cs" />
|
||||||
<Compile Include="ScheduledTasks\TaskManager.cs" />
|
<Compile Include="ScheduledTasks\TaskManager.cs" />
|
||||||
<Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
|
<Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
|
||||||
<Compile Include="ScheduledTasks\ScheduledTaskHelpers.cs" />
|
<Compile Include="ScheduledTasks\ScheduledTaskHelpers.cs" />
|
||||||
|
@ -229,6 +224,9 @@
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.Composition.Hosting;
|
|
||||||
using System.ComponentModel.Composition.Primitives;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Mef
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class MefUtils
|
|
||||||
/// </summary>
|
|
||||||
public static class MefUtils
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Plugins that live on both the server and UI are going to have references to assemblies from both sides.
|
|
||||||
/// But looks for Parts on one side, it will throw an exception when it seems Types from the other side that it doesn't have a reference to.
|
|
||||||
/// For example, a plugin provides a Resolver. When MEF runs in the UI, it will throw an exception when it sees the resolver because there won't be a reference to the base class.
|
|
||||||
/// This method will catch those exceptions while retining the list of Types that MEF is able to resolve.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="catalogs">The catalogs.</param>
|
|
||||||
/// <returns>CompositionContainer.</returns>
|
|
||||||
/// <exception cref="System.ArgumentNullException">catalogs</exception>
|
|
||||||
public static CompositionContainer GetSafeCompositionContainer(IEnumerable<ComposablePartCatalog> catalogs)
|
|
||||||
{
|
|
||||||
if (catalogs == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("catalogs");
|
|
||||||
}
|
|
||||||
|
|
||||||
var newList = new List<ComposablePartCatalog>();
|
|
||||||
|
|
||||||
// Go through each Catalog
|
|
||||||
foreach (var catalog in catalogs)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Try to have MEF find Parts
|
|
||||||
catalog.Parts.ToArray();
|
|
||||||
|
|
||||||
// If it succeeds we can use the entire catalog
|
|
||||||
newList.Add(catalog);
|
|
||||||
}
|
|
||||||
catch (ReflectionTypeLoadException ex)
|
|
||||||
{
|
|
||||||
// If it fails we can still get a list of the Types it was able to resolve and create TypeCatalogs
|
|
||||||
var typeCatalogs = ex.Types.Where(t => t != null).Select(t => new TypeCatalog(t));
|
|
||||||
newList.AddRange(typeCatalogs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CompositionContainer(new AggregateCatalog(newList));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of types within an assembly
|
|
||||||
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="assembly">The assembly.</param>
|
|
||||||
/// <returns>IEnumerable{Type}.</returns>
|
|
||||||
/// <exception cref="System.ArgumentNullException">assembly</exception>
|
|
||||||
public static IEnumerable<Type> GetTypes(Assembly assembly)
|
|
||||||
{
|
|
||||||
if (assembly == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("assembly");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return assembly.GetTypes();
|
|
||||||
}
|
|
||||||
catch (ReflectionTypeLoadException ex)
|
|
||||||
{
|
|
||||||
// If it fails we can still get a list of the Types it was able to resolve
|
|
||||||
return ex.Types.Where(t => t != null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,6 +4,7 @@ using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using ServiceStack.Api.Swagger;
|
using ServiceStack.Api.Swagger;
|
||||||
using ServiceStack.Common.Web;
|
using ServiceStack.Common.Web;
|
||||||
|
using ServiceStack.Configuration;
|
||||||
using ServiceStack.Logging.NLogger;
|
using ServiceStack.Logging.NLogger;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using ServiceStack.ServiceInterface.Cors;
|
using ServiceStack.ServiceInterface.Cors;
|
||||||
|
@ -153,6 +154,8 @@ namespace MediaBrowser.Common.Net
|
||||||
DebugMode = true
|
DebugMode = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
container.Adapter = new ContainerAdapter(ApplicationHost);
|
||||||
|
|
||||||
container.Register(Kernel);
|
container.Register(Kernel);
|
||||||
container.Register(_logger);
|
container.Register(_logger);
|
||||||
|
@ -464,4 +467,23 @@ namespace MediaBrowser.Common.Net
|
||||||
/// <value>The endpoint.</value>
|
/// <value>The endpoint.</value>
|
||||||
public IPEndPoint Endpoint { get; set; }
|
public IPEndPoint Endpoint { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ContainerAdapter : IContainerAdapter
|
||||||
|
{
|
||||||
|
private readonly IApplicationHost _appHost;
|
||||||
|
|
||||||
|
public ContainerAdapter(IApplicationHost appHost)
|
||||||
|
{
|
||||||
|
_appHost = appHost;
|
||||||
|
}
|
||||||
|
public T Resolve<T>()
|
||||||
|
{
|
||||||
|
return _appHost.Resolve<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T TryResolve<T>()
|
||||||
|
{
|
||||||
|
return _appHost.TryResolve<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
7
MediaBrowser.Common/Net/IUdpServer.cs
Normal file
7
MediaBrowser.Common/Net/IUdpServer.cs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Net
|
||||||
|
{
|
||||||
|
public interface IUdpServer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TKernelType">The type of the T kernel type.</typeparam>
|
/// <typeparam name="TKernelType">The type of the T kernel type.</typeparam>
|
||||||
public abstract class BaseScheduledTask<TKernelType> : IScheduledTask
|
public abstract class BaseScheduledTask<TKernelType> : IScheduledTask
|
||||||
where TKernelType : IKernel
|
where TKernelType : class, IKernel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the kernel.
|
/// Gets the kernel.
|
||||||
|
@ -25,6 +25,47 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <value>The kernel.</value>
|
/// <value>The kernel.</value>
|
||||||
protected TKernelType Kernel { get; private set; }
|
protected TKernelType Kernel { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the logger.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The logger.</value>
|
||||||
|
protected ILogger Logger { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the task manager.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The task manager.</value>
|
||||||
|
protected ITaskManager TaskManager { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="BaseScheduledTask{TKernelType}" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="kernel">The kernel.</param>
|
||||||
|
/// <param name="taskManager">The task manager.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
|
/// <exception cref="System.ArgumentNullException">kernel</exception>
|
||||||
|
protected BaseScheduledTask(TKernelType kernel, ITaskManager taskManager, ILogger logger)
|
||||||
|
{
|
||||||
|
if (kernel == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("kernel");
|
||||||
|
}
|
||||||
|
if (taskManager == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("taskManager");
|
||||||
|
}
|
||||||
|
if (logger == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("logger");
|
||||||
|
}
|
||||||
|
|
||||||
|
Kernel = kernel;
|
||||||
|
TaskManager = taskManager;
|
||||||
|
Logger = logger;
|
||||||
|
|
||||||
|
ReloadTriggerEvents(true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _last execution result
|
/// The _last execution result
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -199,7 +240,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(ConfigurationFilePath)
|
return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(ConfigurationFilePath)
|
||||||
.Select(t => ScheduledTaskHelpers.GetTrigger(t, Kernel))
|
.Select(ScheduledTaskHelpers.GetTrigger)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
@ -228,7 +269,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
|
||||||
_triggersInitialized = true;
|
_triggersInitialized = true;
|
||||||
|
|
||||||
ReloadTriggerEvents();
|
ReloadTriggerEvents(false);
|
||||||
|
|
||||||
JsonSerializer.SerializeToFile(_triggers.Select(ScheduledTaskHelpers.GetTriggerInfo), ConfigurationFilePath);
|
JsonSerializer.SerializeToFile(_triggers.Select(ScheduledTaskHelpers.GetTriggerInfo), ConfigurationFilePath);
|
||||||
}
|
}
|
||||||
|
@ -290,29 +331,11 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the logger.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The logger.</value>
|
|
||||||
protected ILogger Logger { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes the specified kernel.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="kernel">The kernel.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
|
||||||
public void Initialize(IKernel kernel, ILogger logger)
|
|
||||||
{
|
|
||||||
Logger = logger;
|
|
||||||
|
|
||||||
Kernel = (TKernelType)kernel;
|
|
||||||
ReloadTriggerEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reloads the trigger events.
|
/// Reloads the trigger events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ReloadTriggerEvents()
|
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
||||||
|
private void ReloadTriggerEvents(bool isApplicationStartup)
|
||||||
{
|
{
|
||||||
foreach (var trigger in Triggers)
|
foreach (var trigger in Triggers)
|
||||||
{
|
{
|
||||||
|
@ -320,7 +343,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
|
||||||
trigger.Triggered -= trigger_Triggered;
|
trigger.Triggered -= trigger_Triggered;
|
||||||
trigger.Triggered += trigger_Triggered;
|
trigger.Triggered += trigger_Triggered;
|
||||||
trigger.Start();
|
trigger.Start(isApplicationStartup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +358,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
|
||||||
Logger.Info("{0} fired for task: {1}", trigger.GetType().Name, Name);
|
Logger.Info("{0} fired for task: {1}", trigger.GetType().Name, Name);
|
||||||
|
|
||||||
Kernel.TaskManager.QueueScheduledTask(this);
|
TaskManager.QueueScheduledTask(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -392,7 +415,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
CurrentCancellationTokenSource = null;
|
CurrentCancellationTokenSource = null;
|
||||||
CurrentProgress = null;
|
CurrentProgress = null;
|
||||||
|
|
||||||
Kernel.TaskManager.OnTaskCompleted(this);
|
TaskManager.OnTaskCompleted(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -27,13 +27,13 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
|
||||||
await Task.Delay(1000).ConfigureAwait(false);
|
await Task.Delay(1000).ConfigureAwait(false);
|
||||||
|
|
||||||
Start();
|
Start(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal abstract void Start();
|
protected internal abstract void Start(bool isApplicationStartup);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops waiting for the trigger action
|
/// Stops waiting for the trigger action
|
||||||
|
|
|
@ -23,7 +23,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal override void Start()
|
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
||||||
|
protected internal override void Start(bool isApplicationStartup)
|
||||||
{
|
{
|
||||||
DisposeTimer();
|
DisposeTimer();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Model.Tasks;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.Tasks;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -73,13 +71,6 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <exception cref="System.InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
/// <exception cref="System.InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
||||||
void Cancel();
|
void Cancel();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes the specified kernel.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="kernel">The kernel.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
|
||||||
void Initialize(IKernel kernel, ILogger logger);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cancels if running.
|
/// Cancels if running.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
46
MediaBrowser.Common/ScheduledTasks/ITaskManager.cs
Normal file
46
MediaBrowser.Common/ScheduledTasks/ITaskManager.cs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
{
|
||||||
|
public interface ITaskManager : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of Scheduled Tasks
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The scheduled tasks.</value>
|
||||||
|
IScheduledTask[] ScheduledTasks { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels if running and queue.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
void CancelIfRunningAndQueue<T>()
|
||||||
|
where T : IScheduledTask;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queues the scheduled task.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
void QueueScheduledTask<T>()
|
||||||
|
where T : IScheduledTask;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queues the scheduled task.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="task">The task.</param>
|
||||||
|
void QueueScheduledTask(IScheduledTask task);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the tasks.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tasks">The tasks.</param>
|
||||||
|
void AddTasks(IEnumerable<IScheduledTask> tasks);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when [task completed].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="task">The task.</param>
|
||||||
|
void OnTaskCompleted(IScheduledTask task);
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal override void Start()
|
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
||||||
|
protected internal override void Start(bool isApplicationStartup)
|
||||||
{
|
{
|
||||||
DisposeTimer();
|
DisposeTimer();
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,10 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger
|
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info">The info.</param>
|
/// <param name="info">The info.</param>
|
||||||
/// <param name="kernel">The kernel.</param>
|
|
||||||
/// <returns>BaseTaskTrigger.</returns>
|
/// <returns>BaseTaskTrigger.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="System.ArgumentNullException"></exception>
|
||||||
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
|
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
|
||||||
public static BaseTaskTrigger GetTrigger(TaskTriggerInfo info, IKernel kernel)
|
public static BaseTaskTrigger GetTrigger(TaskTriggerInfo info)
|
||||||
{
|
{
|
||||||
if (info.Type.Equals(typeof(DailyTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
if (info.Type.Equals(typeof(DailyTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -144,7 +143,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
|
||||||
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return new StartupTrigger(kernel);
|
return new StartupTrigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException("Unrecognized trigger type: " + info.Type);
|
throw new ArgumentException("Unrecognized trigger type: " + info.Type);
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using System.Threading.Tasks;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.ScheduledTasks
|
namespace MediaBrowser.Common.ScheduledTasks
|
||||||
{
|
{
|
||||||
|
@ -9,34 +7,18 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StartupTrigger : BaseTaskTrigger
|
public class StartupTrigger : BaseTaskTrigger
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets the kernel.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The kernel.</value>
|
|
||||||
protected IKernel Kernel { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="StartupTrigger" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="kernel">The kernel.</param>
|
|
||||||
public StartupTrigger(IKernel kernel)
|
|
||||||
{
|
|
||||||
Kernel = kernel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal override void Start()
|
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
||||||
|
protected internal async override void Start(bool isApplicationStartup)
|
||||||
{
|
{
|
||||||
Kernel.ReloadCompleted += Kernel_ReloadCompleted;
|
if (isApplicationStartup)
|
||||||
}
|
{
|
||||||
|
await Task.Delay(2000).ConfigureAwait(false);
|
||||||
|
|
||||||
async void Kernel_ReloadCompleted(object sender, EventArgs e)
|
OnTriggered();
|
||||||
{
|
}
|
||||||
await Task.Delay(2000).ConfigureAwait(false);
|
|
||||||
|
|
||||||
OnTriggered();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -44,7 +26,6 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal override void Stop()
|
protected internal override void Stop()
|
||||||
{
|
{
|
||||||
Kernel.ReloadCompleted -= Kernel_ReloadCompleted;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal override void Start()
|
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
||||||
|
protected internal override void Start(bool isApplicationStartup)
|
||||||
{
|
{
|
||||||
switch (SystemEvent)
|
switch (SystemEvent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -10,8 +9,14 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class TaskManager
|
/// Class TaskManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TaskManager : BaseManager<IKernel>
|
internal class TaskManager : ITaskManager
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of Scheduled Tasks
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The scheduled tasks.</value>
|
||||||
|
public IScheduledTask[] ScheduledTasks { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _task queue
|
/// The _task queue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -25,12 +30,17 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="TaskManager" /> class.
|
/// Initializes a new instance of the <see cref="TaskManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
public TaskManager(IKernel kernel, ILogger logger)
|
public TaskManager(ILogger logger)
|
||||||
: base(kernel)
|
|
||||||
{
|
{
|
||||||
|
if (logger == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("logger");
|
||||||
|
}
|
||||||
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
|
ScheduledTasks = new IScheduledTask[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -40,7 +50,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
public void CancelIfRunningAndQueue<T>()
|
public void CancelIfRunningAndQueue<T>()
|
||||||
where T : IScheduledTask
|
where T : IScheduledTask
|
||||||
{
|
{
|
||||||
Kernel.ScheduledTasks.OfType<T>().First().CancelIfRunning();
|
ScheduledTasks.OfType<T>().First().CancelIfRunning();
|
||||||
QueueScheduledTask<T>();
|
QueueScheduledTask<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +61,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
public void QueueScheduledTask<T>()
|
public void QueueScheduledTask<T>()
|
||||||
where T : IScheduledTask
|
where T : IScheduledTask
|
||||||
{
|
{
|
||||||
var scheduledTask = Kernel.ScheduledTasks.OfType<T>().First();
|
var scheduledTask = ScheduledTasks.OfType<T>().First();
|
||||||
|
|
||||||
QueueScheduledTask(scheduledTask);
|
QueueScheduledTask(scheduledTask);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +74,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
{
|
{
|
||||||
var type = task.GetType();
|
var type = task.GetType();
|
||||||
|
|
||||||
var scheduledTask = Kernel.ScheduledTasks.First(t => t.GetType() == type);
|
var scheduledTask = ScheduledTasks.First(t => t.GetType() == type);
|
||||||
|
|
||||||
lock (_taskQueue)
|
lock (_taskQueue)
|
||||||
{
|
{
|
||||||
|
@ -91,7 +101,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// Called when [task completed].
|
/// Called when [task completed].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="task">The task.</param>
|
/// <param name="task">The task.</param>
|
||||||
internal void OnTaskCompleted(IScheduledTask task)
|
public void OnTaskCompleted(IScheduledTask task)
|
||||||
{
|
{
|
||||||
// Execute queued tasks
|
// Execute queued tasks
|
||||||
lock (_taskQueue)
|
lock (_taskQueue)
|
||||||
|
@ -100,7 +110,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
|
||||||
foreach (var type in copy)
|
foreach (var type in copy)
|
||||||
{
|
{
|
||||||
var scheduledTask = Kernel.ScheduledTasks.First(t => t.GetType() == type);
|
var scheduledTask = ScheduledTasks.First(t => t.GetType() == type);
|
||||||
|
|
||||||
if (scheduledTask.State == TaskState.Idle)
|
if (scheduledTask.State == TaskState.Idle)
|
||||||
{
|
{
|
||||||
|
@ -111,5 +121,39 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Releases unmanaged and - optionally - managed resources.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||||
|
protected virtual void Dispose(bool dispose)
|
||||||
|
{
|
||||||
|
foreach (var task in ScheduledTasks)
|
||||||
|
{
|
||||||
|
task.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the tasks.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tasks">The tasks.</param>
|
||||||
|
public void AddTasks(IEnumerable<IScheduledTask> tasks)
|
||||||
|
{
|
||||||
|
var myTasks = ScheduledTasks.ToList();
|
||||||
|
|
||||||
|
myTasks.AddRange(tasks);
|
||||||
|
|
||||||
|
ScheduledTasks = myTasks.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -13,9 +12,19 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes old cache files
|
/// Deletes old cache files
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IScheduledTask))]
|
|
||||||
public class DeleteCacheFileTask : BaseScheduledTask<IKernel>
|
public class DeleteCacheFileTask : BaseScheduledTask<IKernel>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DeleteCacheFileTask" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="kernel">The kernel.</param>
|
||||||
|
/// <param name="taskManager">The task manager.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
|
public DeleteCacheFileTask(IKernel kernel, ITaskManager taskManager, ILogger logger)
|
||||||
|
: base(kernel, taskManager, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the triggers that define when the task will run
|
/// Creates the triggers that define when the task will run
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -13,9 +12,19 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes old log files
|
/// Deletes old log files
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IScheduledTask))]
|
|
||||||
public class DeleteLogFileTask : BaseScheduledTask<IKernel>
|
public class DeleteLogFileTask : BaseScheduledTask<IKernel>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DeleteLogFileTask" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="kernel">The kernel.</param>
|
||||||
|
/// <param name="taskManager">The task manager.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
|
public DeleteLogFileTask(IKernel kernel, ITaskManager taskManager, ILogger logger)
|
||||||
|
: base(kernel, taskManager, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the triggers that define when the task will run
|
/// Creates the triggers that define when the task will run
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -11,9 +10,19 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ReloadLoggerFileTask
|
/// Class ReloadLoggerFileTask
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IScheduledTask))]
|
|
||||||
public class ReloadLoggerFileTask : BaseScheduledTask<IKernel>
|
public class ReloadLoggerFileTask : BaseScheduledTask<IKernel>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ReloadLoggerFileTask" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="kernel">The kernel.</param>
|
||||||
|
/// <param name="taskManager">The task manager.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
|
public ReloadLoggerFileTask(IKernel kernel, ITaskManager taskManager, ILogger logger)
|
||||||
|
: base(kernel, taskManager, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default triggers.
|
/// Gets the default triggers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plugin Update Task
|
/// Plugin Update Task
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IScheduledTask))]
|
|
||||||
public class SystemUpdateTask : BaseScheduledTask<IKernel>
|
public class SystemUpdateTask : BaseScheduledTask<IKernel>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -22,8 +21,11 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
||||||
/// Initializes a new instance of the <see cref="SystemUpdateTask" /> class.
|
/// Initializes a new instance of the <see cref="SystemUpdateTask" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appHost">The app host.</param>
|
/// <param name="appHost">The app host.</param>
|
||||||
[ImportingConstructor]
|
/// <param name="taskManager">The task manager.</param>
|
||||||
public SystemUpdateTask([Import("appHost")] IApplicationHost appHost)
|
/// <param name="kernel">The kernel.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
|
public SystemUpdateTask(IApplicationHost appHost, ITaskManager taskManager, IKernel kernel, ILogger logger)
|
||||||
|
: base(kernel, taskManager, logger)
|
||||||
{
|
{
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal override void Start()
|
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
|
||||||
|
protected internal override void Start(bool isApplicationStartup)
|
||||||
{
|
{
|
||||||
DisposeTimer();
|
DisposeTimer();
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
using MediaBrowser.Common.Mef;
|
using ProtoBuf;
|
||||||
using ProtoBuf;
|
|
||||||
using ProtoBuf.Meta;
|
using ProtoBuf.Meta;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Serialization
|
namespace MediaBrowser.Common.Serialization
|
||||||
{
|
{
|
||||||
|
@ -135,21 +133,20 @@ namespace MediaBrowser.Common.Serialization
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the specified assemblies.
|
/// Creates the specified assemblies.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assemblies">The assemblies.</param>
|
|
||||||
/// <returns>DynamicProtobufSerializer.</returns>
|
/// <returns>DynamicProtobufSerializer.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">assemblies</exception>
|
/// <exception cref="System.ArgumentNullException">assemblies</exception>
|
||||||
public static DynamicProtobufSerializer Create(IEnumerable<Assembly> assemblies)
|
public static DynamicProtobufSerializer Create(IEnumerable<Type> types)
|
||||||
{
|
{
|
||||||
if (assemblies == null)
|
if (types == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("assemblies");
|
throw new ArgumentNullException("types");
|
||||||
}
|
}
|
||||||
|
|
||||||
var model = TypeModel.Create();
|
var model = TypeModel.Create();
|
||||||
var attributeType = typeof(ProtoContractAttribute);
|
var attributeType = typeof(ProtoContractAttribute);
|
||||||
|
|
||||||
// Find all ProtoContracts in the current assembly
|
// Find all ProtoContracts in the current assembly
|
||||||
foreach (var type in assemblies.SelectMany(a => MefUtils.GetTypes(a).Where(t => Attribute.IsDefined(t, attributeType))))
|
foreach (var type in types.Where(t => Attribute.IsDefined(t, attributeType)))
|
||||||
{
|
{
|
||||||
model.Add(type, true);
|
model.Add(type, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Alchemy" version="2.2.1" targetFramework="net45" />
|
<package id="Alchemy" version="2.2.1" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.0.15631-beta" targetFramework="net45" />
|
|
||||||
<package id="NLog" version="2.0.0.2000" targetFramework="net45" />
|
<package id="NLog" version="2.0.0.2000" targetFramework="net45" />
|
||||||
<package id="protobuf-net" version="2.0.0.621" targetFramework="net45" />
|
<package id="protobuf-net" version="2.0.0.621" targetFramework="net45" />
|
||||||
<package id="Rx-Core" version="2.0.21114" targetFramework="net45" />
|
<package id="Rx-Core" version="2.0.21114" targetFramework="net45" />
|
||||||
|
|
|
@ -541,7 +541,7 @@ namespace MediaBrowser.Controller.Drawing
|
||||||
/// <param name="imageType">Type of the image.</param>
|
/// <param name="imageType">Type of the image.</param>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||||
public Guid GetImageCacheTag(string originalImagePath, DateTime dateModified, IEnumerable<BaseImageEnhancer> imageEnhancers, BaseItem item, ImageType imageType)
|
public Guid GetImageCacheTag(string originalImagePath, DateTime dateModified, IEnumerable<IImageEnhancer> imageEnhancers, BaseItem item, ImageType imageType)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
|
@ -574,7 +574,7 @@ namespace MediaBrowser.Controller.Drawing
|
||||||
/// <param name="imageType">Type of the image.</param>
|
/// <param name="imageType">Type of the image.</param>
|
||||||
/// <param name="imageIndex">Index of the image.</param>
|
/// <param name="imageIndex">Index of the image.</param>
|
||||||
/// <returns>Task{EnhancedImage}.</returns>
|
/// <returns>Task{EnhancedImage}.</returns>
|
||||||
private async Task<Image> ExecuteImageEnhancers(IEnumerable<BaseImageEnhancer> imageEnhancers, Image originalImage, BaseItem item, ImageType imageType, int imageIndex)
|
private async Task<Image> ExecuteImageEnhancers(IEnumerable<IImageEnhancer> imageEnhancers, Image originalImage, BaseItem item, ImageType imageType, int imageIndex)
|
||||||
{
|
{
|
||||||
var result = originalImage;
|
var result = originalImage;
|
||||||
|
|
||||||
|
|
15
MediaBrowser.Controller/Entities/IVirtualFolderCreator.cs
Normal file
15
MediaBrowser.Controller/Entities/IVirtualFolderCreator.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface IVirtualFolderCreator
|
||||||
|
/// </summary>
|
||||||
|
public interface IVirtualFolderCreator
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the folder.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Folder.</returns>
|
||||||
|
BasePluginFolder GetFolder();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Win32;
|
using MediaBrowser.Common.Win32;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Win32;
|
using MediaBrowser.Common.Win32;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using System;
|
using System;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.ScheduledTasks;
|
using MediaBrowser.Controller.ScheduledTasks;
|
||||||
|
@ -66,16 +67,27 @@ namespace MediaBrowser.Controller.IO
|
||||||
/// <value>The logger.</value>
|
/// <value>The logger.</value>
|
||||||
private ILogger Logger { get; set; }
|
private ILogger Logger { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the task manager.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The task manager.</value>
|
||||||
|
private ITaskManager TaskManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DirectoryWatchers" /> class.
|
/// Initializes a new instance of the <see cref="DirectoryWatchers" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DirectoryWatchers(ILogger logger)
|
public DirectoryWatchers(ILogger logger, ITaskManager taskManager)
|
||||||
{
|
{
|
||||||
if (logger == null)
|
if (logger == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("logger");
|
throw new ArgumentNullException("logger");
|
||||||
}
|
}
|
||||||
|
if (taskManager == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("taskManager");
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskManager = taskManager;
|
||||||
Logger = logger;
|
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 the root folder changed, run the library task so the user can see it
|
||||||
if (itemsToRefresh.Any(i => i is AggregateFolder))
|
if (itemsToRefresh.Any(i => i is AggregateFolder))
|
||||||
{
|
{
|
||||||
Kernel.Instance.TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.IO
|
namespace MediaBrowser.Controller.IO
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class FileSystem
|
/// Class FileSystem
|
|
@ -1,5 +1,6 @@
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
@ -26,17 +27,18 @@ namespace MediaBrowser.Controller.IO
|
||||||
/// The _logger
|
/// The _logger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FileSystemManager" /> class.
|
/// Initializes a new instance of the <see cref="FileSystemManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
/// <param name="logger">The logger.</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)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
DirectoryWatchers = new DirectoryWatchers(logger);
|
DirectoryWatchers = new DirectoryWatchers(logger, taskManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Common.Kernel;
|
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
@ -16,14 +15,10 @@ using MediaBrowser.Controller.ScheduledTasks;
|
||||||
using MediaBrowser.Controller.Updates;
|
using MediaBrowser.Controller.Updates;
|
||||||
using MediaBrowser.Controller.Weather;
|
using MediaBrowser.Controller.Weather;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.ComponentModel.Composition.Hosting;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -178,32 +173,34 @@ namespace MediaBrowser.Controller
|
||||||
get { return KernelContext.Server; }
|
get { return KernelContext.Server; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of Localized string files
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The string files.</value>
|
||||||
|
public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of plugin configuration pages
|
/// Gets the list of plugin configuration pages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configuration pages.</value>
|
/// <value>The configuration pages.</value>
|
||||||
[ImportMany(typeof(IPluginConfigurationPage))]
|
|
||||||
public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
|
public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the intro providers.
|
/// Gets the intro providers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The intro providers.</value>
|
/// <value>The intro providers.</value>
|
||||||
[ImportMany(typeof(IIntroProvider))]
|
|
||||||
public IEnumerable<IIntroProvider> IntroProviders { get; private set; }
|
public IEnumerable<IIntroProvider> IntroProviders { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of currently registered weather prvoiders
|
/// Gets the list of currently registered weather prvoiders
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The weather providers.</value>
|
/// <value>The weather providers.</value>
|
||||||
[ImportMany(typeof(IWeatherProvider))]
|
|
||||||
public IEnumerable<IWeatherProvider> WeatherProviders { get; private set; }
|
public IEnumerable<IWeatherProvider> WeatherProviders { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of currently registered metadata prvoiders
|
/// Gets the list of currently registered metadata prvoiders
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The metadata providers enumerable.</value>
|
/// <value>The metadata providers enumerable.</value>
|
||||||
[ImportMany(typeof(BaseMetadataProvider))]
|
|
||||||
public BaseMetadataProvider[] MetadataProviders { get; private set; }
|
public BaseMetadataProvider[] MetadataProviders { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -211,28 +208,24 @@ namespace MediaBrowser.Controller
|
||||||
/// Image processors are specialized metadata providers that run after the normal ones
|
/// Image processors are specialized metadata providers that run after the normal ones
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The image enhancers.</value>
|
/// <value>The image enhancers.</value>
|
||||||
[ImportMany(typeof(BaseImageEnhancer))]
|
public IEnumerable<IImageEnhancer> ImageEnhancers { get; private set; }
|
||||||
public BaseImageEnhancer[] ImageEnhancers { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of currently registered entity resolvers
|
/// Gets the list of currently registered entity resolvers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The entity resolvers enumerable.</value>
|
/// <value>The entity resolvers enumerable.</value>
|
||||||
[ImportMany(typeof(IBaseItemResolver))]
|
internal IEnumerable<IBaseItemResolver> EntityResolvers { get; private set; }
|
||||||
internal IBaseItemResolver[] EntityResolvers { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of BasePluginFolders added by plugins
|
/// Gets the list of BasePluginFolders added by plugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugin folders.</value>
|
/// <value>The plugin folders.</value>
|
||||||
[ImportMany(typeof(BasePluginFolder))]
|
internal IEnumerable<IVirtualFolderCreator> PluginFolderCreators { get; private set; }
|
||||||
internal IEnumerable<BasePluginFolder> PluginFolders { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of available user repositories
|
/// Gets the list of available user repositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user repositories.</value>
|
/// <value>The user repositories.</value>
|
||||||
[ImportMany(typeof(IUserRepository))]
|
|
||||||
private IEnumerable<IUserRepository> UserRepositories { get; set; }
|
private IEnumerable<IUserRepository> UserRepositories { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -251,7 +244,6 @@ namespace MediaBrowser.Controller
|
||||||
/// Gets the list of available item repositories
|
/// Gets the list of available item repositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The item repositories.</value>
|
/// <value>The item repositories.</value>
|
||||||
[ImportMany(typeof(IItemRepository))]
|
|
||||||
private IEnumerable<IItemRepository> ItemRepositories { get; set; }
|
private IEnumerable<IItemRepository> ItemRepositories { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -264,22 +256,19 @@ namespace MediaBrowser.Controller
|
||||||
/// Gets the list of available item repositories
|
/// Gets the list of available item repositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user data repositories.</value>
|
/// <value>The user data repositories.</value>
|
||||||
[ImportMany(typeof(IUserDataRepository))]
|
|
||||||
private IEnumerable<IUserDataRepository> UserDataRepositories { get; set; }
|
private IEnumerable<IUserDataRepository> UserDataRepositories { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of available DisplayPreferencesRepositories
|
/// Gets the list of available DisplayPreferencesRepositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The display preferences repositories.</value>
|
/// <value>The display preferences repositories.</value>
|
||||||
[ImportMany(typeof(IDisplayPreferencesRepository))]
|
|
||||||
private IEnumerable<IDisplayPreferencesRepository> DisplayPreferencesRepositories { get; set; }
|
private IEnumerable<IDisplayPreferencesRepository> DisplayPreferencesRepositories { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of entity resolution ignore rules
|
/// Gets the list of entity resolution ignore rules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The entity resolution ignore rules.</value>
|
/// <value>The entity resolution ignore rules.</value>
|
||||||
[ImportMany(typeof(BaseResolutionIgnoreRule))]
|
internal IEnumerable<IResolutionIgnoreRule> EntityResolutionIgnoreRules { get; private set; }
|
||||||
internal IEnumerable<BaseResolutionIgnoreRule> EntityResolutionIgnoreRules { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active user data repository
|
/// Gets the active user data repository
|
||||||
|
@ -302,48 +291,16 @@ namespace MediaBrowser.Controller
|
||||||
get { return 7359; }
|
get { return 7359; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the zip client.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The zip client.</value>
|
|
||||||
private IZipClient ZipClient { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the bluray examiner.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The bluray examiner.</value>
|
|
||||||
private IBlurayExaminer BlurayExaminer { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a kernel based on a Data path, which is akin to our current programdata path
|
/// Creates a kernel based on a Data path, which is akin to our current programdata path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appHost">The app host.</param>
|
/// <param name="appHost">The app host.</param>
|
||||||
/// <param name="isoManager">The iso manager.</param>
|
|
||||||
/// <param name="zipClient">The zip client.</param>
|
|
||||||
/// <param name="blurayExaminer">The bluray examiner.</param>
|
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">isoManager</exception>
|
/// <exception cref="System.ArgumentNullException">isoManager</exception>
|
||||||
public Kernel(IApplicationHost appHost, IIsoManager isoManager, IZipClient zipClient, IBlurayExaminer blurayExaminer, ILogger logger)
|
public Kernel(IApplicationHost appHost, ILogger logger)
|
||||||
: base(appHost, isoManager, logger)
|
: base(appHost, logger)
|
||||||
{
|
{
|
||||||
if (isoManager == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("isoManager");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zipClient == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("zipClient");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blurayExaminer == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("blurayExaminer");
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance = this;
|
Instance = this;
|
||||||
ZipClient = zipClient;
|
|
||||||
BlurayExaminer = blurayExaminer;
|
|
||||||
|
|
||||||
// For now there's no real way to inject this properly
|
// For now there's no real way to inject this properly
|
||||||
BaseItem.Logger = logger;
|
BaseItem.Logger = logger;
|
||||||
|
@ -356,13 +313,43 @@ namespace MediaBrowser.Controller
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Composes the exported values.
|
/// Composes the exported values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="container">The container.</param>
|
protected override void RegisterExportedValues()
|
||||||
protected override void ComposeExportedValues(CompositionContainer container)
|
|
||||||
{
|
{
|
||||||
base.ComposeExportedValues(container);
|
ApplicationHost.Register(this);
|
||||||
|
|
||||||
|
base.RegisterExportedValues();
|
||||||
|
}
|
||||||
|
|
||||||
container.ComposeExportedValue("kernel", this);
|
/// <summary>
|
||||||
container.ComposeExportedValue("blurayExaminer", BlurayExaminer);
|
/// Composes the parts with ioc container.
|
||||||
|
/// </summary>
|
||||||
|
/// <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);
|
||||||
|
UserDataRepositories = GetExports<IUserDataRepository>(allTypes);
|
||||||
|
UserRepositories = GetExports<IUserRepository>(allTypes);
|
||||||
|
DisplayPreferencesRepositories = GetExports<IDisplayPreferencesRepository>(allTypes);
|
||||||
|
ItemRepositories = GetExports<IItemRepository>(allTypes);
|
||||||
|
WeatherProviders = GetExports<IWeatherProvider>(allTypes);
|
||||||
|
IntroProviders = GetExports<IIntroProvider>(allTypes);
|
||||||
|
PluginConfigurationPages = GetExports<IPluginConfigurationPage>(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>
|
/// <summary>
|
||||||
|
@ -371,24 +358,14 @@ namespace MediaBrowser.Controller
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
protected override async Task ReloadInternal()
|
protected override async Task ReloadInternal()
|
||||||
{
|
{
|
||||||
Logger.Info("Extracting tools");
|
|
||||||
|
|
||||||
// Reset these so that they can be lazy loaded again
|
// Reset these so that they can be lazy loaded again
|
||||||
Users = null;
|
Users = null;
|
||||||
RootFolder = null;
|
RootFolder = null;
|
||||||
|
|
||||||
ReloadResourcePools();
|
|
||||||
InstallationManager = new InstallationManager(this, ZipClient, Logger);
|
|
||||||
LibraryManager = new LibraryManager(this, Logger);
|
|
||||||
UserManager = new UserManager(this, Logger);
|
|
||||||
FFMpegManager = new FFMpegManager(this, ZipClient, Logger);
|
|
||||||
ImageManager = new ImageManager(this, Logger);
|
|
||||||
ProviderManager = new ProviderManager(this, Logger);
|
|
||||||
UserDataManager = new UserDataManager(this, Logger);
|
|
||||||
PluginSecurityManager = new PluginSecurityManager(this);
|
|
||||||
|
|
||||||
await base.ReloadInternal().ConfigureAwait(false);
|
await base.ReloadInternal().ConfigureAwait(false);
|
||||||
|
|
||||||
|
ReloadResourcePools();
|
||||||
|
|
||||||
ReloadFileSystemManager();
|
ReloadFileSystemManager();
|
||||||
|
|
||||||
await UserManager.RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false);
|
await UserManager.RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false);
|
||||||
|
@ -456,15 +433,6 @@ namespace MediaBrowser.Controller
|
||||||
DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository);
|
DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository);
|
||||||
var displayPreferencesRepoTask = DisplayPreferencesRepository.Initialize();
|
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);
|
await Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +471,7 @@ namespace MediaBrowser.Controller
|
||||||
{
|
{
|
||||||
DisposeFileSystemManager();
|
DisposeFileSystemManager();
|
||||||
|
|
||||||
FileSystemManager = new FileSystemManager(this, Logger);
|
FileSystemManager = new FileSystemManager(this, Logger, TaskManager);
|
||||||
FileSystemManager.StartWatchers();
|
FileSystemManager.StartWatchers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Library
|
namespace MediaBrowser.Controller.Library
|
||||||
{
|
{
|
||||||
|
|
|
@ -186,9 +186,9 @@ namespace MediaBrowser.Controller.Library
|
||||||
var rootFolder = Kernel.ItemRepository.RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)GetItem(rootFolderPath);
|
var rootFolder = Kernel.ItemRepository.RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)GetItem(rootFolderPath);
|
||||||
|
|
||||||
// Add in the plug-in folders
|
// Add in the plug-in folders
|
||||||
foreach (var child in Kernel.PluginFolders)
|
foreach (var child in Kernel.PluginFolderCreators)
|
||||||
{
|
{
|
||||||
rootFolder.AddVirtualChild(child);
|
rootFolder.AddVirtualChild(child.GetFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rootFolder;
|
return rootFolder;
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
using MediaBrowser.Common.Localization;
|
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Localization
|
namespace MediaBrowser.Controller.Localization
|
||||||
{
|
{
|
||||||
[Export(typeof(LocalizedStringData))]
|
|
||||||
public class BaseStrings : LocalizedStringData
|
public class BaseStrings : LocalizedStringData
|
||||||
{
|
{
|
||||||
public BaseStrings()
|
public BaseStrings()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Localization
|
namespace MediaBrowser.Controller.Localization
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class LocalizedStringData
|
/// Class LocalizedStringData
|
|
@ -1,5 +1,4 @@
|
||||||
using MediaBrowser.Common.Localization;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
<HintPath>..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll</HintPath>
|
<HintPath>..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
@ -91,6 +90,7 @@
|
||||||
<Compile Include="Entities\Genre.cs" />
|
<Compile Include="Entities\Genre.cs" />
|
||||||
<Compile Include="Entities\ICollectionFolder.cs" />
|
<Compile Include="Entities\ICollectionFolder.cs" />
|
||||||
<Compile Include="Entities\IndexFolder.cs" />
|
<Compile Include="Entities\IndexFolder.cs" />
|
||||||
|
<Compile Include="Entities\IVirtualFolderCreator.cs" />
|
||||||
<Compile Include="Entities\Movies\BoxSet.cs" />
|
<Compile Include="Entities\Movies\BoxSet.cs" />
|
||||||
<Compile Include="Entities\Movies\Movie.cs" />
|
<Compile Include="Entities\Movies\Movie.cs" />
|
||||||
<Compile Include="Entities\Person.cs" />
|
<Compile Include="Entities\Person.cs" />
|
||||||
|
@ -107,6 +107,7 @@
|
||||||
<Compile Include="Entities\CollectionFolder.cs" />
|
<Compile Include="Entities\CollectionFolder.cs" />
|
||||||
<Compile Include="Entities\Year.cs" />
|
<Compile Include="Entities\Year.cs" />
|
||||||
<Compile Include="Extensions\XmlExtensions.cs" />
|
<Compile Include="Extensions\XmlExtensions.cs" />
|
||||||
|
<Compile Include="IO\FileSystem.cs" />
|
||||||
<Compile Include="IO\FileSystemManager.cs" />
|
<Compile Include="IO\FileSystemManager.cs" />
|
||||||
<Compile Include="IO\NetworkShares.cs" />
|
<Compile Include="IO\NetworkShares.cs" />
|
||||||
<Compile Include="Library\ChildrenChangedEventArgs.cs" />
|
<Compile Include="Library\ChildrenChangedEventArgs.cs" />
|
||||||
|
@ -117,6 +118,7 @@
|
||||||
<Compile Include="Localization\AURatingsDictionary.cs" />
|
<Compile Include="Localization\AURatingsDictionary.cs" />
|
||||||
<Compile Include="Localization\BaseStrings.cs" />
|
<Compile Include="Localization\BaseStrings.cs" />
|
||||||
<Compile Include="Localization\GBRatingsDictionary.cs" />
|
<Compile Include="Localization\GBRatingsDictionary.cs" />
|
||||||
|
<Compile Include="Localization\LocalizedStringData.cs" />
|
||||||
<Compile Include="Localization\LocalizedStrings.cs" />
|
<Compile Include="Localization\LocalizedStrings.cs" />
|
||||||
<Compile Include="Localization\NLRatingsDictionary.cs" />
|
<Compile Include="Localization\NLRatingsDictionary.cs" />
|
||||||
<Compile Include="Localization\Ratings.cs" />
|
<Compile Include="Localization\Ratings.cs" />
|
||||||
|
@ -134,7 +136,7 @@
|
||||||
<Compile Include="Plugins\IPluginConfigurationPage.cs" />
|
<Compile Include="Plugins\IPluginConfigurationPage.cs" />
|
||||||
<Compile Include="Plugins\PluginSecurityManager.cs" />
|
<Compile Include="Plugins\PluginSecurityManager.cs" />
|
||||||
<Compile Include="Providers\FanartBaseProvider.cs" />
|
<Compile Include="Providers\FanartBaseProvider.cs" />
|
||||||
<Compile Include="Providers\BaseImageEnhancer.cs" />
|
<Compile Include="Providers\IImageEnhancer.cs" />
|
||||||
<Compile Include="Providers\ImagesByNameProvider.cs" />
|
<Compile Include="Providers\ImagesByNameProvider.cs" />
|
||||||
<Compile Include="Providers\MediaInfo\BaseFFMpegImageProvider.cs" />
|
<Compile Include="Providers\MediaInfo\BaseFFMpegImageProvider.cs" />
|
||||||
<Compile Include="Providers\MediaInfo\BaseFFMpegProvider.cs" />
|
<Compile Include="Providers\MediaInfo\BaseFFMpegProvider.cs" />
|
||||||
|
@ -165,7 +167,7 @@
|
||||||
<Compile Include="Providers\MediaInfo\FFMpegVideoImageProvider.cs" />
|
<Compile Include="Providers\MediaInfo\FFMpegVideoImageProvider.cs" />
|
||||||
<Compile Include="Resolvers\Audio\MusicAlbumResolver.cs" />
|
<Compile Include="Resolvers\Audio\MusicAlbumResolver.cs" />
|
||||||
<Compile Include="Resolvers\Audio\MusicArtistResolver.cs" />
|
<Compile Include="Resolvers\Audio\MusicArtistResolver.cs" />
|
||||||
<Compile Include="Resolvers\BaseResolutionIgnoreRule.cs" />
|
<Compile Include="Resolvers\IResolutionIgnoreRule.cs" />
|
||||||
<Compile Include="Resolvers\CoreResolutionIgnoreRule.cs" />
|
<Compile Include="Resolvers\CoreResolutionIgnoreRule.cs" />
|
||||||
<Compile Include="Resolvers\EntityResolutionHelper.cs" />
|
<Compile Include="Resolvers\EntityResolutionHelper.cs" />
|
||||||
<Compile Include="Resolvers\LocalTrailerResolver.cs" />
|
<Compile Include="Resolvers\LocalTrailerResolver.cs" />
|
||||||
|
@ -223,8 +225,7 @@
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i</PostBuildEvent>
|
||||||
</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
|
|
@ -4,9 +4,9 @@ using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -17,7 +17,6 @@ using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaInfo
|
namespace MediaBrowser.Controller.MediaInfo
|
||||||
{
|
{
|
||||||
|
@ -26,22 +25,6 @@ namespace MediaBrowser.Controller.MediaInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FFMpegManager : BaseManager<Kernel>
|
public class FFMpegManager : BaseManager<Kernel>
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Holds the list of new items to generate chapter image for when the NewItemTimer expires
|
|
||||||
/// </summary>
|
|
||||||
private readonly List<Video> _newlyAddedItems = new List<Video>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The amount of time to wait before generating chapter images
|
|
||||||
/// </summary>
|
|
||||||
private const int NewItemDelay = 300000;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The current new item timer
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The new item timer.</value>
|
|
||||||
private Timer NewItemTimer { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the video image cache.
|
/// Gets or sets the video image cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -96,73 +79,9 @@ namespace MediaBrowser.Controller.MediaInfo
|
||||||
AudioImageCache = new FileSystemRepository(AudioImagesDataPath);
|
AudioImageCache = new FileSystemRepository(AudioImagesDataPath);
|
||||||
SubtitleCache = new FileSystemRepository(SubtitleCachePath);
|
SubtitleCache = new FileSystemRepository(SubtitleCachePath);
|
||||||
|
|
||||||
Kernel.LibraryManager.LibraryChanged += LibraryManager_LibraryChanged;
|
|
||||||
|
|
||||||
Task.Run(() => VersionedDirectoryPath = GetVersionedDirectoryPath());
|
Task.Run(() => VersionedDirectoryPath = GetVersionedDirectoryPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles the LibraryChanged event of the LibraryManager control.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">The source of the event.</param>
|
|
||||||
/// <param name="e">The <see cref="ChildrenChangedEventArgs" /> instance containing the event data.</param>
|
|
||||||
void LibraryManager_LibraryChanged(object sender, ChildrenChangedEventArgs e)
|
|
||||||
{
|
|
||||||
var videos = e.ItemsAdded.OfType<Video>().ToList();
|
|
||||||
|
|
||||||
// Use a timer to prevent lots of these notifications from showing in a short period of time
|
|
||||||
if (videos.Count > 0)
|
|
||||||
{
|
|
||||||
lock (_newlyAddedItems)
|
|
||||||
{
|
|
||||||
_newlyAddedItems.AddRange(videos);
|
|
||||||
|
|
||||||
if (NewItemTimer == null)
|
|
||||||
{
|
|
||||||
NewItemTimer = new Timer(NewItemTimerCallback, null, NewItemDelay, Timeout.Infinite);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NewItemTimer.Change(NewItemDelay, Timeout.Infinite);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the new item timer expires
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="state">The state.</param>
|
|
||||||
private async void NewItemTimerCallback(object state)
|
|
||||||
{
|
|
||||||
List<Video> newItems;
|
|
||||||
|
|
||||||
// Lock the list and release all resources
|
|
||||||
lock (_newlyAddedItems)
|
|
||||||
{
|
|
||||||
newItems = _newlyAddedItems.ToList();
|
|
||||||
_newlyAddedItems.Clear();
|
|
||||||
|
|
||||||
NewItemTimer.Dispose();
|
|
||||||
NewItemTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limit the number of videos we generate images for
|
|
||||||
// The idea is to catch new items that are added here and there
|
|
||||||
// Mass image generation can be left to the scheduled task
|
|
||||||
foreach (var video in newItems.Where(c => c.Chapters != null).Take(3))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await PopulateChapterImages(video, CancellationToken.None, true, true).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.ErrorException("Error creating chapter images for {0}", ex, video.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Releases unmanaged and - optionally - managed resources.
|
/// Releases unmanaged and - optionally - managed resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -171,15 +90,8 @@ namespace MediaBrowser.Controller.MediaInfo
|
||||||
{
|
{
|
||||||
if (dispose)
|
if (dispose)
|
||||||
{
|
{
|
||||||
if (NewItemTimer != null)
|
|
||||||
{
|
|
||||||
NewItemTimer.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
SetErrorMode(ErrorModes.SYSTEM_DEFAULT);
|
SetErrorMode(ErrorModes.SYSTEM_DEFAULT);
|
||||||
|
|
||||||
Kernel.LibraryManager.LibraryChanged -= LibraryManager_LibraryChanged;
|
|
||||||
|
|
||||||
AudioImageCache.Dispose();
|
AudioImageCache.Dispose();
|
||||||
VideoImageCache.Dispose();
|
VideoImageCache.Dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Model.Drawing;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class BaseImageEnhancer
|
|
||||||
/// </summary>
|
|
||||||
public abstract class BaseImageEnhancer : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Return true only if the given image for the given item will be enhanced by this enhancer.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="imageType">Type of the image.</param>
|
|
||||||
/// <returns><c>true</c> if this enhancer will enhance the supplied image for the supplied item, <c>false</c> otherwise</returns>
|
|
||||||
public abstract bool Supports(BaseItem item, ImageType imageType);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the priority or order in which this enhancer should be run.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The priority.</value>
|
|
||||||
public abstract MetadataProviderPriority Priority { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return the date of the last configuration change affecting the provided baseitem and image type
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="imageType">Type of the image.</param>
|
|
||||||
/// <returns>Date of last config change</returns>
|
|
||||||
public virtual DateTime LastConfigurationChange(BaseItem item, ImageType imageType)
|
|
||||||
{
|
|
||||||
return DateTime.MinValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases unmanaged and - optionally - managed resources.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
|
||||||
protected virtual void Dispose(bool dispose)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the size of the enhanced image.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="imageType">Type of the image.</param>
|
|
||||||
/// <param name="imageIndex">Index of the image.</param>
|
|
||||||
/// <param name="originalImageSize">Size of the original image.</param>
|
|
||||||
/// <returns>ImageSize.</returns>
|
|
||||||
public virtual ImageSize GetEnhancedImageSize(BaseItem item, ImageType imageType, int imageIndex, ImageSize originalImageSize)
|
|
||||||
{
|
|
||||||
return originalImageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enhances the supplied image and returns it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="originalImage">The original image.</param>
|
|
||||||
/// <param name="imageType">Type of the image.</param>
|
|
||||||
/// <param name="imageIndex">Index of the image.</param>
|
|
||||||
/// <returns>Task{System.Drawing.Image}.</returns>
|
|
||||||
protected abstract Task<Image> EnhanceImageAsyncInternal(BaseItem item, Image originalImage, ImageType imageType, int imageIndex);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enhances the image async.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="originalImage">The original image.</param>
|
|
||||||
/// <param name="imageType">Type of the image.</param>
|
|
||||||
/// <param name="imageIndex">Index of the image.</param>
|
|
||||||
/// <returns>Task{Image}.</returns>
|
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
|
||||||
public Task<Image> EnhanceImageAsync(BaseItem item, Image originalImage, ImageType imageType, int imageIndex)
|
|
||||||
{
|
|
||||||
if (item == null || originalImage == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return EnhanceImageAsyncInternal(item, originalImage, imageType, imageIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides metadata for Folders and all subclasses by parsing folder.xml
|
/// Provides metadata for Folders and all subclasses by parsing folder.xml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class FolderProviderFromXml : BaseMetadataProvider
|
public class FolderProviderFromXml : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
55
MediaBrowser.Controller/Providers/IImageEnhancer.cs
Normal file
55
MediaBrowser.Controller/Providers/IImageEnhancer.cs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Model.Drawing;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Providers
|
||||||
|
{
|
||||||
|
public interface IImageEnhancer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Return true only if the given image for the given item will be enhanced by this enhancer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="imageType">Type of the image.</param>
|
||||||
|
/// <returns><c>true</c> if this enhancer will enhance the supplied image for the supplied item, <c>false</c> otherwise</returns>
|
||||||
|
bool Supports(BaseItem item, ImageType imageType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the priority or order in which this enhancer should be run.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The priority.</value>
|
||||||
|
MetadataProviderPriority Priority { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return the date of the last configuration change affecting the provided baseitem and image type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="imageType">Type of the image.</param>
|
||||||
|
/// <returns>Date of last config change</returns>
|
||||||
|
DateTime LastConfigurationChange(BaseItem item, ImageType imageType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the size of the enhanced image.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="imageType">Type of the image.</param>
|
||||||
|
/// <param name="imageIndex">Index of the image.</param>
|
||||||
|
/// <param name="originalImageSize">Size of the original image.</param>
|
||||||
|
/// <returns>ImageSize.</returns>
|
||||||
|
ImageSize GetEnhancedImageSize(BaseItem item, ImageType imageType, int imageIndex, ImageSize originalImageSize);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enhances the image async.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="originalImage">The original image.</param>
|
||||||
|
/// <param name="imageType">Type of the image.</param>
|
||||||
|
/// <param name="imageIndex">Index of the image.</param>
|
||||||
|
/// <returns>Task{Image}.</returns>
|
||||||
|
/// <exception cref="System.ArgumentNullException"></exception>
|
||||||
|
Task<Image> EnhanceImageAsync(BaseItem item, Image originalImage, ImageType imageType, int imageIndex);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides images for all types by looking for standard images - folder, backdrop, logo, etc.
|
/// Provides images for all types by looking for standard images - folder, backdrop, logo, etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class ImageFromMediaLocationProvider : BaseMetadataProvider
|
public class ImageFromMediaLocationProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
using System.Globalization;
|
using MediaBrowser.Common.Win32;
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Common.Win32;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides images for generic types by looking for standard images in the IBN
|
/// Provides images for generic types by looking for standard images in the IBN
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class ImagesByNameProvider : ImageFromMediaLocationProvider
|
public class ImagesByNameProvider : ImageFromMediaLocationProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses ffmpeg to create video images
|
/// Uses ffmpeg to create video images
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class FFMpegAudioImageProvider : BaseFFMpegImageProvider<Audio>
|
public class FFMpegAudioImageProvider : BaseFFMpegImageProvider<Audio>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -11,9 +10,22 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses ffmpeg to create video images
|
/// Uses ffmpeg to create video images
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class FFMpegVideoImageProvider : BaseFFMpegImageProvider<Video>
|
public class FFMpegVideoImageProvider : BaseFFMpegImageProvider<Video>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The _iso manager
|
||||||
|
/// </summary>
|
||||||
|
private readonly IIsoManager _isoManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="FFMpegVideoImageProvider" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isoManager">The iso manager.</param>
|
||||||
|
public FFMpegVideoImageProvider(IIsoManager isoManager)
|
||||||
|
{
|
||||||
|
_isoManager = isoManager;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Supportses the specified item.
|
/// Supportses the specified item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -30,7 +42,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
|
|
||||||
if (video != null)
|
if (video != null)
|
||||||
{
|
{
|
||||||
if (video.VideoType == VideoType.Iso && video.IsoType.HasValue && Kernel.Instance.IsoManager.CanMount(item.Path))
|
if (video.VideoType == VideoType.Iso && video.IsoType.HasValue && _isoManager.CanMount(item.Path))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +94,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
if (item.VideoType == VideoType.Iso)
|
if (item.VideoType == VideoType.Iso)
|
||||||
{
|
{
|
||||||
return Kernel.Instance.IsoManager.Mount(item.Path, cancellationToken);
|
return _isoManager.Mount(item.Path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NullMountTaskResult;
|
return NullMountTaskResult;
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.MediaInfo;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts audio information using ffprobe
|
/// Extracts audio information using ffprobe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class FFProbeAudioInfoProvider : BaseFFProbeProvider<Audio>
|
public class FFProbeAudioInfoProvider : BaseFFProbeProvider<Audio>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts video information using ffprobe
|
/// Extracts video information using ffprobe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class FFProbeVideoInfoProvider : BaseFFProbeProvider<Video>
|
public class FFProbeVideoInfoProvider : BaseFFProbeProvider<Video>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -32,13 +30,18 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
/// <value>The bluray examiner.</value>
|
/// <value>The bluray examiner.</value>
|
||||||
private IBlurayExaminer BlurayExaminer { get; set; }
|
private IBlurayExaminer BlurayExaminer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _iso manager
|
||||||
|
/// </summary>
|
||||||
|
private readonly IIsoManager _isoManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FFProbeVideoInfoProvider" /> class.
|
/// Initializes a new instance of the <see cref="FFProbeVideoInfoProvider" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="isoManager">The iso manager.</param>
|
||||||
/// <param name="blurayExaminer">The bluray examiner.</param>
|
/// <param name="blurayExaminer">The bluray examiner.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">blurayExaminer</exception>
|
/// <exception cref="System.ArgumentNullException">blurayExaminer</exception>
|
||||||
[ImportingConstructor]
|
public FFProbeVideoInfoProvider(IIsoManager isoManager, IBlurayExaminer blurayExaminer)
|
||||||
public FFProbeVideoInfoProvider([Import("blurayExaminer")] IBlurayExaminer blurayExaminer)
|
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
if (blurayExaminer == null)
|
if (blurayExaminer == null)
|
||||||
|
@ -47,6 +50,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
BlurayExaminer = blurayExaminer;
|
BlurayExaminer = blurayExaminer;
|
||||||
|
_isoManager = isoManager;
|
||||||
|
|
||||||
BdInfoCache = new FileSystemRepository(Path.Combine(Kernel.Instance.ApplicationPaths.CachePath, "bdinfo"));
|
BdInfoCache = new FileSystemRepository(Path.Combine(Kernel.Instance.ApplicationPaths.CachePath, "bdinfo"));
|
||||||
}
|
}
|
||||||
|
@ -76,7 +80,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
if (video.VideoType == VideoType.Iso)
|
if (video.VideoType == VideoType.Iso)
|
||||||
{
|
{
|
||||||
return Kernel.Instance.IsoManager.CanMount(item.Path);
|
return _isoManager.CanMount(item.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return video.VideoType == VideoType.VideoFile || video.VideoType == VideoType.Dvd || video.VideoType == VideoType.BluRay;
|
return video.VideoType == VideoType.VideoFile || video.VideoType == VideoType.Dvd || video.VideoType == VideoType.BluRay;
|
||||||
|
@ -101,7 +105,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
PopulateDvdStreamFiles(item, mount);
|
PopulateDvdStreamFiles(item, mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnPreFetch(item, mount);
|
base.OnPreFetch(item, mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +119,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
if (item.VideoType == VideoType.Iso)
|
if (item.VideoType == VideoType.Iso)
|
||||||
{
|
{
|
||||||
return Kernel.Instance.IsoManager.Mount(item.Path, cancellationToken);
|
return _isoManager.Mount(item.Path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.MountIsoIfNeeded(item, cancellationToken);
|
return base.MountIsoIfNeeded(item, cancellationToken);
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class FanArtMovieProvider
|
/// Class FanArtMovieProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
class FanArtMovieProvider : FanartBaseProvider
|
class FanArtMovieProvider : FanartBaseProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -29,7 +28,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MovieDbProvider
|
/// Class MovieDbProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class MovieDbProvider : BaseMetadataProvider
|
public class MovieDbProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MovieProviderFromJson
|
/// Class MovieProviderFromJson
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class MovieProviderFromJson : MovieDbProvider
|
public class MovieProviderFromJson : MovieDbProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MovieProviderFromXml
|
/// Class MovieProviderFromXml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class MovieProviderFromXml : BaseMetadataProvider
|
public class MovieProviderFromXml : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class PersonProviderFromJson
|
/// Class PersonProviderFromJson
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
class PersonProviderFromJson : TmdbPersonProvider
|
class PersonProviderFromJson : TmdbPersonProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class TmdbPersonProvider
|
/// Class TmdbPersonProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class TmdbPersonProvider : BaseMetadataProvider
|
public class TmdbPersonProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class SortNameProvider
|
/// Class SortNameProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class SortNameProvider : BaseMetadataProvider
|
public class SortNameProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class EpisodeImageFromMediaLocationProvider
|
/// Class EpisodeImageFromMediaLocationProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class EpisodeImageFromMediaLocationProvider : BaseMetadataProvider
|
public class EpisodeImageFromMediaLocationProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class EpisodeProviderFromXml
|
/// Class EpisodeProviderFromXml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class EpisodeProviderFromXml : BaseMetadataProvider
|
public class EpisodeProviderFromXml : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,7 +11,6 @@ using System.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers.TV
|
namespace MediaBrowser.Controller.Providers.TV
|
||||||
{
|
{
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
class FanArtTVProvider : FanartBaseProvider
|
class FanArtTVProvider : FanartBaseProvider
|
||||||
{
|
{
|
||||||
protected string FanArtBaseUrl = "http://api.fanart.tv/webservice/series/{0}/{1}/xml/all/1/1";
|
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.Entities;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -18,7 +17,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class RemoteEpisodeProvider
|
/// Class RemoteEpisodeProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
class RemoteEpisodeProvider : BaseMetadataProvider
|
class RemoteEpisodeProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -16,7 +15,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class RemoteSeasonProvider
|
/// Class RemoteSeasonProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
class RemoteSeasonProvider : BaseMetadataProvider
|
class RemoteSeasonProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -20,7 +19,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class RemoteSeriesProvider
|
/// Class RemoteSeriesProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
class RemoteSeriesProvider : BaseMetadataProvider
|
class RemoteSeriesProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class SeriesProviderFromXml
|
/// Class SeriesProviderFromXml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseMetadataProvider))]
|
|
||||||
public class SeriesProviderFromXml : BaseMetadataProvider
|
public class SeriesProviderFromXml : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue