type discovery without attributes
This commit is contained in:
parent
c165f37bb9
commit
b8d5c71842
|
@ -1,11 +1,9 @@
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -59,7 +57,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class EnvironmentService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class EnvironmentService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Library;
|
|||
using MediaBrowser.Model.Connectivity;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
|
@ -13,7 +12,6 @@ namespace MediaBrowser.Api.HttpHandlers
|
|||
/// <summary>
|
||||
/// Provides a handler to set played status for an item
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
public class PlaybackCheckInHandler : BaseSerializationHandler<Kernel, UserItemDataDto>
|
||||
{
|
||||
/// <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.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Makes changes to the user's media library
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
public class UpdateMediaLibraryHandler : BaseActionHandler<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Controller.Library;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -114,7 +113,6 @@ namespace MediaBrowser.Api.Images
|
|||
/// <summary>
|
||||
/// Class ImageService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class ImageService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Api.Images
|
|||
/// <summary>
|
||||
/// Class UploadImageHandler
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
class UploadImageHandler : BaseActionHandler<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Entities;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
|
@ -96,7 +95,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class LibraryService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class LibraryService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Model.Globalization;
|
|||
using MoreLinq;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -38,7 +37,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class CulturesService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class LocalizationService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Updates;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -93,7 +92,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class PackageService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class PackageService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Model.Plugins;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class Plugin
|
||||
/// </summary>
|
||||
[Export(typeof(IPlugin))]
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -7,10 +7,8 @@ using MediaBrowser.Model.Plugins;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ServiceStack.Text.Controller;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
|
@ -119,7 +117,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class PluginsService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class PluginService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Tasks;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ServiceStack.Text.Controller;
|
||||
|
@ -83,9 +82,19 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Class ScheduledTasksService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
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>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
|
@ -93,7 +102,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <returns>IEnumerable{TaskInfo}.</returns>
|
||||
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();
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
|
@ -106,7 +115,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <returns>IEnumerable{TaskInfo}.</returns>
|
||||
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)
|
||||
{
|
||||
|
@ -124,7 +133,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <param name="request">The request.</param>
|
||||
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)
|
||||
{
|
||||
|
@ -140,7 +149,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <param name="request">The request.</param>
|
||||
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)
|
||||
{
|
||||
|
@ -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
|
||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
||||
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)
|
||||
{
|
||||
|
@ -170,7 +179,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
|
||||
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.ScheduledTasks;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -13,9 +11,14 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Class ScheduledTasksWebSocketListener
|
||||
/// </summary>
|
||||
[Export(typeof(IWebSocketListener))]
|
||||
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>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
|
@ -33,13 +36,12 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScheduledTasksWebSocketListener" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
public ScheduledTasksWebSocketListener([Import("kernel")] Kernel kernel, [Import("logger")] ILogger logger)
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
public ScheduledTasksWebSocketListener(ILogger logger, ITaskManager taskManager)
|
||||
: base(logger)
|
||||
{
|
||||
_kernel = kernel;
|
||||
TaskManager = taskManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -49,7 +51,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
|||
/// <returns>Task{IEnumerable{TaskInfo}}.</returns>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Resolvers;
|
|||
using MediaBrowser.Model.Dto;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Api.Streaming
|
|||
/// <summary>
|
||||
/// Providers a progressive streaming audio api
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
public class AudioHandler : BaseProgressiveStreamingHandler<Audio>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -859,11 +859,11 @@ namespace MediaBrowser.Api.Streaming
|
|||
{
|
||||
var video = LibraryItem as Video;
|
||||
|
||||
if (video != null && video.VideoType == VideoType.Iso &&
|
||||
video.IsoType.HasValue && Kernel.IsoManager.CanMount(video.Path))
|
||||
{
|
||||
IsoMount = await Kernel.IsoManager.Mount(video.Path, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
//if (video != null && video.VideoType == VideoType.Iso &&
|
||||
// video.IsoType.HasValue && Kernel.IsoManager.CanMount(video.Path))
|
||||
//{
|
||||
// IsoMount = await Kernel.IsoManager.Mount(video.Path, CancellationToken.None).ConfigureAwait(false);
|
||||
//}
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Net;
|
||||
|
||||
namespace MediaBrowser.Api.Streaming
|
||||
|
@ -10,7 +9,6 @@ namespace MediaBrowser.Api.Streaming
|
|||
/// <summary>
|
||||
/// Class HlsAudioPlaylistHandler
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
public class HlsAudioPlaylistHandler : BaseHlsPlaylistHandler<Audio>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Controller;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Api.Streaming
|
|||
/// <summary>
|
||||
/// Class HlsSegmentHandler
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
public class HlsSegmentHandler : BaseHandler<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Net;
|
||||
|
||||
namespace MediaBrowser.Api.Streaming
|
||||
|
@ -9,7 +8,6 @@ namespace MediaBrowser.Api.Streaming
|
|||
/// <summary>
|
||||
/// Class HlsVideoPlaylistHandler
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
public class HlsVideoPlaylistHandler : BaseHlsPlaylistHandler<Video>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Api.Streaming
|
||||
{
|
||||
/// <summary>
|
||||
/// Providers a progressive streaming video api
|
||||
/// </summary>
|
||||
[Export(typeof(IHttpServerHandler))]
|
||||
class VideoHandler : BaseProgressiveStreamingHandler<Video>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller;
|
|||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.System;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -47,7 +46,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class SystemInfoService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class SystemService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -22,7 +21,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class GenresService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class GenresService : BaseItemsByNameService<Genre>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -8,7 +8,6 @@ using MediaBrowser.Model.Entities;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -144,7 +143,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class ItemsService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class ItemsService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -27,7 +26,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class PersonsService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class PersonsService : BaseItemsByNameService<Person>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -22,7 +20,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class StudiosService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class StudiosService : BaseItemsByNameService<Studio>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -9,7 +9,6 @@ using MediaBrowser.Model.Entities;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -252,7 +251,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class UserLibraryService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class UserLibraryService : BaseRestService
|
||||
{
|
||||
public object Get(GetSpecialFeatures request)
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -23,7 +22,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class YearsService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class YearsService : BaseItemsByNameService<Year>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Dto;
|
|||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -134,7 +133,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class UsersService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class UserService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Weather;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
|
@ -24,7 +23,6 @@ namespace MediaBrowser.Api
|
|||
/// <summary>
|
||||
/// Class WeatherService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class WeatherService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Api.WebSocket
|
|||
/// <summary>
|
||||
/// Class ScheduledTasksWebSocketListener
|
||||
/// </summary>
|
||||
[Export(typeof(IWebSocketListener))]
|
||||
public class LogFileWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<string>, LogFileWebSocketState>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -36,8 +34,7 @@ namespace MediaBrowser.Api.WebSocket
|
|||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
[ImportingConstructor]
|
||||
public LogFileWebSocketListener([Import("logger")] ILogger logger, [Import("kernel")] Kernel kernel)
|
||||
public LogFileWebSocketListener(ILogger logger, Kernel kernel)
|
||||
: base(logger)
|
||||
{
|
||||
_kernel = kernel;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Api.WebSocket
|
||||
|
@ -10,7 +9,6 @@ namespace MediaBrowser.Api.WebSocket
|
|||
/// <summary>
|
||||
/// Class SystemInfoWebSocketListener
|
||||
/// </summary>
|
||||
[Export(typeof(IWebSocketListener))]
|
||||
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<SystemInfo, object>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -32,8 +30,7 @@ namespace MediaBrowser.Api.WebSocket
|
|||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
public SystemInfoWebSocketListener([Import("kernel")] Kernel kernel, [Import("logger")] ILogger logger)
|
||||
public SystemInfoWebSocketListener(Kernel kernel, ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
_kernel = kernel;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -25,7 +24,6 @@ namespace MediaBrowser.ApiInteraction.Javascript
|
|||
/// <summary>
|
||||
/// Class JavascriptApiClientService
|
||||
/// </summary>
|
||||
[Export(typeof(IRestfulService))]
|
||||
public class JavascriptApiClientService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
|
|
@ -9,9 +9,6 @@ using MediaBrowser.Model.Logging;
|
|||
using MediaBrowser.Model.System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.ComponentModel.Composition.Primitives;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -182,28 +179,14 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// Gets the list of currently loaded plugins
|
||||
/// </summary>
|
||||
/// <value>The plugins.</value>
|
||||
[ImportMany(typeof(IPlugin))]
|
||||
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>
|
||||
/// Gets the web socket listeners.
|
||||
/// </summary>
|
||||
/// <value>The web socket listeners.</value>
|
||||
public IEnumerable<IWebSocketListener> WebSocketListeners { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MEF CompositionContainer
|
||||
/// </summary>
|
||||
/// <value>The composition container.</value>
|
||||
private CompositionContainer CompositionContainer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The _HTTP manager
|
||||
/// </summary>
|
||||
|
@ -216,12 +199,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <value>The TCP manager.</value>
|
||||
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 rest services.
|
||||
/// </summary>
|
||||
|
@ -324,11 +301,17 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <value>The application host.</value>
|
||||
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>
|
||||
/// Gets the assemblies.
|
||||
/// </summary>
|
||||
/// <value>The assemblies.</value>
|
||||
public Assembly[] Assemblies { get; private set; }
|
||||
protected Assembly[] Assemblies { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all types.
|
||||
|
@ -407,7 +390,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
await OnConfigurationLoaded().ConfigureAwait(false);
|
||||
|
||||
DisposeTaskManager();
|
||||
TaskManager = new TaskManager(this, Logger);
|
||||
TaskManager = new TaskManager(Logger);
|
||||
|
||||
Logger.Info("Loading Plugins");
|
||||
await ReloadComposableParts().ConfigureAwait(false);
|
||||
|
@ -453,8 +436,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
ComposeParts(AllTypes);
|
||||
|
||||
await OnComposablePartsLoaded().ConfigureAwait(false);
|
||||
|
||||
CompositionContainer.Catalog.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -465,11 +446,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
{
|
||||
var concreteTypes = allTypes.Where(t => t.IsClass && !t.IsAbstract && !t.IsInterface && !t.IsGenericType).ToArray();
|
||||
|
||||
CompositionContainer = GetSafeCompositionContainer(concreteTypes.Select(i => new TypeCatalog(i)));
|
||||
|
||||
RegisterExportedValues(CompositionContainer);
|
||||
|
||||
CompositionContainer.ComposeParts(this);
|
||||
RegisterExportedValues();
|
||||
|
||||
FindParts(concreteTypes);
|
||||
}
|
||||
|
@ -482,6 +459,11 @@ namespace MediaBrowser.Common.Kernel
|
|||
{
|
||||
RestServices = GetExports<IRestfulService>(allTypes);
|
||||
WebSocketListeners = GetExports<IWebSocketListener>(allTypes);
|
||||
Plugins = GetExports<IPlugin>(allTypes);
|
||||
|
||||
var tasks = GetExports<IScheduledTask>(allTypes, false);
|
||||
|
||||
TaskManager.AddTasks(tasks);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -489,8 +471,9 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// </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)
|
||||
protected IEnumerable<T> GetExports<T>(Type[] allTypes, bool manageLiftime = true)
|
||||
{
|
||||
var currentType = typeof(T);
|
||||
|
||||
|
@ -498,7 +481,10 @@ namespace MediaBrowser.Common.Kernel
|
|||
|
||||
var parts = allTypes.Where(currentType.IsAssignableFrom).Select(Instantiate).Cast<T>().ToArray();
|
||||
|
||||
_disposableParts.AddRange(parts.OfType<IDisposable>());
|
||||
if (manageLiftime)
|
||||
{
|
||||
_disposableParts.AddRange(parts.OfType<IDisposable>());
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
@ -517,13 +503,10 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// Composes the exported values.
|
||||
/// </summary>
|
||||
/// <param name="container">The container.</param>
|
||||
protected virtual void RegisterExportedValues(CompositionContainer container)
|
||||
protected virtual void RegisterExportedValues()
|
||||
{
|
||||
ApplicationHost.Register<IKernel>(this);
|
||||
|
||||
container.ComposeExportedValue("logger", Logger);
|
||||
container.ComposeExportedValue("appHost", ApplicationHost);
|
||||
container.ComposeExportedValue("isoManager", ApplicationHost.Resolve<IIsoManager>());
|
||||
ApplicationHost.Register(TaskManager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -590,46 +573,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
yield return GetType().Assembly;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
private 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
|
||||
|
@ -663,11 +606,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
foreach (var task in ScheduledTasks)
|
||||
{
|
||||
task.Initialize(this, Logger);
|
||||
}
|
||||
|
||||
// Start-up each plugin
|
||||
Parallel.ForEach(Plugins, plugin =>
|
||||
{
|
||||
|
@ -722,11 +660,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
|
||||
DisposeComposableParts();
|
||||
|
||||
foreach (var part in _disposableParts)
|
||||
{
|
||||
part.Dispose();
|
||||
}
|
||||
|
||||
_disposableParts.Clear();
|
||||
}
|
||||
}
|
||||
|
@ -772,9 +705,9 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// </summary>
|
||||
protected virtual void DisposeComposableParts()
|
||||
{
|
||||
if (CompositionContainer != null)
|
||||
foreach (var part in _disposableParts)
|
||||
{
|
||||
CompositionContainer.Dispose();
|
||||
part.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,13 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns>``0.</returns>
|
||||
T Resolve<T>() where T : class;
|
||||
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.Plugins;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Kernel
|
||||
|
@ -69,12 +67,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <returns>SystemInfo.</returns>
|
||||
SystemInfo GetSystemInfo();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scheduled tasks.
|
||||
/// </summary>
|
||||
/// <value>The scheduled tasks.</value>
|
||||
IEnumerable<IScheduledTask> ScheduledTasks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the logger.
|
||||
/// </summary>
|
||||
|
@ -133,12 +125,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <value>The TCP manager.</value>
|
||||
TcpManager TcpManager { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the task manager.
|
||||
/// </summary>
|
||||
/// <value>The task manager.</value>
|
||||
TaskManager TaskManager { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the web socket listeners.
|
||||
/// </summary>
|
||||
|
@ -160,12 +146,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// </summary>
|
||||
event EventHandler<EventArgs> ConfigurationUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the assemblies.
|
||||
/// </summary>
|
||||
/// <value>The assemblies.</value>
|
||||
Assembly[] Assemblies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rest services.
|
||||
/// </summary>
|
||||
|
|
|
@ -89,7 +89,6 @@
|
|||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
|
@ -125,7 +124,6 @@
|
|||
<Compile Include="Events\GenericEventArgs.cs" />
|
||||
<Compile Include="Extensions\NamedLock.cs" />
|
||||
<Compile Include="Extensions\ResourceNotFoundException.cs" />
|
||||
<Compile Include="IO\FileSystem.cs" />
|
||||
<Compile Include="IO\FileSystemRepository.cs" />
|
||||
<Compile Include="IO\IIsoManager.cs" />
|
||||
<Compile Include="IO\IIsoMount.cs" />
|
||||
|
@ -138,7 +136,6 @@
|
|||
<Compile Include="Kernel\IApplicationHost.cs" />
|
||||
<Compile Include="Kernel\IKernel.cs" />
|
||||
<Compile Include="Kernel\TcpManager.cs" />
|
||||
<Compile Include="Localization\LocalizedStringData.cs" />
|
||||
<Compile Include="Net\AlchemyWebSocket.cs" />
|
||||
<Compile Include="Net\BaseRestService.cs" />
|
||||
<Compile Include="Net\Handlers\BaseActionHandler.cs" />
|
||||
|
@ -146,6 +143,7 @@
|
|||
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
|
||||
<Compile Include="Net\HttpManager.cs" />
|
||||
<Compile Include="Net\IRestfulService.cs" />
|
||||
<Compile Include="Net\IUdpServer.cs" />
|
||||
<Compile Include="Net\IWebSocket.cs" />
|
||||
<Compile Include="Net\MimeTypes.cs" />
|
||||
<Compile Include="Net\NativeWebSocket.cs" />
|
||||
|
@ -161,6 +159,7 @@
|
|||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ScheduledTasks\ITaskManager.cs" />
|
||||
<Compile Include="ScheduledTasks\TaskManager.cs" />
|
||||
<Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
|
||||
<Compile Include="ScheduledTasks\ScheduledTaskHelpers.cs" />
|
||||
|
|
|
@ -4,6 +4,7 @@ using MediaBrowser.Common.Kernel;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using ServiceStack.Api.Swagger;
|
||||
using ServiceStack.Common.Web;
|
||||
using ServiceStack.Configuration;
|
||||
using ServiceStack.Logging.NLogger;
|
||||
using ServiceStack.ServiceHost;
|
||||
using ServiceStack.ServiceInterface.Cors;
|
||||
|
@ -153,6 +154,8 @@ namespace MediaBrowser.Common.Net
|
|||
DebugMode = true
|
||||
});
|
||||
}
|
||||
|
||||
container.Adapter = new ContainerAdapter(ApplicationHost);
|
||||
|
||||
container.Register(Kernel);
|
||||
container.Register(_logger);
|
||||
|
@ -464,4 +467,23 @@ namespace MediaBrowser.Common.Net
|
|||
/// <value>The endpoint.</value>
|
||||
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>
|
||||
/// <typeparam name="TKernelType">The type of the T kernel type.</typeparam>
|
||||
public abstract class BaseScheduledTask<TKernelType> : IScheduledTask
|
||||
where TKernelType : IKernel
|
||||
where TKernelType : class, IKernel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the kernel.
|
||||
|
@ -25,6 +25,47 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// <value>The kernel.</value>
|
||||
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>
|
||||
/// The _last execution result
|
||||
/// </summary>
|
||||
|
@ -199,7 +240,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
try
|
||||
{
|
||||
return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(ConfigurationFilePath)
|
||||
.Select(t => ScheduledTaskHelpers.GetTrigger(t, Kernel))
|
||||
.Select(ScheduledTaskHelpers.GetTrigger)
|
||||
.ToList();
|
||||
}
|
||||
catch (IOException)
|
||||
|
@ -228,7 +269,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
|
||||
_triggersInitialized = true;
|
||||
|
||||
ReloadTriggerEvents();
|
||||
ReloadTriggerEvents(false);
|
||||
|
||||
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>
|
||||
/// Reloads the trigger events.
|
||||
/// </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)
|
||||
{
|
||||
|
@ -320,7 +343,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
|
||||
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);
|
||||
|
||||
Kernel.TaskManager.QueueScheduledTask(this);
|
||||
TaskManager.QueueScheduledTask(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -392,7 +415,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
CurrentCancellationTokenSource = null;
|
||||
CurrentProgress = null;
|
||||
|
||||
Kernel.TaskManager.OnTaskCompleted(this);
|
||||
TaskManager.OnTaskCompleted(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -27,13 +27,13 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
Start();
|
||||
Start(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </summary>
|
||||
protected internal abstract void Start();
|
||||
protected internal abstract void Start(bool isApplicationStartup);
|
||||
|
||||
/// <summary>
|
||||
/// Stops waiting for the trigger action
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </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();
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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>
|
||||
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>
|
||||
/// Cancels if running.
|
||||
/// </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>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </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();
|
||||
|
||||
|
|
|
@ -78,11 +78,10 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger
|
||||
/// </summary>
|
||||
/// <param name="info">The info.</param>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <returns>BaseTaskTrigger.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></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))
|
||||
{
|
||||
|
@ -144,7 +143,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
|
||||
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new StartupTrigger(kernel);
|
||||
return new StartupTrigger();
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unrecognized trigger type: " + info.Type);
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.ScheduledTasks
|
||||
{
|
||||
|
@ -9,34 +7,18 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// </summary>
|
||||
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>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </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)
|
||||
{
|
||||
await Task.Delay(2000).ConfigureAwait(false);
|
||||
|
||||
OnTriggered();
|
||||
OnTriggered();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -44,7 +26,6 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// </summary>
|
||||
protected internal override void Stop()
|
||||
{
|
||||
Kernel.ReloadCompleted -= Kernel_ReloadCompleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </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)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -10,8 +9,14 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Class TaskManager
|
||||
/// </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>
|
||||
/// The _task queue
|
||||
/// </summary>
|
||||
|
@ -25,12 +30,17 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TaskManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public TaskManager(IKernel kernel, ILogger logger)
|
||||
: base(kernel)
|
||||
public TaskManager(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentException("logger");
|
||||
}
|
||||
|
||||
_logger = logger;
|
||||
|
||||
ScheduledTasks = new IScheduledTask[] {};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,7 +50,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
public void CancelIfRunningAndQueue<T>()
|
||||
where T : IScheduledTask
|
||||
{
|
||||
Kernel.ScheduledTasks.OfType<T>().First().CancelIfRunning();
|
||||
ScheduledTasks.OfType<T>().First().CancelIfRunning();
|
||||
QueueScheduledTask<T>();
|
||||
}
|
||||
|
||||
|
@ -51,7 +61,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
public void QueueScheduledTask<T>()
|
||||
where T : IScheduledTask
|
||||
{
|
||||
var scheduledTask = Kernel.ScheduledTasks.OfType<T>().First();
|
||||
var scheduledTask = ScheduledTasks.OfType<T>().First();
|
||||
|
||||
QueueScheduledTask(scheduledTask);
|
||||
}
|
||||
|
@ -64,7 +74,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
{
|
||||
var type = task.GetType();
|
||||
|
||||
var scheduledTask = Kernel.ScheduledTasks.First(t => t.GetType() == type);
|
||||
var scheduledTask = ScheduledTasks.First(t => t.GetType() == type);
|
||||
|
||||
lock (_taskQueue)
|
||||
{
|
||||
|
@ -91,7 +101,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// Called when [task completed].
|
||||
/// </summary>
|
||||
/// <param name="task">The task.</param>
|
||||
internal void OnTaskCompleted(IScheduledTask task)
|
||||
public void OnTaskCompleted(IScheduledTask task)
|
||||
{
|
||||
// Execute queued tasks
|
||||
lock (_taskQueue)
|
||||
|
@ -100,7 +110,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -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.Model.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -13,9 +12,19 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
|||
/// <summary>
|
||||
/// Deletes old cache files
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
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>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -13,9 +12,19 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
|||
/// <summary>
|
||||
/// Deletes old log files
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
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>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -11,9 +10,19 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
|||
/// <summary>
|
||||
/// Class ReloadLoggerFileTask
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
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>
|
||||
/// Gets the default triggers.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -10,7 +10,6 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
|||
/// <summary>
|
||||
/// Plugin Update Task
|
||||
/// </summary>
|
||||
[Export(typeof(IScheduledTask))]
|
||||
public class SystemUpdateTask : BaseScheduledTask<IKernel>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -22,8 +21,11 @@ namespace MediaBrowser.Common.ScheduledTasks.Tasks
|
|||
/// Initializes a new instance of the <see cref="SystemUpdateTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="appHost">The app host.</param>
|
||||
[ImportingConstructor]
|
||||
public SystemUpdateTask([Import("appHost")] IApplicationHost appHost)
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <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;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </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();
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.ScheduledTasks;
|
||||
|
@ -66,16 +67,27 @@ namespace MediaBrowser.Controller.IO
|
|||
/// <value>The logger.</value>
|
||||
private ILogger Logger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the task manager.
|
||||
/// </summary>
|
||||
/// <value>The task manager.</value>
|
||||
private ITaskManager TaskManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoryWatchers" /> class.
|
||||
/// </summary>
|
||||
public DirectoryWatchers(ILogger logger)
|
||||
public DirectoryWatchers(ILogger logger, ITaskManager taskManager)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
if (taskManager == null)
|
||||
{
|
||||
throw new ArgumentNullException("taskManager");
|
||||
}
|
||||
|
||||
TaskManager = taskManager;
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
|
@ -421,7 +433,7 @@ namespace MediaBrowser.Controller.IO
|
|||
// If the root folder changed, run the library task so the user can see it
|
||||
if (itemsToRefresh.Any(i => i is AggregateFolder))
|
||||
{
|
||||
Kernel.Instance.TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||
TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ using System.IO;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Common.IO
|
||||
namespace MediaBrowser.Controller.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FileSystem
|
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
|
@ -26,17 +27,18 @@ namespace MediaBrowser.Controller.IO
|
|||
/// The _logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileSystemManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public FileSystemManager(Kernel kernel, ILogger logger)
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
public FileSystemManager(Kernel kernel, ILogger logger, ITaskManager taskManager)
|
||||
: base(kernel)
|
||||
{
|
||||
_logger = logger;
|
||||
DirectoryWatchers = new DirectoryWatchers(logger);
|
||||
DirectoryWatchers = new DirectoryWatchers(logger, taskManager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
@ -17,14 +15,10 @@ using MediaBrowser.Controller.ScheduledTasks;
|
|||
using MediaBrowser.Controller.Updates;
|
||||
using MediaBrowser.Controller.Weather;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -183,7 +177,6 @@ namespace MediaBrowser.Controller
|
|||
/// Gets the list of Localized string files
|
||||
/// </summary>
|
||||
/// <value>The string files.</value>
|
||||
[ImportMany(typeof(LocalizedStringData))]
|
||||
public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -208,7 +201,6 @@ namespace MediaBrowser.Controller
|
|||
/// Gets the list of currently registered metadata prvoiders
|
||||
/// </summary>
|
||||
/// <value>The metadata providers enumerable.</value>
|
||||
[ImportMany(typeof(BaseMetadataProvider))]
|
||||
public BaseMetadataProvider[] MetadataProviders { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -222,8 +214,7 @@ namespace MediaBrowser.Controller
|
|||
/// Gets the list of currently registered entity resolvers
|
||||
/// </summary>
|
||||
/// <value>The entity resolvers enumerable.</value>
|
||||
[ImportMany(typeof(IBaseItemResolver))]
|
||||
internal IBaseItemResolver[] EntityResolvers { get; private set; }
|
||||
internal IEnumerable<IBaseItemResolver> EntityResolvers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of BasePluginFolders added by plugins
|
||||
|
@ -322,14 +313,11 @@ namespace MediaBrowser.Controller
|
|||
/// <summary>
|
||||
/// Composes the exported values.
|
||||
/// </summary>
|
||||
/// <param name="container">The container.</param>
|
||||
protected override void RegisterExportedValues(CompositionContainer container)
|
||||
protected override void RegisterExportedValues()
|
||||
{
|
||||
container.ComposeExportedValue("kernel", this);
|
||||
|
||||
ApplicationHost.Register(this);
|
||||
|
||||
base.RegisterExportedValues(container);
|
||||
base.RegisterExportedValues();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -338,6 +326,15 @@ namespace MediaBrowser.Controller
|
|||
/// <param name="allTypes">All types.</param>
|
||||
protected override void FindParts(Type[] allTypes)
|
||||
{
|
||||
InstallationManager = (InstallationManager)ApplicationHost.CreateInstance(typeof(InstallationManager));
|
||||
FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager));
|
||||
LibraryManager = (LibraryManager)ApplicationHost.CreateInstance(typeof(LibraryManager));
|
||||
UserManager = (UserManager)ApplicationHost.CreateInstance(typeof(UserManager));
|
||||
ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager));
|
||||
ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager));
|
||||
UserDataManager = (UserDataManager)ApplicationHost.CreateInstance(typeof(UserDataManager));
|
||||
PluginSecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager));
|
||||
|
||||
base.FindParts(allTypes);
|
||||
|
||||
EntityResolutionIgnoreRules = GetExports<IResolutionIgnoreRule>(allTypes);
|
||||
|
@ -348,8 +345,11 @@ namespace MediaBrowser.Controller
|
|||
WeatherProviders = GetExports<IWeatherProvider>(allTypes);
|
||||
IntroProviders = GetExports<IIntroProvider>(allTypes);
|
||||
PluginConfigurationPages = GetExports<IPluginConfigurationPage>(allTypes);
|
||||
ImageEnhancers = GetExports<IImageEnhancer>(allTypes);
|
||||
ImageEnhancers = GetExports<IImageEnhancer>(allTypes).OrderBy(e => e.Priority).ToArray();
|
||||
PluginFolderCreators = GetExports<IVirtualFolderCreator>(allTypes);
|
||||
StringFiles = GetExports<LocalizedStringData>(allTypes);
|
||||
EntityResolvers = GetExports<IBaseItemResolver>(allTypes).OrderBy(e => e.Priority).ToArray();
|
||||
MetadataProviders = GetExports<BaseMetadataProvider>(allTypes).OrderBy(e => e.Priority).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -365,14 +365,6 @@ namespace MediaBrowser.Controller
|
|||
await base.ReloadInternal().ConfigureAwait(false);
|
||||
|
||||
ReloadResourcePools();
|
||||
InstallationManager = (InstallationManager)ApplicationHost.CreateInstance(typeof(InstallationManager));
|
||||
FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager));
|
||||
LibraryManager = (LibraryManager)ApplicationHost.CreateInstance(typeof(LibraryManager));
|
||||
UserManager = (UserManager)ApplicationHost.CreateInstance(typeof(UserManager));
|
||||
ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager));
|
||||
ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager));
|
||||
UserDataManager = (UserDataManager)ApplicationHost.CreateInstance(typeof(UserDataManager));
|
||||
PluginSecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager));
|
||||
|
||||
ReloadFileSystemManager();
|
||||
|
||||
|
@ -441,15 +433,6 @@ namespace MediaBrowser.Controller
|
|||
DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository);
|
||||
var displayPreferencesRepoTask = DisplayPreferencesRepository.Initialize();
|
||||
|
||||
// Sort the resolvers by priority
|
||||
EntityResolvers = EntityResolvers.OrderBy(e => e.Priority).ToArray();
|
||||
|
||||
// Sort the providers by priority
|
||||
MetadataProviders = MetadataProviders.OrderBy(e => e.Priority).ToArray();
|
||||
|
||||
// Sort the image processors by priority
|
||||
ImageEnhancers = ImageEnhancers.OrderBy(e => e.Priority).ToArray();
|
||||
|
||||
await Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -488,7 +471,7 @@ namespace MediaBrowser.Controller
|
|||
{
|
||||
DisposeFileSystemManager();
|
||||
|
||||
FileSystemManager = new FileSystemManager(this, Logger);
|
||||
FileSystemManager = new FileSystemManager(this, Logger, TaskManager);
|
||||
FileSystemManager.StartWatchers();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using MediaBrowser.Common.Localization;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
|
||||
namespace MediaBrowser.Controller.Localization
|
||||
{
|
||||
[Export(typeof(LocalizedStringData))]
|
||||
public class BaseStrings : LocalizedStringData
|
||||
{
|
||||
public BaseStrings()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MediaBrowser.Common.Localization
|
||||
namespace MediaBrowser.Controller.Localization
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LocalizedStringData
|
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
<HintPath>..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
@ -108,6 +107,7 @@
|
|||
<Compile Include="Entities\CollectionFolder.cs" />
|
||||
<Compile Include="Entities\Year.cs" />
|
||||
<Compile Include="Extensions\XmlExtensions.cs" />
|
||||
<Compile Include="IO\FileSystem.cs" />
|
||||
<Compile Include="IO\FileSystemManager.cs" />
|
||||
<Compile Include="IO\NetworkShares.cs" />
|
||||
<Compile Include="Library\ChildrenChangedEventArgs.cs" />
|
||||
|
@ -118,6 +118,7 @@
|
|||
<Compile Include="Localization\AURatingsDictionary.cs" />
|
||||
<Compile Include="Localization\BaseStrings.cs" />
|
||||
<Compile Include="Localization\GBRatingsDictionary.cs" />
|
||||
<Compile Include="Localization\LocalizedStringData.cs" />
|
||||
<Compile Include="Localization\LocalizedStrings.cs" />
|
||||
<Compile Include="Localization\NLRatingsDictionary.cs" />
|
||||
<Compile Include="Localization\Ratings.cs" />
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// <summary>
|
||||
/// Provides metadata for Folders and all subclasses by parsing folder.xml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FolderProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// <summary>
|
||||
/// Provides images for all types by looking for standard images - folder, backdrop, logo, etc.
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class ImageFromMediaLocationProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
using System.Globalization;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// <summary>
|
||||
/// Provides images for generic types by looking for standard images in the IBN
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class ImagesByNameProvider : ImageFromMediaLocationProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||
/// <summary>
|
||||
/// Uses ffmpeg to create video images
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFMpegAudioImageProvider : BaseFFMpegImageProvider<Audio>
|
||||
{
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||
/// <summary>
|
||||
/// Uses ffmpeg to create video images
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFMpegVideoImageProvider : BaseFFMpegImageProvider<Video>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -23,8 +21,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||
/// Initializes a new instance of the <see cref="FFMpegVideoImageProvider" /> class.
|
||||
/// </summary>
|
||||
/// <param name="isoManager">The iso manager.</param>
|
||||
[ImportingConstructor]
|
||||
public FFMpegVideoImageProvider([Import("isoManager")] IIsoManager isoManager)
|
||||
public FFMpegVideoImageProvider(IIsoManager isoManager)
|
||||
{
|
||||
_isoManager = isoManager;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.MediaInfo;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||
/// <summary>
|
||||
/// Extracts audio information using ffprobe
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFProbeAudioInfoProvider : BaseFFProbeProvider<Audio>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||
/// <summary>
|
||||
/// Extracts video information using ffprobe
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class FFProbeVideoInfoProvider : BaseFFProbeProvider<Video>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -43,8 +41,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||
/// <param name="isoManager">The iso manager.</param>
|
||||
/// <param name="blurayExaminer">The bluray examiner.</param>
|
||||
/// <exception cref="System.ArgumentNullException">blurayExaminer</exception>
|
||||
[ImportingConstructor]
|
||||
public FFProbeVideoInfoProvider([Import("isoManager")] IIsoManager isoManager, [Import("blurayExaminer")] IBlurayExaminer blurayExaminer)
|
||||
public FFProbeVideoInfoProvider(IIsoManager isoManager, IBlurayExaminer blurayExaminer)
|
||||
: base()
|
||||
{
|
||||
if (blurayExaminer == null)
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.Movies;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
/// <summary>
|
||||
/// Class FanArtMovieProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class FanArtMovieProvider : FanartBaseProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Logging;
|
|||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -29,7 +28,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
/// <summary>
|
||||
/// Class MovieDbProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class MovieDbProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
/// <summary>
|
||||
/// Class MovieProviderFromJson
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class MovieProviderFromJson : MovieDbProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
/// <summary>
|
||||
/// Class MovieProviderFromXml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class MovieProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Serialization;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
/// <summary>
|
||||
/// Class PersonProviderFromJson
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class PersonProviderFromJson : TmdbPersonProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -17,7 +16,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
/// <summary>
|
||||
/// Class TmdbPersonProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class TmdbPersonProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// <summary>
|
||||
/// Class SortNameProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class SortNameProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <summary>
|
||||
/// Class EpisodeImageFromMediaLocationProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class EpisodeImageFromMediaLocationProvider : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <summary>
|
||||
/// Class EpisodeProviderFromXml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class EpisodeProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.TV;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -12,7 +11,6 @@ using System.Xml;
|
|||
|
||||
namespace MediaBrowser.Controller.Providers.TV
|
||||
{
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class FanArtTVProvider : FanartBaseProvider
|
||||
{
|
||||
protected string FanArtBaseUrl = "http://api.fanart.tv/webservice/series/{0}/{1}/xml/all/1/1";
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Resolvers.TV;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -18,7 +17,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <summary>
|
||||
/// Class RemoteEpisodeProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class RemoteEpisodeProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -16,7 +15,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <summary>
|
||||
/// Class RemoteSeasonProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class RemoteSeasonProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
@ -20,7 +19,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <summary>
|
||||
/// Class RemoteSeriesProvider
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
class RemoteSeriesProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -12,7 +11,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <summary>
|
||||
/// Class SeriesProviderFromXml
|
||||
/// </summary>
|
||||
[Export(typeof(BaseMetadataProvider))]
|
||||
public class SeriesProviderFromXml : BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Audio
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class AudioResolver
|
||||
/// </summary>
|
||||
public class AudioResolver : BaseItemResolver<Entities.Audio.Audio>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Last; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Entities.Audio.Audio.</returns>
|
||||
protected override Entities.Audio.Audio Resolve(ItemResolveArgs args)
|
||||
{
|
||||
// Return audio if the path is a file and has a matching extension
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Audio
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class MusicAlbumResolver
|
||||
/// </summary>
|
||||
public class MusicAlbumResolver : BaseItemResolver<MusicAlbum>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>MusicAlbum.</returns>
|
||||
protected override MusicAlbum Resolve(ItemResolveArgs args)
|
||||
{
|
||||
if (!args.IsDirectory) return null;
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Audio
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class MusicArtistResolver
|
||||
/// </summary>
|
||||
public class MusicArtistResolver : BaseItemResolver<MusicArtist>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>MusicArtist.</returns>
|
||||
protected override MusicArtist Resolve(ItemResolveArgs args)
|
||||
{
|
||||
if (!args.IsDirectory) return null;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
|
@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
/// <summary>
|
||||
/// Provides the core resolver ignore rules
|
||||
/// </summary>
|
||||
[Export(typeof(IResolutionIgnoreRule))]
|
||||
public class CoreResolutionIgnoreRule : IResolutionIgnoreRule
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -27,6 +25,11 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
"extrafanart"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Shoulds the ignore.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
public bool ShouldIgnore(ItemResolveArgs args)
|
||||
{
|
||||
// Ignore hidden files and folders
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FolderResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class FolderResolver : BaseFolderResolver<Folder>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
|
@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
/// <summary>
|
||||
/// Class LocalTrailerResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class LocalTrailerResolver : BaseVideoResolver<Trailer>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
|
@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Resolvers.Movies
|
|||
/// <summary>
|
||||
/// Class BoxSetResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class BoxSetResolver : BaseFolderResolver<BoxSet>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Controller.Providers.Movies;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
|
@ -14,7 +13,6 @@ namespace MediaBrowser.Controller.Resolvers.Movies
|
|||
/// <summary>
|
||||
/// Class MovieResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class MovieResolver : BaseVideoResolver<Movie>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
using System;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.ComponentModel.Composition;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class EpisodeResolver
|
||||
/// </summary>
|
||||
public class EpisodeResolver : BaseVideoResolver<Episode>
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Episode.</returns>
|
||||
protected override Episode Resolve(ItemResolveArgs args)
|
||||
{
|
||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
||||
|
@ -40,6 +46,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the initial item values.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
protected override void SetInitialItemValues(Episode item, ItemResolveArgs args)
|
||||
{
|
||||
base.SetInitialItemValues(item, args);
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
/// <summary>
|
||||
/// Class SeasonResolver
|
||||
/// </summary>
|
||||
public class SeasonResolver : BaseFolderResolver<Season>
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Season.</returns>
|
||||
protected override Season Resolve(ItemResolveArgs args)
|
||||
{
|
||||
if (args.Parent is Series && args.IsDirectory)
|
||||
|
@ -21,6 +27,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the initial item values.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
protected override void SetInitialItemValues(Season item, ItemResolveArgs args)
|
||||
{
|
||||
base.SetInitialItemValues(item, args);
|
||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities.TV;
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
|
@ -11,7 +10,6 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
/// <summary>
|
||||
/// Class SeriesResolver
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class SeriesResolver : BaseFolderResolver<Series>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
|
@ -10,7 +9,6 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
/// <summary>
|
||||
/// Resolves a Path into a Video
|
||||
/// </summary>
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class VideoResolver : BaseVideoResolver<Video>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,18 +1,29 @@
|
|||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.ScheduledTasks
|
||||
{
|
||||
[Export(typeof(IScheduledTask))]
|
||||
/// <summary>
|
||||
/// Class ChapterImagesTask
|
||||
/// </summary>
|
||||
class ChapterImagesTask : BaseScheduledTask<Kernel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChapterImagesTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger"></param>
|
||||
public ChapterImagesTask(Kernel kernel, ITaskManager taskManager, ILogger logger)
|
||||
: base(kernel, taskManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// </summary>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user