public RokuSessionController(IHttpClient httpClient, IJsonSerializer json, IServerApplicationHost appHost, SessionInfo session)
 {
     _httpClient = httpClient;
     _json = json;
     _appHost = appHost;
     Session = session;
 }
Beispiel #2
0
        /// <summary>
        /// Opens the dashboard page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="appHost">The app host.</param>
        /// <param name="logger">The logger.</param>
        public static void OpenDashboardPage(string page, IServerApplicationHost appHost, ILogger logger)
        {
            var url = "http://localhost:" + appHost.HttpServerPort + "/" +
                      appHost.WebApplicationName + "/web/" + page;

            OpenUrl(url, logger);
        }
Beispiel #3
0
 public SatIpHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient, IServerApplicationHost appHost)
     : base(config, logger, jsonSerializer, mediaEncoder)
 {
     _fileSystem = fileSystem;
     _httpClient = httpClient;
     _appHost = appHost;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StartupWizard" /> class.
 /// </summary>
 /// <param name="appHost">The app host.</param>
 /// <param name="userManager">The user manager.</param>
 public StartupWizard(IServerApplicationHost appHost, IUserManager userManager, IServerConfigurationManager configurationManager, ILogger logger)
 {
     _appHost = appHost;
     _logger = logger;
     _userManager = userManager;
     _configurationManager = configurationManager;
 }
Beispiel #5
0
 public M3uParser(ILogger logger, IFileSystem fileSystem, IHttpClient httpClient, IServerApplicationHost appHost)
 {
     _logger = logger;
     _fileSystem = fileSystem;
     _httpClient = httpClient;
     _appHost = appHost;
 }
 public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager)
 {
     _appHost = appHost;
     _logger = logger;
     _iTaskManager = iTaskManager;
     _sessionManager = sessionManager;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="jsonSerializer"></param>
 /// <param name="userManager"></param>
 /// <param name="userDataManager"> </param>
 /// <param name="httpClient"></param>
 /// <param name="appHost"></param>
 /// <param name="fileSystem"></param>
 public SyncFromTraktTask(ILogManager logger, IJsonSerializer jsonSerializer, IUserManager userManager, IUserDataManager userDataManager, IHttpClient httpClient, IServerApplicationHost appHost, IFileSystem fileSystem)
 {
     _userManager = userManager;
     _userDataManager = userDataManager;
     _logger = logger.GetLogger("Trakt");
     _traktApi = new TraktApi(jsonSerializer, _logger, httpClient, appHost, userDataManager, fileSystem);
 }
 public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config, ISsdpHandler ssdp)
 {
     _logger = logmanager.GetLogger("PortMapper");
     _appHost = appHost;
     _config = config;
     _ssdp = ssdp;
 }
