private static void HandleDownloadSubtitle(Video video)
    {
        var subtitleProcess = new BackgroundProcessor<Action>(2, action => action(), "Subtitle provider");

        var subtitleController = new SubtitleProviderProcessor(Logger.LoggerInstance, SubtitleProviderProcessor.ProvideRequestSourceEnum.Ui);
        subtitleProcess.Inject(() => subtitleController.ProvideSubtitleForVideo(video));
    }
Beispiel #2
0
    private static void HandleDownloadSubtitle(Video video)
    {
        var subtitleProcess = new BackgroundProcessor <Action>(2, action => action(), "Subtitle provider");

        var subtitleController = new SubtitleProviderProcessor(Logger.LoggerInstance, SubtitleProviderProcessor.ProvideRequestSourceEnum.Ui);

        subtitleProcess.Inject(() => subtitleController.ProvideSubtitleForVideo(video));
    }
Beispiel #3
0
        /// <summary>
        /// Finds and downloads the correct subtitle
        /// </summary>
        public override void Fetch()
        {
            try
            {
                if (Plugin.PluginOptions.Instance.EnableAutomaticDownloading == false)
                {
                    return;
                }

                if (this.StartFetching(CurrentVideo) == false)
                {
                    return;
                }

                if (this.DoesSubtitleExist())
                {
                    ClearFetching(CurrentVideo);
                    return;
                }

                var processor = new SubtitleProviderProcessor(Logger.LoggerInstance,
                                                              SubtitleProviderProcessor.ProvideRequestSourceEnum.Automatic);

                processor.ProvideSubtitleForVideo(CurrentVideo);

                ClearFetching(CurrentVideo);
            }

            catch (Exception ex)
            {
                var reportedError =
                    string.Format("Error when getting subtitle for video: {0}.", this.CurrentVideo.GetVideoFileName());

                Logger.ReportException(reportedError, ex);

                ClearFetching(CurrentVideo);
            }
        }
        /// <summary>
        /// Finds and downloads the correct subtitle
        /// </summary>
        public override void Fetch()
        {
            try
            {
                if (Plugin.PluginOptions.Instance.EnableAutomaticDownloading == false)
                    return;

                if (this.StartFetching(CurrentVideo) == false)
                    return;

                if (this.DoesSubtitleExist())
                {
                    ClearFetching(CurrentVideo);
                    return;
                }

                var processor = new SubtitleProviderProcessor(Logger.LoggerInstance,
                                                              SubtitleProviderProcessor.ProvideRequestSourceEnum.Automatic);

                processor.ProvideSubtitleForVideo(CurrentVideo);

                ClearFetching(CurrentVideo);

            }

            catch (Exception ex)
            {
                var reportedError =
                    string.Format("Error when getting subtitle for video: {0}.", this.CurrentVideo.GetVideoFileName());

                Logger.ReportException(reportedError, ex);

                ClearFetching(CurrentVideo);

            }
        }