jellyfin-server/MediaBrowser.Api/ApiEntryPoint.cs

99 lines
3.3 KiB
C#
Raw Normal View History

using System;
2014-12-21 19:40:37 +00:00
using MediaBrowser.Controller.Configuration;
2015-04-20 18:04:02 +00:00
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
2016-11-01 03:07:45 +00:00
using MediaBrowser.Model.Diagnostics;
2016-10-25 19:02:04 +00:00
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
2016-11-01 03:07:45 +00:00
using MediaBrowser.Model.Threading;
using System.Collections.Generic;
using System.Threading;
namespace MediaBrowser.Api
{
/// <summary>
/// Class ServerEntryPoint
/// </summary>
2013-03-08 19:14:09 +00:00
public class ApiEntryPoint : IServerEntryPoint
{
/// <summary>
/// The instance
/// </summary>
2013-03-08 19:14:09 +00:00
public static ApiEntryPoint Instance;
/// <summary>
/// Gets or sets the logger.
/// </summary>
/// <value>The logger.</value>
2016-11-10 14:41:24 +00:00
internal ILogger Logger { get; private set; }
internal IHttpResultFactory ResultFactory { get; private set; }
2013-12-22 18:58:51 +00:00
/// <summary>
/// The application paths
/// </summary>
2014-12-21 19:40:37 +00:00
private readonly IServerConfigurationManager _config;
2013-12-22 18:58:51 +00:00
private readonly ISessionManager _sessionManager;
private readonly IFileSystem _fileSystem;
2015-04-20 18:04:02 +00:00
private readonly IMediaSourceManager _mediaSourceManager;
2016-11-01 03:07:45 +00:00
public readonly ITimerFactory TimerFactory;
public readonly IProcessFactory ProcessFactory;
2016-09-25 18:39:13 +00:00
private readonly Dictionary<string, SemaphoreSlim> _transcodingLocks =
new Dictionary<string, SemaphoreSlim>();
2014-07-02 18:34:08 +00:00
/// <summary>
2013-03-08 19:14:09 +00:00
/// Initializes a new instance of the <see cref="ApiEntryPoint" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
2014-06-26 17:04:11 +00:00
/// <param name="sessionManager">The session manager.</param>
2014-12-21 19:40:37 +00:00
/// <param name="config">The configuration.</param>
2015-04-20 18:04:02 +00:00
/// <param name="fileSystem">The file system.</param>
/// <param name="mediaSourceManager">The media source manager.</param>
2016-11-10 14:41:24 +00:00
public ApiEntryPoint(ILogger logger, ISessionManager sessionManager, IServerConfigurationManager config, IFileSystem fileSystem, IMediaSourceManager mediaSourceManager, ITimerFactory timerFactory, IProcessFactory processFactory, IHttpResultFactory resultFactory)
{
Logger = logger;
_sessionManager = sessionManager;
2014-12-21 19:40:37 +00:00
_config = config;
_fileSystem = fileSystem;
2015-04-20 18:04:02 +00:00
_mediaSourceManager = mediaSourceManager;
2016-11-01 03:07:45 +00:00
TimerFactory = timerFactory;
ProcessFactory = processFactory;
2016-11-10 14:41:24 +00:00
ResultFactory = resultFactory;
Instance = this;
2016-08-09 05:10:17 +00:00
}
public static string[] Split(string value, char separator, bool removeEmpty)
2016-09-25 18:39:13 +00:00
{
if (string.IsNullOrWhiteSpace(value))
2016-09-25 18:39:13 +00:00
{
return new string[] { };
2016-09-25 18:39:13 +00:00
}
if (removeEmpty)
2016-08-09 05:10:17 +00:00
{
return value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries);
2016-08-09 05:10:17 +00:00
}
2016-03-22 03:31:35 +00:00
return value.Split(separator);
}
/// <summary>
/// Runs this instance.
/// </summary>
public void Run()
{
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
2015-04-13 19:14:37 +00:00
}
}
}