Beispiel #9
0
 public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery)
 {
     _logger = logmanager.GetLogger("PortMapper");
     _appHost = appHost;
     _config = config;
     _deviceDiscovery = deviceDiscovery;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow" /> class.
        /// </summary>
        /// <param name="logManager">The log manager.</param>
        /// <param name="appHost">The app host.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <param name="userManager">The user manager.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="displayPreferencesManager">The display preferences manager.</param>
        /// <exception cref="System.ArgumentNullException">logger</exception>
        public MainWindow(ILogManager logManager, IServerApplicationHost appHost, IServerConfigurationManager configurationManager, IUserManager userManager, ILibraryManager libraryManager, IJsonSerializer jsonSerializer, IDisplayPreferencesRepository displayPreferencesManager)
        {
            if (logManager == null)
            {
                throw new ArgumentNullException("logManager");
            }
            if (appHost == null)
            {
                throw new ArgumentNullException("appHost");
            }
            if (configurationManager == null)
            {
                throw new ArgumentNullException("configurationManager");
            }

            _logger = logManager.GetLogger("MainWindow");
            _appHost = appHost;
            _logManager = logManager;
            _configurationManager = configurationManager;
            _userManager = userManager;
            _libraryManager = libraryManager;
            _jsonSerializer = jsonSerializer;
            _displayPreferencesManager = displayPreferencesManager;

            InitializeComponent();

            Loaded += MainWindowLoaded;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionWebSocketListener" /> class.
 /// </summary>
 /// <param name="sessionManager">The session manager.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="dtoService">The dto service.</param>
 public SessionWebSocketListener(ISessionManager sessionManager, ILogManager logManager, IDtoService dtoService, IServerApplicationHost appHost)
 {
     _sessionManager = sessionManager;
     _logger = logManager.GetLogger(GetType().Name);
     _dtoService = dtoService;
     _appHost = appHost;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionWebSocketListener" /> class.
 /// </summary>
 /// <param name="sessionManager">The session manager.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="appHost">The application host.</param>
 public SessionWebSocketListener(ISessionManager sessionManager, ILogManager logManager, IServerApplicationHost appHost, IJsonSerializer json)
 {
     _sessionManager = sessionManager;
     _logger = logManager.GetLogger(GetType().Name);
     _appHost = appHost;
     _json = json;
 }
Beispiel #13
0
        /// <summary>
        /// Opens the dashboard page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="loggedInUser">The logged in user.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <param name="appHost">The app host.</param>
        /// <param name="logger">The logger.</param>
        public static void OpenDashboardPage(string page, User loggedInUser, IServerConfigurationManager configurationManager, IServerApplicationHost appHost, ILogger logger)
        {
            var url = "http://localhost:" + configurationManager.Configuration.HttpServerPortNumber + "/" +
                      appHost.WebApplicationName + "/dashboard/" + page;

            OpenUrl(url, logger);
        }
Beispiel #14
0
 public DlnaEntryPoint(IServerConfigurationManager config, 
     ILogManager logManager, 
     IServerApplicationHost appHost, 
     INetworkManager network, 
     ISessionManager sessionManager, 
     IHttpClient httpClient, 
     ILibraryManager libraryManager, 
     IUserManager userManager, 
     IDlnaManager dlnaManager, 
     IImageProcessor imageProcessor, 
     IUserDataManager userDataManager, 
     ILocalizationManager localization, 
     IMediaSourceManager mediaSourceManager, 
     ISsdpHandler ssdpHandler)
 {
     _config = config;
     _appHost = appHost;
     _network = network;
     _sessionManager = sessionManager;
     _httpClient = httpClient;
     _libraryManager = libraryManager;
     _userManager = userManager;
     _dlnaManager = dlnaManager;
     _imageProcessor = imageProcessor;
     _userDataManager = userDataManager;
     _localization = localization;
     _mediaSourceManager = mediaSourceManager;
     _ssdpHandler = (SsdpHandler)ssdpHandler;
     _logger = logManager.GetLogger("Dlna");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="networkManager">The network manager.</param>
 /// <param name="appHost">The application host.</param>
 /// <param name="json">The json.</param>
 public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerApplicationHost appHost, IJsonSerializer json)
 {
     _logger = logger;
     _networkManager = networkManager;
     _appHost = appHost;
     _json = json;
 }
Beispiel #16
0
 public SharingManager(SharingRepository repository, IServerConfigurationManager config, ILibraryManager libraryManager, IServerApplicationHost appHost)
 {
     _repository = repository;
     _config = config;
     _libraryManager = libraryManager;
     _appHost = appHost;
 }
Beispiel #17
0
 public MultiProviderSync(SyncManager syncManager, IServerApplicationHost appHost, ILogger logger, IFileSystem fileSystem, IConfigurationManager config)
 {
     _syncManager = syncManager;
     _appHost = appHost;
     _logger = logger;
     _fileSystem = fileSystem;
     _config = config;
 }
 public ServerSyncScheduledTask(ISyncManager syncManager, ILogger logger, IFileSystem fileSystem, IServerApplicationHost appHost, IConfigurationManager config)
 {
     _syncManager = syncManager;
     _logger = logger;
     _fileSystem = fileSystem;
     _appHost = appHost;
     _config = config;
 }
Beispiel #19
0
        public DeviceDiscovery(ILogger logger, IServerConfigurationManager config, IServerApplicationHost appHost)
        {
            _tokenSource = new CancellationTokenSource();

            _logger = logger;
            _config = config;
            _appHost = appHost;
        }
Beispiel #20
0
 public MediaSync(ILogger logger, ISyncManager syncManager, IServerApplicationHost appHost, IFileSystem fileSystem, IConfigurationManager config)
 {
     _logger = logger;
     _syncManager = syncManager;
     _appHost = appHost;
     _fileSystem = fileSystem;
     _config = config;
 }
        public ExternalPortForwarding(ILogger logger, IServerApplicationHost appHost, IServerConfigurationManager config)
        {
            _logger = logger;
            _appHost = appHost;
            _config = config;

            _config.ConfigurationUpdated += _config_ConfigurationUpdated;
        }
Beispiel #22
0
 public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename)
 {
     _config = config;
     _appHost = appHost;
     _httpClient = httpClient;
     _jsonSerializer = jsonSerializer;
     _releaseAssetFilename = releaseAssetFilename;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UdpServerEntryPoint"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="networkManager">The network manager.</param>
 /// <param name="serverConfigurationManager">The server configuration manager.</param>
 /// <param name="httpServer">The HTTP server.</param>
 public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer, IServerApplicationHost appHost, IJsonSerializer json)
 {
     _logger = logger;
     _networkManager = networkManager;
     _serverConfigurationManager = serverConfigurationManager;
     _httpServer = httpServer;
     _appHost = appHost;
     _json = json;
 }
 public LiveTvMediaSourceProvider(ILiveTvManager liveTvManager, IJsonSerializer jsonSerializer, ILogManager logManager, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, IServerApplicationHost appHost)
 {
     _liveTvManager = liveTvManager;
     _jsonSerializer = jsonSerializer;
     _mediaSourceManager = mediaSourceManager;
     _mediaEncoder = mediaEncoder;
     _appHost = appHost;
     _logger = logManager.GetLogger(GetType().Name);
 }
Beispiel #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebSocketEvents" /> class.
 /// </summary>
 /// <param name="serverManager">The server manager.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="userManager">The user manager.</param>
 public WebSocketEvents(IServerManager serverManager, IServerApplicationHost appHost, ILogger logger, IUserManager userManager, IInstallationManager installationManager, ITaskManager taskManager)
 {
     _serverManager = serverManager;
     _logger = logger;
     _userManager = userManager;
     _installationManager = installationManager;
     _appHost = appHost;
     _taskManager = taskManager;
 }
 public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager)
 {
     _appHost = appHost;
     _logger = logger;
     _iTaskManager = iTaskManager;
     _sessionManager = sessionManager;
     _config = config;
     _liveTvManager = liveTvManager;
 }
Beispiel #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebSocketEvents" /> class.
 /// </summary>
 /// <param name="serverManager">The server manager.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="userManager">The user manager.</param>
 public WebSocketEvents(IServerManager serverManager, IServerApplicationHost appHost, IUserManager userManager, IInstallationManager installationManager, ITaskManager taskManager, IDtoService dtoService)
 {
     _serverManager = serverManager;
     _userManager = userManager;
     _installationManager = installationManager;
     _appHost = appHost;
     _taskManager = taskManager;
     _dtoService = dtoService;
 }
Beispiel #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UdpServer" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="networkManager">The network manager.</param>
        /// <param name="appHost">The application host.</param>
        /// <param name="json">The json.</param>
        public UdpServer(ILogger logger, INetworkManager networkManager, IServerApplicationHost appHost, IJsonSerializer json)
        {
            _logger = logger;
            _networkManager = networkManager;
            _appHost = appHost;
            _json = json;

            AddMessageResponder("who is EmbyServer?", true, RespondToV2Message);
            AddMessageResponder("who is MediaBrowserServer_v2?", false, RespondToV2Message);
        }
 public TraktApi(IJsonSerializer jsonSerializer, ILogger logger, IHttpClient httpClient,
     IServerApplicationHost appHost, IUserDataManager userDataManager, IFileSystem fileSystem)
 {
     _httpClient = httpClient;
     _appHost = appHost;
     _userDataManager = userDataManager;
     _fileSystem = fileSystem;
     _jsonSerializer = jsonSerializer;
     _logger = logger;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerEventNotifier" /> class.
 /// </summary>
 /// <param name="serverManager">The server manager.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="userManager">The user manager.</param>
 public ServerEventNotifier(IServerManager serverManager, IServerApplicationHost appHost, IUserManager userManager, IInstallationManager installationManager, ITaskManager taskManager, IDtoService dtoService, ISessionManager sessionManager)
 {
     _serverManager = serverManager;
     _userManager = userManager;
     _installationManager = installationManager;
     _appHost = appHost;
     _taskManager = taskManager;
     _dtoService = dtoService;
     _sessionManager = sessionManager;
 }
Beispiel #31
0
 public HdHomerunUdpStream(
     MediaSourceInfo mediaSource,
     TunerHostInfo tunerHostInfo,
     string originalStreamId,
     IHdHomerunChannelCommands channelCommands,
     int numTuners,
     IFileSystem fileSystem,
     ILogger logger,
     IConfigurationManager configurationManager,
     IServerApplicationHost appHost,
     IStreamHelper streamHelper)
     : base(mediaSource, tunerHostInfo, fileSystem, logger, configurationManager, streamHelper)
 {
     _appHost            = appHost;
     OriginalStreamId    = originalStreamId;
     _channelCommands    = channelCommands;
     _numTuners          = numTuners;
     EnableStreamSharing = true;
 }
Beispiel #32
0
 public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func <IDtoService> dtoService, IServerApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func <IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func <ISubtitleEncoder> subtitleEncoder, IConfigurationManager config, IUserDataManager userDataManager, Func <IMediaSourceManager> mediaSourceManager, IJsonSerializer json, ITaskManager taskManager)
 {
     _libraryManager     = libraryManager;
     _repo               = repo;
     _imageProcessor     = imageProcessor;
     _logger             = logger;
     _userManager        = userManager;
     _dtoService         = dtoService;
     _appHost            = appHost;
     _tvSeriesManager    = tvSeriesManager;
     _mediaEncoder       = mediaEncoder;
     _fileSystem         = fileSystem;
     _subtitleEncoder    = subtitleEncoder;
     _config             = config;
     _userDataManager    = userDataManager;
     _mediaSourceManager = mediaSourceManager;
     _json               = json;
     _taskManager        = taskManager;
 }
        public ConnectManager(ILogger logger,
                              IApplicationPaths appPaths,
                              IJsonSerializer json,
                              IEncryptionManager encryption,
                              IHttpClient httpClient,
                              IServerApplicationHost appHost,
                              IServerConfigurationManager config, IUserManager userManager)
        {
            _logger      = logger;
            _appPaths    = appPaths;
            _json        = json;
            _encryption  = encryption;
            _httpClient  = httpClient;
            _appHost     = appHost;
            _config      = config;
            _userManager = userManager;

            LoadCachedData();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationEntryPoint" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="activityManager">The activity manager.</param>
        /// <param name="localization">The localization manager.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <param name="appHost">The application host.</param>
        /// <param name="config">The configuration manager.</param>
        public NotificationEntryPoint(
            ILogger <NotificationEntryPoint> logger,
            IActivityManager activityManager,
            ILocalizationManager localization,
            INotificationManager notificationManager,
            ILibraryManager libraryManager,
            IServerApplicationHost appHost,
            IConfigurationManager config)
        {
            _logger              = logger;
            _activityManager     = activityManager;
            _localization        = localization;
            _notificationManager = notificationManager;
            _libraryManager      = libraryManager;
            _appHost             = appHost;
            _config              = config;

            _coreNotificationTypes = new CoreNotificationTypes(localization).GetNotificationTypes().Select(i => i.Type).ToArray();
        }
Beispiel #35
0
        public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func <IImageProcessor> imageProcessorFactory, Func <IDtoService> dtoServiceFactory, Func <IConnectManager> connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ICryptoProvider cryptographyProvider, string defaultUserName)
        {
            _logger                = logger;
            UserRepository         = userRepository;
            _xmlSerializer         = xmlSerializer;
            _networkManager        = networkManager;
            _imageProcessorFactory = imageProcessorFactory;
            _dtoServiceFactory     = dtoServiceFactory;
            _connectFactory        = connectFactory;
            _appHost               = appHost;
            _jsonSerializer        = jsonSerializer;
            _fileSystem            = fileSystem;
            _cryptographyProvider  = cryptographyProvider;
            _defaultUserName       = defaultUserName;
            ConfigurationManager   = configurationManager;
            Users = new List <User>();

            DeletePinFile();
        }
        /// <summary>
        /// Gets the dashboard info.
        /// </summary>
        /// <param name="appHost">The app host.</param>
        /// <param name="taskManager">The task manager.</param>
        /// <param name="connectionManager">The connection manager.</param>
        /// <returns>DashboardInfo.</returns>
        public static DashboardInfo GetDashboardInfo(IServerApplicationHost appHost,
                                                     ITaskManager taskManager,
                                                     ISessionManager connectionManager)
        {
            var connections = connectionManager.Sessions.Where(i => i.IsActive).ToArray();

            return(new DashboardInfo
            {
                SystemInfo = appHost.GetSystemInfo(),

                RunningTasks = taskManager.ScheduledTasks.Where(i => i.State == TaskState.Running || i.State == TaskState.Cancelling)
                               .Select(ScheduledTaskHelpers.GetTaskInfo)
                               .ToArray(),

                ApplicationUpdateTaskId = taskManager.ScheduledTasks.First(t => t.ScheduledTask.GetType().Name.Equals("SystemUpdateTask", StringComparison.OrdinalIgnoreCase)).Id,

                ActiveConnections = connections.Select(SessionInfoDtoBuilder.GetSessionInfoDto).ToArray()
            });
        }
Beispiel #37
0
        /// <summary>
        /// Configures the app builder for the webhost.
        /// </summary>
        /// <param name="app">The application builder.</param>
        /// <param name="env">The webhost environment.</param>
        /// <param name="serverApplicationHost">The server application host.</param>
        public void Configure(
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IServerApplicationHost serverApplicationHost)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMiddleware <ExceptionMiddleware>();

            app.UseMiddleware <ResponseTimeMiddleware>();

            app.UseWebSockets();

            app.UseResponseCompression();

            // TODO app.UseMiddleware<WebSocketMiddleware>();

            app.UseAuthentication();
            app.UseJellyfinApiSwagger(_serverConfigurationManager);
            app.UseRouting();
            app.UseCors(ServerCorsPolicy.DefaultPolicyName);
            app.UseAuthorization();
            if (_serverConfigurationManager.Configuration.EnableMetrics)
            {
                // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad
                app.UseHttpMetrics();
            }

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                if (_serverConfigurationManager.Configuration.EnableMetrics)
                {
                    endpoints.MapMetrics(_serverConfigurationManager.Configuration.BaseUrl.TrimStart('/') + "/metrics");
                }
            });

            app.Use(serverApplicationHost.ExecuteHttpHandlerAsync);
        }
