jellyfin/MediaBrowser.Api/ApiEntryPoint.cs

99 lines
3.3 KiB
C#
Raw Normal View History

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