private void OnSettingsChanged(object sender, EventArgs e)
        {
            Settings = _settings.Settings;

            _profileManager.SubtitleFont     = Settings.SubtitleFont;
            _profileManager.SubtitleFontSize = Settings.SubtitleFontSize;
            _profileManager.SubtitleColor    = Settings.SubtitleColor;
            _profileManager.SubtitleBox      = Settings.SubtitleBox;
            _profileManager.ForceSubtitles   = Settings.ForceSubtitles;

            _analysisLibraryManager.UpdateAnalysisCleanupIntervalWork(_settings.Settings);

            if (_currenTranscoder != _settings.Settings.Transcoder && _settings.Settings.Transcoder == Transcoder.FFMpeg)
            {
                _currenTranscoder = _settings.Settings.Transcoder;

                _converter = new FFMpegMediaConverter();
                ServiceRegistration.Set <IMediaConverter>(_converter);
                Logger.Debug("TranscodingService: Registered FFMpeg MediaConverter.");

                _analyzer = new FFMpegMediaAnalyzer();
                ServiceRegistration.Set <IMediaAnalyzer>(_analyzer);
                Logger.Debug("TranscodingService: Registered FFMpeg MediaAnalyzer.");
            }
        }
        public override void Load()
        {
            if (!Enabled)
            {
                return;
            }

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            Value = settings.CacheMaximumSizeInGB;
        }
Exemplo n.º 3
0
        public override void Load()
        {
            if (!Enabled)
            {
                return;
            }

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            Yes = settings.ForceSubtitles;
        }
        public override void Save()
        {
            if (!Enabled)
            {
                return;
            }

            base.Save();

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            settings.CacheMaximumSizeInGB = Convert.ToInt64(Value);
            serverSettings.Save(settings);
        }
Exemplo n.º 5
0
        public override void Save()
        {
            if (!Enabled)
            {
                return;
            }

            base.Save();

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            settings.ForceSubtitles = Yes;
            serverSettings.Save(settings);
        }
        public override void Save()
        {
            if (!Enabled)
            {
                return;
            }

            base.Save();

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            settings.HardwareAcceleration = _accellerators[Selected];
            serverSettings.Save(settings);
        }
        public override void Load()
        {
            if (!Enabled)
            {
                return;
            }

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            _items = new List <IResourceString>(_accellerators.Count);
            for (int i = 0; i < _accellerators.Count; i++)
            {
                if (_accellerators[i] == HWAcceleration.None)
                {
                    _items.Add(LocalizationHelper.CreateResourceString(RES_NONE));
                }
                else if (_accellerators[i] == HWAcceleration.Auto)
                {
                    _items.Add(LocalizationHelper.CreateResourceString(RES_AUTO));
                }
                else if (_accellerators[i] == HWAcceleration.DirectX11)
                {
                    _items.Add(LocalizationHelper.CreateStaticString("DirectX 11"));
                }
                else if (_accellerators[i] == HWAcceleration.DXVA2)
                {
                    _items.Add(LocalizationHelper.CreateStaticString("DXVA 2"));
                }
                else if (_accellerators[i] == HWAcceleration.Intel)
                {
                    _items.Add(LocalizationHelper.CreateStaticString("Intel"));
                }
                else if (_accellerators[i] == HWAcceleration.Nvidia)
                {
                    _items.Add(LocalizationHelper.CreateStaticString("Nvidia"));
                }
                else if (_accellerators[i] == HWAcceleration.Amd)
                {
                    _items.Add(LocalizationHelper.CreateStaticString("AMD"));
                }

                if (_accellerators[i] == settings.HardwareAcceleration)
                {
                    Selected = i;
                }
            }
        }
        /// <summary>
        /// Creates a scheduled task that will run a analysis cleanup periodically.
        /// </summary>
        public void UpdateAnalysisCleanupIntervalWork(TranscodingServiceSettings settings)
        {
            _enableAnalysisOfImportedMedia = settings.EnableAnalysisOfImportedMedia;
            if (_analysisCleanupIntervalWork != null)
            {
                if (settings.EnableCleanupOrphanedAnalysis && settings.CleanupOrphanedAnalysisIntervalHours == _analysisCleanupIntervalWork.WorkInterval.TotalHours)
                {
                    return; //Nothing has changed
                }
                ServiceRegistration.Get <IThreadPool>().RemoveIntervalWork(_analysisCleanupIntervalWork);
            }

            if (settings.EnableCleanupOrphanedAnalysis && settings.CleanupOrphanedAnalysisIntervalHours > 0)
            {
                _analysisCleanupIntervalWork = new IntervalWork(ScheduleAnalysisCleanup, TimeSpan.FromHours(settings.CleanupOrphanedAnalysisIntervalHours));
                ServiceRegistration.Get <IThreadPool>().AddIntervalWork(_analysisCleanupIntervalWork, false);
            }
        }
        public override void Save()
        {
            if (!Enabled)
            {
                return;
            }

            base.Save();

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();
            string fontName    = _items[Selected].Evaluate();
            string defaultFont = LocalizationHelper.Translate(RES_DEFAULT);

            settings.SubtitleFont = "";
            if (defaultFont != fontName)
            {
                settings.SubtitleFont = fontName;
            }
            serverSettings.Save(settings);
        }
        public override void Save()
        {
            if (!Enabled)
            {
                return;
            }

            base.Save();

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();
            string colorName    = _items[Selected].ResourceString.Evaluate();
            string defaultColor = LocalizationHelper.Translate(RES_DEFAULT);

            settings.SubtitleColor = "";
            if (defaultColor != colorName)
            {
                settings.SubtitleColor = ColorTranslator.ToHtml(_items[Selected].BackgroundColor).Substring(1);
            }
            serverSettings.Save(settings);
        }
Exemplo n.º 11
0
        public override void Load()
        {
            if (!Enabled)
            {
                return;
            }

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();
            int selected = 0;

            _items.Clear();
            _items.Add(LocalizationHelper.CreateResourceString(RES_DEFAULT));
            foreach (var font in _fonts)
            {
                if (!string.IsNullOrEmpty(settings.SubtitleFont) && settings.SubtitleFont.ToUpperInvariant() == font.ToUpperInvariant())
                {
                    selected = _items.Count;
                }
                _items.Add(LocalizationHelper.CreateStaticString(font));
            }
            Selected = selected;
        }
        public override void Load()
        {
            if (!Enabled)
            {
                return;
            }

            IServerSettingsClient      serverSettings = ServiceRegistration.Get <IServerSettingsClient>();
            TranscodingServiceSettings settings       = serverSettings.Load <TranscodingServiceSettings>();

            int selected = 0;

            _items.Clear();
            _items.Add(new ColoredSelectionItem(Color.Empty, LocalizationHelper.CreateResourceString(RES_DEFAULT)));
            foreach (var color in _colors)
            {
                if (!string.IsNullOrEmpty(settings.SubtitleColor) && settings.SubtitleColor.ToUpperInvariant() == color.ToUpperInvariant())
                {
                    selected = _items.Count;
                }
                _items.Add(new ColoredSelectionItem(ColorTranslator.FromHtml("#" + color), LocalizationHelper.CreateStaticString("")));
            }
            Selected = selected;
        }