Beispiel #38
0
        public HttpListenerHost(IServerApplicationHost applicationHost,
                                ILogger logger,
                                IServerConfigurationManager config,
                                string defaultRedirectPath, INetworkManager networkManager, ITextEncoding textEncoding, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, Func <Type, Func <string, object> > funcParseFn)
        {
            Instance = this;

            _appHost            = applicationHost;
            DefaultRedirectPath = defaultRedirectPath;
            _networkManager     = networkManager;
            _textEncoding       = textEncoding;
            _jsonSerializer     = jsonSerializer;
            _xmlSerializer      = xmlSerializer;
            _config             = config;

            _logger      = logger;
            _funcParseFn = funcParseFn;

            ResponseFilters = new Action <IRequest, IResponse, object>[] { };
        }
Beispiel #39
0
        public TaskCreatePlaylists(ILogManager logger,
                                   IPlaylistManager playlistman,
                                   IServerApplicationHost appHost,
                                   ILibraryManager libraryManager,
                                   IServerConfigurationManager config,
                                   IFileSystem fileSystem)
        {
            _logger         = logger.GetLogger("PlaybackReporting - CreatePlaylists");
            _playlistman    = playlistman;
            _appHost        = appHost;
            _libraryManager = libraryManager;
            _config         = config;
            _fileSystem     = fileSystem;

            if (VersionCheck.IsVersionValid(_appHost.ApplicationVersion, _appHost.SystemUpdateLevel) == false)
            {
                _logger.Info("ERROR : Plugin not compatible with this server version");
                throw new NotImplementedException("This task is not available on this version of Emby");
            }
        }
