protected TorrentDownloaderSettingsBase(IEnumerable<ITorrentMovieProvider> movieProviders, IEnumerable<ITorrentTvShowProvider> tvShowProviders) {
     _movieProviderSelection = new SettingMultiSelection<ITorrentMovieProvider>(movieProviders);
     _tvShowProviderSelection = new SettingMultiSelection<ITorrentTvShowProvider>(tvShowProviders);
     var videoQualityInfo = Constants.VideoQualityEnumInfo;
     _defaultMovieVideoQuality = new SettingSingleSelection<EnumInfo<VideoQuality>>(videoQualityInfo);
     _defaultTvShowVideoQuality = new SettingSingleSelection<EnumInfo<VideoQuality>>(videoQualityInfo);
 }
Exemplo n.º 2
0
        protected TorrentDownloaderSettingsBase(IEnumerable <ITorrentMovieProvider> movieProviders, IEnumerable <ITorrentTvShowProvider> tvShowProviders)
        {
            _movieProviderSelection  = new SettingMultiSelection <ITorrentMovieProvider>(movieProviders);
            _tvShowProviderSelection = new SettingMultiSelection <ITorrentTvShowProvider>(tvShowProviders);
            var videoQualityInfo = Constants.VideoQualityEnumInfo;

            _defaultMovieVideoQuality  = new SettingSingleSelection <EnumInfo <VideoQuality> >(videoQualityInfo);
            _defaultTvShowVideoQuality = new SettingSingleSelection <EnumInfo <VideoQuality> >(videoQualityInfo);
        }
Exemplo n.º 3
0
        public EngineSettings(IEnumerable <INovaromaService> services)
        {
            var serviceList = services as IList <INovaromaService> ?? services.ToList();

            var languages        = Constants.LanguagesEnumInfo.ToList();
            var languageEnumType = typeof(Language);
            var uiLanguages      = languages.Where(l => {
                var lanInfo = Helper.GetMemberAttribute <LanguageInfoAttribute>(languageEnumType, l.Name);
                return(lanInfo != null && lanInfo.UISupported);
            });

            _languageSelection = new SettingSingleSelection <EnumInfo <Language> >(uiLanguages);

            _movieDirectory                = new DirectorySelection();
            _movieDirectory.Path           = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), Resources.Movies);
            _tvShowDirectory               = new DirectorySelection();
            _tvShowDirectory.Path          = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), Resources.TvShows);
            _tvShowSeasonDirectoryTemplate = Resources.Season + " %season%";

            _subtitleLanguages = new SettingMultiSelection <EnumInfo <Language> >(languages);
            _subtitleLanguages.SelectedItemNames = languages[0].Item == Language.English
                ? Enumerable.Empty <string>()
                : new[] { languages[0].DisplayName };

            _downloadInterval         = 10;
            _subtitleDownloadInterval = 60;
            _tvShowUpdateInterval     = 4;
            _infoProvider             = new SettingSingleSelection <IInfoProvider>(serviceList.OfType <IInfoProvider>());
            _advancedInfoProvider     = new SettingSingleSelection <IAdvancedInfoProvider>(serviceList.OfType <IAdvancedInfoProvider>());
            _showTracker = new SettingSingleSelection <IShowTracker>(serviceList.OfType <IShowTracker>());

            var         downloaders        = new List <IDownloader>();
            IDownloader selectedDownloader = null;

            foreach (var downloader in serviceList.OfType <IDownloader>())
            {
                if (downloader.IsAvailable)
                {
                    selectedDownloader = downloader;
                    downloaders.Insert(0, downloader);
                }
                else
                {
                    downloaders.Add(downloader);
                    if (selectedDownloader == null && downloader is UTorrentDownloader)
                    {
                        selectedDownloader = downloader;
                    }
                }
            }
            _downloader = new SettingSingleSelection <IDownloader>(downloaders);
            _downloader.SelectedItem = selectedDownloader;
            _subtitleDownloaders     = new SettingMultiSelection <ISubtitleDownloader>(serviceList.OfType <ISubtitleDownloader>());
            _downloadEventHandlers   = new SettingMultiSelection <IDownloadEventHandler>(serviceList.OfType <IDownloadEventHandler>());
        }
Exemplo n.º 4
0
        public EngineSettings(IEnumerable<INovaromaService> services) {
            var serviceList = services as IList<INovaromaService> ?? services.ToList();

            var languages = Constants.LanguagesEnumInfo.ToList();
            var languageEnumType = typeof(Language);
            var uiLanguages = languages.Where(l => {
                var lanInfo = Helper.GetMemberAttribute<LanguageInfoAttribute>(languageEnumType, l.Name);
                return lanInfo != null && lanInfo.UISupported;
            });
            _languageSelection = new SettingSingleSelection<EnumInfo<Language>>(uiLanguages);

            _movieDirectory = new DirectorySelection();
            _movieDirectory.Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), Resources.Movies);
            _tvShowDirectory = new DirectorySelection();
            _tvShowDirectory.Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), Resources.TvShows);
            _tvShowSeasonDirectoryTemplate = Resources.Season + " %season%";

            _subtitleLanguages = new SettingMultiSelection<EnumInfo<Language>>(languages);
            _subtitleLanguages.SelectedItemNames = languages[0].Item == Language.English
                ? Enumerable.Empty<string>()
                : new[] { languages[0].DisplayName };

            _downloadInterval = 10;
            _subtitleDownloadInterval = 60;
            _tvShowUpdateInterval = 4;
            _infoProvider = new SettingSingleSelection<IInfoProvider>(serviceList.OfType<IInfoProvider>());
            _advancedInfoProvider = new SettingSingleSelection<IAdvancedInfoProvider>(serviceList.OfType<IAdvancedInfoProvider>());
            _showTracker = new SettingSingleSelection<IShowTracker>(serviceList.OfType<IShowTracker>());

            var downloaders = new List<IDownloader>();
            IDownloader selectedDownloader = null;
            foreach (var downloader in serviceList.OfType<IDownloader>()) {
                if (downloader.IsAvailable) {
                    selectedDownloader = downloader;
                    downloaders.Insert(0, downloader);
                }
                else {
                    downloaders.Add(downloader);
                    if (selectedDownloader == null && downloader is UTorrentDownloader)
                        selectedDownloader = downloader;
                }
            }
            _downloader = new SettingSingleSelection<IDownloader>(downloaders);
            _downloader.SelectedItem = selectedDownloader;
            _subtitleDownloaders = new SettingMultiSelection<ISubtitleDownloader>(serviceList.OfType<ISubtitleDownloader>());
            _downloadEventHandlers = new SettingMultiSelection<IDownloadEventHandler>(serviceList.OfType<IDownloadEventHandler>());
        }