예제 #1
0
        /// <summary>
        /// Get ShowTimes Trailer download directory
        /// </summary>
        /// <returns></returns>
        static string GetShowTimesTrailerDir()
        {
            string showTimesConfigFile = string.Empty;
            string trailerDir          = string.Empty;

            FileLog.Debug("Getting ShowTimes Config location");

            using (Settings xmlreader = new MPSettings())
            {
                showTimesConfigFile = xmlreader.GetValueAsString(cShowTimes, cShowTimesConfigFile, string.Empty);
            }

            if (!string.IsNullOrEmpty(showTimesConfigFile))
            {
                FileLog.Debug("Getting ShowTimes Trailer folder");

                try
                {
                    if (File.Exists(showTimesConfigFile))
                    {
                        var xmlDoc = new XmlDocument();
                        xmlDoc.Load(showTimesConfigFile);

                        var node = xmlDoc.SelectSingleNode("/ConfigurationSettings/TrailerFolder");
                        if (node != null)
                        {
                            trailerDir = node.InnerText;
                        }
                    }
                }
                catch (Exception e)
                {
                    FileLog.Error("Unable to get trailer directory for ShowTimes plugin!: {0}", e.Message);
                }
            }

            return(trailerDir);
        }
예제 #2
0
        /// <summary>
        /// Loads the Settings
        /// </summary>
        internal static void LoadSettings(bool reload = false)
        {
            FileLog.Info("Loading Local Settings");

            using (Settings xmlreader = new MPSettings())
            {
                LogLevel                                      = xmlreader.GetValueAsInt("general", "loglevel", 1);
                WebTimeout                                    = xmlreader.GetValueAsInt(cTrailers, cWebTimeout, 5000);
                WebTimeoutIncrement                           = xmlreader.GetValueAsInt(cTrailers, cWebTimeoutIncrement, 1000);
                WebMaxRetries                                 = xmlreader.GetValueAsInt(cTrailers, cWebMaxRetries, 5);
                WebRequestCacheMinutes                        = xmlreader.GetValueAsInt(cTrailers, cWebRequestCacheMinutes, 60);
                ProviderLocalSearch                           = xmlreader.GetValueAsBool(cTrailers, cProviderLocalSearch, true);
                ProviderTMDb                                  = xmlreader.GetValueAsBool(cTrailers, cProviderTMDb, true);
                ProviderOnlineVideoSearch                     = xmlreader.GetValueAsBool(cTrailers, cProviderOnlineVideoSearch, true);
                OnlineVideosYouTubeMovieSearchString          = xmlreader.GetValueAsString(cTrailers, cOnlineVideosYouTubeMovieSearchString, "%title% %year% trailer");
                OnlineVideosYouTubeShowSearchString           = xmlreader.GetValueAsString(cTrailers, cOnlineVideosYouTubeShowSearchString, "%title% trailer");
                OnlineVideosYouTubeSeasonSearchString         = xmlreader.GetValueAsString(cTrailers, cOnlineVideosYouTubeSeasonSearchString, "%title% season %season%");
                OnlineVideosYouTubeEpisodeSearchString        = xmlreader.GetValueAsString(cTrailers, cOnlineVideosYouTubeEpisodeSearchString, "%title% season %season% episode %episode%");
                OnlineVideosYouTubeEpisodeSpecialSearchString = xmlreader.GetValueAsString(cTrailers, cOnlineVideosYouTubeEpisodeSpecialSearchString, "%title% %episodename%");
                OnlineVideosYouTubeEnabled                    = xmlreader.GetValueAsBool(cTrailers, cOnlineVideosYouTubeEnabled, true);
                OnlineVideosIMDbEnabled                       = xmlreader.GetValueAsBool(cTrailers, cOnlineVideosIMDbEnabled, true);
                OnlineVideosITunesEnabled                     = xmlreader.GetValueAsBool(cTrailers, cOnlineVideosITunesEnabled, true);
                SearchLocalInSubFolder                        = xmlreader.GetValueAsBool(cTrailers, cSearchLocalInSubFolder, true);
                SearchLocalAdditionalSubFolders               = xmlreader.GetValueAsString(cTrailers, cSearchLocalAdditionalSubFolders, "Teaser|Extras|Shorts|Featurette|Featurettes");
                SearchLocalInDedicatedDirectory               = xmlreader.GetValueAsBool(cTrailers, cSearchLocalInDedicatedDirectory, true);
                SearchLocalDedicatedDirectories               = xmlreader.GetValueAsString(cTrailers, cSearchLocalDedicatedDirectories, GetExternalDownloadDirs());
                SearchLocalDedicatedSubDirectories            = xmlreader.GetValueAsString(cTrailers, cSearchLocalDedicatedSubDirectories, "%title% (%year%)|%title%");
                SearchLocalDedicatedDirectorySearchPatterns   = xmlreader.GetValueAsString(cTrailers, cSearchLocalDedicatedDirectorySearchPatterns, "%filename%*|*%title%*%year%*|*%title%*");
                SearchLocalInCurrentMediaFolder               = xmlreader.GetValueAsBool(cTrailers, cSearchLocalInCurrentMediaFolder, true);
                SearchLocalCurrentMediaFolderSearchPatterns   = xmlreader.GetValueAsString(cTrailers, cSearchLocalCurrentMediaFolderSearchPatterns, "trailer*|%filename%*|*%title%*%year%*|*%title%*");
                SearchLocalAggressiveSearch                   = xmlreader.GetValueAsBool(cTrailers, cSearchLocalAggressiveSearch, false);
                SkipOnlineProvidersIfLocalFound               = xmlreader.GetValueAsBool(cTrailers, cSkipOnlineProvidersIfLocalFound, false);
                AutoPlayOnSingleLocalOrOnlineTrailer          = xmlreader.GetValueAsBool(cTrailers, cAutoPlayOnSingleLocalOrOnlineTrailer, false);
                AutoDownloadTrailersMovingPictures            = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadTrailersMovingPictures, false);
                AutoDownloadTrailersMyFilms                   = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadTrailersMyFilms, false);
                AutoDownloadTrailersMyVideos                  = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadTrailersMyVideos, false);
                AutoDownloadStartDelay                        = xmlreader.GetValueAsInt(cTrailers, cAutoDownloadStartDelay, 30000);
                AutoDownloadInterval                          = xmlreader.GetValueAsInt(cTrailers, cAutoDownloadInterval, 86400000);
                AutoDownloadUpdateInterval                    = xmlreader.GetValueAsInt(cTrailers, cAutoDownloadUpdateInterval, 7);
                AutoDownloadDirectory                         = xmlreader.GetValueAsString(cTrailers, cAutoDownloadDirectory, Config.GetSubFolder(Config.Dir.Config, "Trailers"));
                AutoDownloadQuality                           = xmlreader.GetValueAsString(cTrailers, cAutoDownloadQuality, "HD");
                AutoDownloadTrailers                          = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadTrailers, true);
                AutoDownloadTeasers                           = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadTeasers, true);
                AutoDownloadFeaturettes                       = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadFeaturettes, true);
                AutoDownloadClips                             = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadClips, true);
                AutoDownloadCleanup                           = xmlreader.GetValueAsBool(cTrailers, cAutoDownloadCleanup, false);
                PreferredLanguage                             = xmlreader.GetValueAsString(cTrailers, cPreferredLanguage, "en");
                FallbackToEnglishLanguage                     = xmlreader.GetValueAsBool(cTrailers, cFallbackToEnglishLanguage, true);
                AlwaysGetEnglishTrailers                      = xmlreader.GetValueAsBool(cTrailers, cAlwaysGetEnglishTrailers, true);
                ReShowMenuAfterTrailerPlay                    = xmlreader.GetValueAsBool(cTrailers, cReShowMenuAfterTrailerPlay, false);
            }

            if (!reload)
            {
                FileLog.Info("Loading Persisted File Cache");
                TVDbIds   = LoadFileCache(cTVDbExternalIDs, "{}").FromJsonArray <ExternalID>().ToList();
                IMDbIds   = LoadFileCache(cIMDbExternalIDs, "{}").FromJsonArray <ExternalID>().ToList();
                TVRageIds = LoadFileCache(cTVRageExternalIDs, "{}").FromJsonArray <ExternalID>().ToList();

                if (TVDbIds == null)
                {
                    TVDbIds = new List <ExternalID>();
                }
                if (IMDbIds == null)
                {
                    TVDbIds = new List <ExternalID>();
                }
                if (TVRageIds == null)
                {
                    TVDbIds = new List <ExternalID>();
                }
            }
        }