Beispiel #40
0
        public HdHomerunHost(
            IServerConfigurationManager config,
            ILogger <HdHomerunHost> logger,
            IFileSystem fileSystem,
            IHttpClientFactory httpClientFactory,
            IServerApplicationHost appHost,
            ISocketFactory socketFactory,
            INetworkManager networkManager,
            IStreamHelper streamHelper,
            IMemoryCache memoryCache)
            : base(config, logger, fileSystem, memoryCache)
        {
            _httpClientFactory = httpClientFactory;
            _appHost           = appHost;
            _socketFactory     = socketFactory;
            _networkManager    = networkManager;
            _streamHelper      = streamHelper;

            _jsonOptions = JsonDefaults.Options;
        }
Beispiel #41
0
        public EntryPoint(
            ILoggerFactory logger,
            ISessionManager sessionManager,
            IUserDataManager userDataManager,
            IUserManager userManager,
            IDtoService dtoService,
            IServerApplicationHost appHost,
            IHttpClientFactory httpClientFactory
            )
        {
            _logger          = logger.CreateLogger("Webhooks");
            _sessionManager  = sessionManager;
            _userDataManager = userDataManager;
            _userManager     = userManager;
            _appHost         = appHost;

            _scrobbled     = new List <Guid>();
            _deviceStates  = new Dictionary <string, DeviceState>();
            _formatFactory = new FormatFactory(httpClientFactory, dtoService, _userManager);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="jsonSerializer"></param>
        /// <param name="sessionManager"> </param>
        /// <param name="userDataManager"></param>
        /// <param name="libraryManager"> </param>
        /// <param name="logger"></param>
        /// <param name="httpClient"></param>
        /// <param name="appHost"></param>
        /// <param name="fileSystem"></param>
        public ServerMediator(
            IJsonSerializer jsonSerializer,
            ISessionManager sessionManager,
            IUserDataManager userDataManager,
            ILibraryManager libraryManager,
            ILoggerFactory logger,
            IHttpClient httpClient,
            IServerApplicationHost appHost,
            IFileSystem fileSystem)
        {
            Instance         = this;
            _sessionManager  = sessionManager;
            _libraryManager  = libraryManager;
            _userDataManager = userDataManager;
            _logger          = logger.CreateLogger("Trakt");

            _traktApi = new TraktApi(jsonSerializer, _logger, httpClient, appHost, userDataManager, fileSystem);
            _libraryManagerEventsHelper  = new LibraryManagerEventsHelper(_logger, _traktApi);
            _userDataManagerEventsHelper = new UserDataManagerEventsHelper(_logger, _traktApi);
        }
Beispiel #43
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="jsonSerializer"></param>
        /// <param name="sessionManager"> </param>
        /// <param name="userDataManager"></param>
        /// <param name="libraryManager"> </param>
        /// <param name="logger"></param>
        /// <param name="httpClient"></param>
        /// <param name="appHost"></param>
        /// <param name="fileSystem"></param>
        public ServerMediator(
            IJsonSerializer jsonSerializer,
            ISessionManager sessionManager,
            IUserDataManager userDataManager,
            ILibraryManager libraryManager,
            ILoggerFactory loggerFactory,
            IHttpClientFactory httpClientFactory,
            IServerApplicationHost appHost,
            IFileSystem fileSystem)
        {
            _sessionManager  = sessionManager;
            _libraryManager  = libraryManager;
            _userDataManager = userDataManager;

            _logger = loggerFactory.CreateLogger <ServerMediator>();

            _traktApi = new TraktApi(jsonSerializer, loggerFactory.CreateLogger <TraktApi>(), httpClientFactory, appHost, userDataManager, fileSystem);
            _libraryManagerEventsHelper  = new LibraryManagerEventsHelper(loggerFactory.CreateLogger <LibraryManagerEventsHelper>(), _traktApi);
            _userDataManagerEventsHelper = new UserDataManagerEventsHelper(loggerFactory.CreateLogger <UserDataManagerEventsHelper>(), _traktApi);
        }
Beispiel #44
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerManager" /> class.
        /// </summary>
        /// <param name="applicationHost">The application host.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <exception cref="System.ArgumentNullException">applicationHost</exception>
        public ServerManager(IServerApplicationHost applicationHost, IJsonSerializer jsonSerializer, ILogger logger, IServerConfigurationManager configurationManager)
        {
            if (applicationHost == null)
            {
                throw new ArgumentNullException("applicationHost");
            }
            if (jsonSerializer == null)
            {
                throw new ArgumentNullException("jsonSerializer");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _logger              = logger;
            _jsonSerializer      = jsonSerializer;
            _applicationHost     = applicationHost;
            ConfigurationManager = configurationManager;
        }
Beispiel #45
0
 public SessionsService(
     ILogger <SessionsService> logger,
     IServerConfigurationManager serverConfigurationManager,
     IHttpResultFactory httpResultFactory,
     ISessionManager sessionManager,
     IServerApplicationHost appHost,
     IUserManager userManager,
     IAuthorizationContext authContext,
     IAuthenticationRepository authRepo,
     IDeviceManager deviceManager,
     ISessionContext sessionContext)
     : base(logger, serverConfigurationManager, httpResultFactory)
 {
     _sessionManager = sessionManager;
     _userManager    = userManager;
     _authContext    = authContext;
     _authRepo       = authRepo;
     _deviceManager  = deviceManager;
     _sessionContext = sessionContext;
     _appHost        = appHost;
 }
Beispiel #46
0
        public HttpListenerHost(
            IServerApplicationHost applicationHost,
            ILoggerFactory loggerFactory,
            IServerConfigurationManager config,
            IConfiguration configuration,
            INetworkManager networkManager,
            IJsonSerializer jsonSerializer,
            IXmlSerializer xmlSerializer)
        {
            _appHost            = applicationHost;
            _logger             = loggerFactory.CreateLogger("HttpServer");
            _config             = config;
            DefaultRedirectPath = configuration["HttpListenerHost:DefaultRedirectPath"];
            _networkManager     = networkManager;
            _jsonSerializer     = jsonSerializer;
            _xmlSerializer      = xmlSerializer;

            _funcParseFn = t => s => JsvReader.GetParseFn(t)(s);

            Instance        = this;
            ResponseFilters = Array.Empty <Action <IRequest, IResponse, object> >();
        }
Beispiel #47
0
 public UserManager(
     ILogger <UserManager> logger,
     IUserRepository userRepository,
     IXmlSerializer xmlSerializer,
     INetworkManager networkManager,
     Func <IImageProcessor> imageProcessorFactory,
     Func <IDtoService> dtoServiceFactory,
     IServerApplicationHost appHost,
     IJsonSerializer jsonSerializer,
     IFileSystem fileSystem)
 {
     _logger                = logger;
     _userRepository        = userRepository;
     _xmlSerializer         = xmlSerializer;
     _networkManager        = networkManager;
     _imageProcessorFactory = imageProcessorFactory;
     _dtoServiceFactory     = dtoServiceFactory;
     _appHost               = appHost;
     _jsonSerializer        = jsonSerializer;
     _fileSystem            = fileSystem;
     _users = null;
 }
Beispiel #48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataViewerService" /> class.
 /// </summary>
 /// <param name="httpClient">The HTTP client.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="libraryMonitor">The directory watchers.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="fileSystem">The file system.</param>
 public MovieOrganizerService(
     IServerConfigurationManager config,
     ILogManager logManager,
     IFileSystem fileSystem,
     IServerApplicationHost appHost,
     ILibraryMonitor libraryMonitor,
     ILibraryManager libraryManager,
     ILocalizationManager localizationManager,
     IServerManager serverManager,
     IProviderManager providerManager,
     IFileOrganizationService fileOrganizationService)
 {
     _logger                  = logManager.GetLogger("MovieOrganizer");
     _config                  = config;
     _fileSystem              = fileSystem;
     _libraryMonitor          = libraryMonitor;
     _libraryManager          = libraryManager;
     _localizationManager     = localizationManager;
     _serverManager           = serverManager;
     _providerManager         = providerManager;
     _fileOrganizationService = fileOrganizationService;
 }
Beispiel #49
0
        public ConnectManager(ILogger logger,
                              IApplicationPaths appPaths,
                              IJsonSerializer json,
                              IEncryptionManager encryption,
                              IHttpClient httpClient,
                              IServerApplicationHost appHost,
                              IServerConfigurationManager config, IUserManager userManager, IProviderManager providerManager, ISecurityManager securityManager, IFileSystem fileSystem)
        {
            _logger          = logger;
            _appPaths        = appPaths;
            _json            = json;
            _encryption      = encryption;
            _httpClient      = httpClient;
            _appHost         = appHost;
            _config          = config;
            _userManager     = userManager;
            _providerManager = providerManager;
            _securityManager = securityManager;
            _fileSystem      = fileSystem;

            LoadCachedData();
        }
        public HttpListenerHost(
            IServerApplicationHost applicationHost,
            ILogger <HttpListenerHost> logger,
            IServerConfigurationManager config,
            IConfiguration configuration,
            INetworkManager networkManager,
            ILocalizationManager localizationManager,
            IHostEnvironment hostEnvironment,
            ILoggerFactory loggerFactory)
        {
            _appHost             = applicationHost;
            _logger              = logger;
            _config              = config;
            _defaultRedirectPath = configuration[DefaultRedirectKey];
            _baseUrlPrefix       = _config.Configuration.BaseUrl;
            _networkManager      = networkManager;
            _hostEnvironment     = hostEnvironment;
            _loggerFactory       = loggerFactory;

            Instance       = this;
            GlobalResponse = localizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerManager" /> class.
        /// </summary>
        /// <param name="applicationHost">The application host.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <exception cref="System.ArgumentNullException">applicationHost</exception>
        public ServerManager(IServerApplicationHost applicationHost, IJsonSerializer jsonSerializer, ILogger logger, IServerConfigurationManager configurationManager, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding)
        {
            if (applicationHost == null)
            {
                throw new ArgumentNullException("applicationHost");
            }
            if (jsonSerializer == null)
            {
                throw new ArgumentNullException("jsonSerializer");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _logger               = logger;
            _jsonSerializer       = jsonSerializer;
            _applicationHost      = applicationHost;
            ConfigurationManager  = configurationManager;
            _memoryStreamProvider = memoryStreamProvider;
            _textEncoding         = textEncoding;
        }
Beispiel #52
0
        public HttpListenerHost(
            IServerApplicationHost applicationHost,
            ILoggerFactory loggerFactory,
            IServerConfigurationManager config,
            string defaultRedirectPath,
            INetworkManager networkManager,
            IJsonSerializer jsonSerializer,
            IXmlSerializer xmlSerializer,
            Func <Type, Func <string, object> > funcParseFn)
        {
            _appHost            = applicationHost;
            _logger             = loggerFactory.CreateLogger("HttpServer");
            _config             = config;
            DefaultRedirectPath = defaultRedirectPath;
            _networkManager     = networkManager;
            _jsonSerializer     = jsonSerializer;
            _xmlSerializer      = xmlSerializer;
            _funcParseFn        = funcParseFn;

            Instance        = this;
            ResponseFilters = Array.Empty <Action <IRequest, IResponse, object> >();
        }
Beispiel #53
0
        /// <summary>
        /// Creates the server.
        /// </summary>
        /// <returns>IHttpServer.</returns>
        public static IHttpServer CreateServer(IServerApplicationHost applicationHost,
                                               ILogManager logManager,
                                               IServerConfigurationManager config,
                                               INetworkManager networkmanager,
                                               IMemoryStreamFactory streamProvider,
                                               string serverName,
                                               string defaultRedirectpath,
                                               ITextEncoding textEncoding,
                                               ISocketFactory socketFactory,
                                               ICryptoProvider cryptoProvider,
                                               IJsonSerializer json,
                                               IXmlSerializer xml,
                                               IEnvironmentInfo environment,
                                               ICertificate certificate,
                                               IFileSystem fileSystem,
                                               bool enableDualModeSockets)
        {
            var logger = logManager.GetLogger("HttpServer");

            return(new HttpListenerHost(applicationHost,
                                        logger,
                                        config,
                                        serverName,
                                        defaultRedirectpath,
                                        networkmanager,
                                        streamProvider,
                                        textEncoding,
                                        socketFactory,
                                        cryptoProvider,
                                        json,
                                        xml,
                                        environment,
                                        certificate,
                                        new StreamFactory(),
                                        GetParseFn,
                                        enableDualModeSockets,
                                        fileSystem));
        }
Beispiel #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ActivityLogEntryPoint"/> class.
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="sessionManager"></param>
 /// <param name="deviceManager"></param>
 /// <param name="taskManager"></param>
 /// <param name="activityManager"></param>
 /// <param name="localization"></param>
 /// <param name="installationManager"></param>
 /// <param name="subManager"></param>
 /// <param name="userManager"></param>
 /// <param name="appHost"></param>
 public ActivityLogEntryPoint(
     ILogger <ActivityLogEntryPoint> logger,
     ISessionManager sessionManager,
     IDeviceManager deviceManager,
     ITaskManager taskManager,
     IActivityManager activityManager,
     ILocalizationManager localization,
     IInstallationManager installationManager,
     ISubtitleManager subManager,
     IUserManager userManager,
     IServerApplicationHost appHost)
 {
     _logger              = logger;
     _sessionManager      = sessionManager;
     _deviceManager       = deviceManager;
     _taskManager         = taskManager;
     _activityManager     = activityManager;
     _localization        = localization;
     _installationManager = installationManager;
     _subManager          = subManager;
     _userManager         = userManager;
     _appHost             = appHost;
 }
Beispiel #55
0
 public HdHomerunUdpStream(
     MediaSourceInfo mediaSource,
     TunerHostInfo tunerHostInfo,
     string originalStreamId,
     IHdHomerunChannelCommands channelCommands,
     int numTuners,
     IFileSystem fileSystem,
     IHttpClient httpClient,
     ILogger logger,
     IServerApplicationPaths appPaths,
     IServerApplicationHost appHost,
     MediaBrowser.Model.Net.ISocketFactory socketFactory,
     INetworkManager networkManager)
     : base(mediaSource, tunerHostInfo, fileSystem, logger, appPaths)
 {
     _appHost            = appHost;
     _socketFactory      = socketFactory;
     _networkManager     = networkManager;
     OriginalStreamId    = originalStreamId;
     _channelCommands    = channelCommands;
     _numTuners          = numTuners;
     EnableStreamSharing = true;
 }
Beispiel #56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPnPPlugin"/> class.
 /// </summary>
 /// <param name="applicationPaths">The <see cref="IApplicationPaths"/>.</param>
 /// <param name="xmlSerializer">The <see cref="IXmlSerializer"/>.</param>
 /// <param name="appHost">The <see cref="IServerApplicationHost"/>.</param>
 /// <param name="config">The <see cref="IServerConfigurationManager"/>.</param>
 /// <param name="networkManager">The <see cref="INetworkManager"/>.</param>
 /// <param name="logger">The <see cref="ILogger{UPnPPlugin}"/>.</param>
 public UPnPPlugin(
     IApplicationPaths applicationPaths,
     IXmlSerializer xmlSerializer,
     IServerApplicationHost appHost,
     IServerConfigurationManager config,
     INetworkManager networkManager,
     ILogger <UPnPPlugin> logger)
     : base(applicationPaths, xmlSerializer)
 {
     _instance         = this;
     _lock             = new object();
     _logger           = logger;
     _appHost          = appHost;
     _config           = config;
     _networkConfig    = config.GetNetworkConfiguration();
     _networkManager   = networkManager;
     _devices          = new List <INatDevice>();
     _configIdentifier = GetConfigIdentifier();
     Mono.Nat.Logging.Logger.Factory = GetLogger;
     UpdateConfiguration(Configuration);
     _config.NamedConfigurationUpdated += OnSystemConfigurationUpdated;
     Start();
 }
Beispiel #57
0
 public UserManager(
     ILogger <UserManager> logger,
     IUserRepository userRepository,
     IXmlSerializer xmlSerializer,
     INetworkManager networkManager,
     IImageProcessor imageProcessor,
     Lazy <IDtoService> dtoServiceFactory,
     IServerApplicationHost appHost,
     IJsonSerializer jsonSerializer,
     IFileSystem fileSystem,
     ICryptoProvider cryptoProvider)
 {
     _logger            = logger;
     _userRepository    = userRepository;
     _xmlSerializer     = xmlSerializer;
     _networkManager    = networkManager;
     _imageProcessor    = imageProcessor;
     _dtoServiceFactory = dtoServiceFactory;
     _appHost           = appHost;
     _jsonSerializer    = jsonSerializer;
     _fileSystem        = fileSystem;
     _cryptoProvider    = cryptoProvider;
     _users             = null;
 }
        public TaskNotifictionUserReport(IActivityManager activity,
                                         ILogManager logger,
                                         IServerConfigurationManager config,
                                         IFileSystem fileSystem,
                                         IServerApplicationHost appHost,
                                         INotificationManager notificationManager,
                                         IUserManager userManager)
        {
            _logger              = logger.GetLogger("UserActivityReportNotification - TaskNotifictionReport");
            _activity            = activity;
            _config              = config;
            _fileSystem          = fileSystem;
            _notificationManager = notificationManager;
            _userManager         = userManager;
            _appHost             = appHost;

            if (VersionCheck.IsVersionValid(_appHost.ApplicationVersion, _appHost.SystemUpdateLevel) == false)
            {
                _logger.Info("ERROR : Plugin not compatible with this server version");
                throw new NotImplementedException("This task is not available on this version of Emby");
            }

            _logger.Info("UserActivityReportNotification Loaded");
        }
Beispiel #59
0
 public UserManager(
     ILoggerFactory loggerFactory,
     IServerConfigurationManager configurationManager,
     IUserRepository userRepository,
     IXmlSerializer xmlSerializer,
     INetworkManager networkManager,
     Func <IImageProcessor> imageProcessorFactory,
     Func <IDtoService> dtoServiceFactory,
     IServerApplicationHost appHost,
     IJsonSerializer jsonSerializer,
     IFileSystem fileSystem)
 {
     _logger                = loggerFactory.CreateLogger(nameof(UserManager));
     UserRepository         = userRepository;
     _xmlSerializer         = xmlSerializer;
     _networkManager        = networkManager;
     _imageProcessorFactory = imageProcessorFactory;
     _dtoServiceFactory     = dtoServiceFactory;
     _appHost               = appHost;
     _jsonSerializer        = jsonSerializer;
     _fileSystem            = fileSystem;
     ConfigurationManager   = configurationManager;
     _users = Array.Empty <User>();
 }
        /// <summary>
        /// Gets the dashboard info.
        /// </summary>
        /// <param name="appHost">The app host.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="taskManager">The task manager.</param>
        /// <param name="userManager">The user manager.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <returns>DashboardInfo.</returns>
        public static async Task <DashboardInfo> GetDashboardInfo(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, ILibraryManager libraryManager)
        {
            var connections = userManager.RecentConnections.ToArray();

            var dtoBuilder = new DtoBuilder(logger, libraryManager);

            var tasks = userManager.Users.Where(u => connections.Any(c => c.UserId == u.Id)).Select(dtoBuilder.GetUserDto);
            var users = await Task.WhenAll(tasks).ConfigureAwait(false);

            return(new DashboardInfo
            {
                SystemInfo = appHost.GetSystemInfo(),

                RunningTasks = taskManager.ScheduledTasks.Where(i => i.State == TaskState.Running || i.State == TaskState.Cancelling)
                               .Select(ScheduledTaskHelpers.GetTaskInfo)
                               .ToArray(),

                ApplicationUpdateTaskId = taskManager.ScheduledTasks.First(t => t.ScheduledTask.GetType().Name.Equals("SystemUpdateTask", StringComparison.OrdinalIgnoreCase)).Id,

                ActiveConnections = connections,

                Users = users
            });
        }