/// <summary>
        /// Loads the Settings
        /// </summary>
        internal static void LoadSettings(bool loadPersistedCache = true)
        {
            TraktLogger.Info("Loading local settings");

            using (Settings xmlreader = new MPSettings())
            {
                UseCompNameOnPassKey = xmlreader.GetValueAsBool(cTrakt, cUseCompNameOnPassKey, true);
                Username = xmlreader.GetValueAsString(cTrakt, cUsername, "");
                Password = xmlreader.GetValueAsString(cTrakt, cPassword, "").Decrypt(cGuid + (UseCompNameOnPassKey ? System.Environment.MachineName : string.Empty));
                UserLogins = xmlreader.GetValueAsString(cTrakt, cUserLogins, "[]").FromJSONArray<TraktAuthentication>().ToList().Decrypt(cGuid + (UseCompNameOnPassKey ? System.Environment.MachineName : string.Empty));
                MovingPictures = xmlreader.GetValueAsInt(cTrakt, cMovingPictures, -1);
                TVSeries = xmlreader.GetValueAsInt(cTrakt, cTVSeries, -1);
                MyVideos = xmlreader.GetValueAsInt(cTrakt, cMyVideos, -1);
                MyFilms = xmlreader.GetValueAsInt(cTrakt, cMyFilms, -1);
                OnlineVideos = xmlreader.GetValueAsInt(cTrakt, cOnlineVideos, -1);
                MyTVRecordings = xmlreader.GetValueAsInt(cTrakt, cMyTVRecordings, -1);
                MyTVLive = xmlreader.GetValueAsInt(cTrakt, cMyTVLive, -1);
                ArgusRecordings = xmlreader.GetValueAsInt(cTrakt, cArgusRecordings, -1);
                ArgusTVLive = xmlreader.GetValueAsInt(cTrakt, cArgusTVLive, -1);
                KeepTraktLibraryClean = xmlreader.GetValueAsBool(cTrakt, cKeepTraktLibraryClean, false);
                BlockedFilenames = xmlreader.GetValueAsString(cTrakt, cBlockedFilenames, "[]").FromJSONArray<string>().ToList();
                BlockedFolders = xmlreader.GetValueAsString(cTrakt, cBlockedFolders, "[]").FromJSONArray<string>().ToList();
                //TODOSkippedMovies = xmlreader.GetValueAsString(cTrakt, cSkippedMovies, "{}").FromJSON<SyncMovieCheck>();
                //TODOAlreadyExistMovies = xmlreader.GetValueAsString(cTrakt, cAlreadyExistMovies, "{}").FromJSON<SyncMovieCheck>();
                LogLevel = xmlreader.GetValueAsInt("general", "loglevel", 1);
                SyncTimerLength = GetValueAsIntAndValidate(cTrakt, cSyncTimerLength, 24, 1, 168);
                SyncStartDelay = GetValueAsIntAndValidate(cTrakt, cSyncStartDelay, 5000, 0, 300000);
                TrendingMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cTrendingMoviesDefaultLayout, 0);
                TrendingShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cTrendingShowsDefaultLayout, 0);
                PopularMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cPopularMoviesDefaultLayout, 0);
                PopularShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cPopularShowsDefaultLayout, 0);
                RecommendedMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRecommendedMoviesDefaultLayout, 0);
                RecommendedShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRecommendedShowsDefaultLayout, 0);
                WatchListMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cWatchListMoviesDefaultLayout, 0);
                WatchListShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cWatchListShowsDefaultLayout, 0);
                WatchListEpisodesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cWatchListEpisodesDefaultLayout, 0);
                ListsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cListsDefaultLayout, 0);
                ListItemsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cListItemsDefaultLayout, 0);
                RelatedMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRelatedMoviesDefaultLayout, 0);
                RelatedShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRelatedShowsDefaultLayout, 0);
                ShowSeasonsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cShowSeasonsDefaultLayout, 0);
                SeasonEpisodesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cSeasonEpisodesDefaultLayout, 0);
                DefaultCalendarView = xmlreader.GetValueAsInt(cTrakt, cDefaultCalendarView, 0);
                DefaultCalendarStartDate = xmlreader.GetValueAsInt(cTrakt, cDefaultCalendarStartDate, 0);
                DownloadFullSizeFanart = xmlreader.GetValueAsBool(cTrakt, cDownloadFullSizeFanart, false);
                DownloadFanart = xmlreader.GetValueAsBool(cTrakt, cDownloadFanart, true);
                WebRequestCacheMinutes = GetValueAsIntAndValidate(cTrakt, cWebRequestCacheMinutes, 15, 1, 1440);
                WebRequestTimeout = GetValueAsIntAndValidate(cTrakt, cWebRequestTimeout, 30000, 15000, 90000);
                GetFollowerRequestsOnStartup = xmlreader.GetValueAsBool(cTrakt, cGetFollowerRequestsOnStartup, false);
                MovingPicturesCategories = xmlreader.GetValueAsBool(cTrakt, cMovingPicturesCategories, false);
                MovingPicturesFilters = xmlreader.GetValueAsBool(cTrakt, cMovingPicturesFilters, false);
                CalendarHideTVShowsInWatchList = xmlreader.GetValueAsBool(cTrakt, cCalendarHideTVShowsInWatchList, false);
                HideWatchedRelatedMovies = xmlreader.GetValueAsBool(cTrakt, cHideWatchedRelatedMovies, false);
                HideWatchedRelatedShows = xmlreader.GetValueAsBool(cTrakt, cHideWatchedRelatedShows, false);
                HideSpoilersOnShouts = xmlreader.GetValueAsBool(cTrakt, cHideSpoilersOnShouts, false);
                SyncRatings = xmlreader.GetValueAsBool(cTrakt, cSyncRatings, true);
                ShowRateDialogOnWatched = xmlreader.GetValueAsBool(cTrakt, cShowRateDialogOnWatched, true);
                DashboardActivityPollInterval = GetValueAsIntAndValidate(cTrakt, cDashboardActivityPollInterval, 15000, 15000, 300000);
                DashboardTrendingPollInterval = GetValueAsIntAndValidate(cTrakt, cDashboardTrendingPollInterval, 300000, 300000, 18000000);
                DashboardLoadDelay = GetValueAsIntAndValidate(cTrakt, cDashboardLoadDelay, 200, 100, 1000);
                DashboardMovieTrendingActive = xmlreader.GetValueAsBool(cTrakt, cDashboardMovieTrendingActive, false);
                MovieRecommendationGenre = xmlreader.GetValueAsString(cTrakt, cMovieRecommendationGenre, "All");
                MovieRecommendationHideCollected = xmlreader.GetValueAsBool(cTrakt, cMovieRecommendationHideCollected, false);
                MovieRecommendationHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cMovieRecommendationHideWatchlisted, false);
                MovieRecommendationStartYear = xmlreader.GetValueAsInt(cTrakt, cMovieRecommendationStartYear, 0);
                MovieRecommendationEndYear = xmlreader.GetValueAsInt(cTrakt, cMovieRecommendationEndYear, 0);
                ShowRecommendationGenre = xmlreader.GetValueAsString(cTrakt, cShowRecommendationGenre, "All");
                ShowRecommendationHideCollected = xmlreader.GetValueAsBool(cTrakt, cShowRecommendationHideCollected, false);
                ShowRecommendationHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cShowRecommendationHideWatchlisted, false);
                ShowRecommendationStartYear = xmlreader.GetValueAsInt(cTrakt, cShowRecommendationStartYear, 0);
                ShowRecommendationEndYear = xmlreader.GetValueAsInt(cTrakt, cShowRecommendationEndYear, 0);
                SortByRecommendedMovies = xmlreader.GetValueAsString(cTrakt, cSortByRecommendedMovies, "{\"Field\": 0,\"Direction\": 0}").FromJSON<SortBy>();
                SortByRecommendedShows = xmlreader.GetValueAsString(cTrakt, cSortByRecommendedShows, "{\"Field\": 0,\"Direction\": 0}").FromJSON<SortBy>();
                SortByTrendingMovies = xmlreader.GetValueAsString(cTrakt, cSortByTrendingMovies, "{\"Field\": 5,\"Direction\": 1}").FromJSON<SortBy>();
                SortByTrendingShows = xmlreader.GetValueAsString(cTrakt, cSortByTrendingShows, "{\"Field\": 5,\"Direction\": 1}").FromJSON<SortBy>();
                SortByPopularMovies = xmlreader.GetValueAsString(cTrakt, cSortByPopularMovies, "{\"Field\": 7,\"Direction\": 1}").FromJSON<SortBy>();
                SortByPopularShows = xmlreader.GetValueAsString(cTrakt, cSortByPopularShows, "{\"Field\": 7,\"Direction\": 1}").FromJSON<SortBy>();
                SortByWatchListMovies = xmlreader.GetValueAsString(cTrakt, cSortByWatchListMovies, "{\"Field\": 6,\"Direction\": 1}").FromJSON<SortBy>();
                SortByWatchListShows = xmlreader.GetValueAsString(cTrakt, cSortByWatchListShows, "{\"Field\": 6,\"Direction\": 1}").FromJSON<SortBy>();
                EnableJumpToForTVShows = xmlreader.GetValueAsBool(cTrakt, cEnableJumpToForTVShows, false);
                MyFilmsCategories = xmlreader.GetValueAsBool(cTrakt, cMyFilmsCategories, false);
                SortSeasonsAscending = xmlreader.GetValueAsBool(cTrakt, cSortSeasonsAscending, false);
                RememberLastSelectedActivity = xmlreader.GetValueAsBool(cTrakt, cRememberLastSelectedActivity, true);
                MovPicsRatingDlgDelay = GetValueAsIntAndValidate(cTrakt, cMovPicsRatingDlgDelay, 500, 250, 1000);
                ShowRateDlgForPlaylists = xmlreader.GetValueAsBool(cTrakt, cShowRateDlgForPlaylists, false);
                TrendingMoviesHideWatched = xmlreader.GetValueAsBool(cTrakt, cTrendingMoviesHideWatched, false);
                TrendingMoviesHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cTrendingMoviesHideWatchlisted, false);
                TrendingMoviesHideCollected = xmlreader.GetValueAsBool(cTrakt, cTrendingMoviesHideCollected, false);
                TrendingMoviesHideRated = xmlreader.GetValueAsBool(cTrakt, cTrendingMoviesHideRated, false);
                TrendingShowsHideWatched = xmlreader.GetValueAsBool(cTrakt, cTrendingShowsHideWatched, false);
                TrendingShowsHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cTrendingShowsHideWatchlisted, false);
                TrendingShowsHideCollected = xmlreader.GetValueAsBool(cTrakt, cTrendingShowsHideCollected, false);
                TrendingShowsHideRated = xmlreader.GetValueAsBool(cTrakt, cTrendingShowsHideRated, false);
                PopularMoviesHideWatched = xmlreader.GetValueAsBool(cTrakt, cPopularMoviesHideWatched, false);
                PopularMoviesHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cPopularMoviesHideWatchlisted, false);
                PopularMoviesHideCollected = xmlreader.GetValueAsBool(cTrakt, cPopularMoviesHideCollected, false);
                PopularMoviesHideRated = xmlreader.GetValueAsBool(cTrakt, cPopularMoviesHideRated, false);
                PopularShowsHideWatched = xmlreader.GetValueAsBool(cTrakt, cPopularShowsHideWatched, false);
                PopularShowsHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cPopularShowsHideWatchlisted, false);
                PopularShowsHideCollected = xmlreader.GetValueAsBool(cTrakt, cPopularShowsHideCollected, false);
                PopularShowsHideRated = xmlreader.GetValueAsBool(cTrakt, cPopularShowsHideRated, false);
                AnticipatedMoviesHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cAnticipatedMoviesHideWatchlisted, false);
                AnticipatedShowsHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cAnticipatedShowsHideWatchlisted, false);
                DefaultNetworkView = xmlreader.GetValueAsInt(cTrakt, cDefaultNetworkView, 1);
                RecentWatchedMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRecentWatchedMoviesDefaultLayout, 0);
                RecentWatchedEpisodesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRecentWatchedEpisodesDefaultLayout, 0);
                RecentAddedMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRecentAddedMoviesDefaultLayout, 0);
                RecentAddedEpisodesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cRecentAddedEpisodesDefaultLayout, 0);
                SyncLibrary = xmlreader.GetValueAsBool(cTrakt, cSyncLibrary, true);
                SearchMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cSearchMoviesDefaultLayout, 0);
                SearchShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cSearchShowsDefaultLayout, 0);
                SearchEpisodesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cSearchEpisodesDefaultLayout, 0);
                SearchPeopleDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cSearchPeopleDefaultLayout, 0);
                SearchUsersDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cSearchUsersDefaultLayout, 0);
                SearchTypes = xmlreader.GetValueAsInt(cTrakt, cSearchTypes, 1);
                ShowSearchResultsBreakdown = xmlreader.GetValueAsBool(cTrakt, cShowSearchResultsBreakdown, true);
                MaxSearchResults = GetValueAsIntAndValidate(cTrakt, cMaxSearchResults, 30, 1, 200);
                FilterTrendingOnDashboard = xmlreader.GetValueAsBool(cTrakt, cFilterTrendingOnDashboard, false);
                IgnoreWatchedPercentOnDVD = xmlreader.GetValueAsBool(cTrakt, cIgnoreWatchedPercentOnDVD, true);
                ActivityStreamView = xmlreader.GetValueAsInt(cTrakt, cActivityStreamView, 5);
                LastSyncActivities = xmlreader.GetValueAsString(cTrakt, cLastSyncActivities, new TraktLastSyncActivities().ToJSON()).FromJSON<TraktLastSyncActivities>();
                SyncBatchSize = GetValueAsIntAndValidate(cTrakt, cSyncBatchSize, 100, 25, 1000);
                SyncPlayback = xmlreader.GetValueAsBool(cTrakt, cSyncPlayback, true);
                SyncResumeDelta = GetValueAsIntAndValidate(cTrakt, cSyncResumeDelta, 5, 0, 600);
                SyncPlaybackOnEnterPlugin = xmlreader.GetValueAsBool(cTrakt, cSyncPlaybackOnEnterPlugin, false);
                SyncPlaybackCacheExpiry = GetValueAsIntAndValidate(cTrakt, cSyncPlaybackCacheExpiry, 5, 1, 1440);
                MaxTrendingMoviesRequest = GetValueAsIntAndValidate(cTrakt, cMaxTrendingMoviesRequest, 40, 1, 1000);
                MaxTrendingShowsRequest = GetValueAsIntAndValidate(cTrakt, cMaxTrendingShowsRequest, 40, 1, 1000);
                MaxPopularMoviesRequest = GetValueAsIntAndValidate(cTrakt, cMaxPopularMoviesRequest, 40, 1, 1000);
                MaxPopularShowsRequest = GetValueAsIntAndValidate(cTrakt, cMaxPopularShowsRequest, 40, 1, 1000);
                MaxAnticipatedMoviesRequest = GetValueAsIntAndValidate(cTrakt, cMaxAnticipatedMoviesRequest, 40, 1, 1000);
                MaxAnticipatedShowsRequest = GetValueAsIntAndValidate(cTrakt, cMaxAnticipatedShowsRequest, 40, 1, 1000);
                UseSSL = xmlreader.GetValueAsBool(cTrakt, cUseSSL, false);
                LastListActivities = xmlreader.GetValueAsString(cTrakt, cLastListActivities, "[]").FromJSONArray<TraktCache.ListActivity>();
                MaxRelatedMoviesRequest = GetValueAsIntAndValidate(cTrakt, cMaxRelatedMoviesRequest, 10, 1, 100);
                MaxRelatedMoviesUnWatchedRequest = GetValueAsIntAndValidate(cTrakt, cMaxRelatedMoviesUnWatchedRequest, 40, 1, 100);
                MaxRelatedShowsRequest = GetValueAsIntAndValidate(cTrakt, cMaxRelatedShowsRequest, 10, 1, 100);
                MaxRelatedShowsUnWatchedRequest = GetValueAsIntAndValidate(cTrakt, cMaxRelatedShowsUnWatchedRequest, 40, 1, 1000);
                MaxUserWatchedMoviesRequest = GetValueAsIntAndValidate(cTrakt, cMaxUserWatchedMoviesRequest, 40, 1, 1000);
                MaxUserWatchedEpisodesRequest = GetValueAsIntAndValidate(cTrakt, cMaxUserWatchedEpisodesRequest, 40, 1, 1000);
                MaxUserCommentsRequest = GetValueAsIntAndValidate(cTrakt, cMaxUserCommentsRequest, 40, 1, 1000);
                DashboardActivityFilter = xmlreader.GetValueAsString(cTrakt, cDashboardActivityFilter, "{}").FromJSON<ActivityFilter>();
                SkipMoviesWithNoIdsOnSync = xmlreader.GetValueAsBool(cTrakt, cSkipMoviesWithNoIdsOnSync, true);
                PersonMovieCreditsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cPersonMovieCreditsDefaultLayout, 0);
                PersonShowCreditsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cPersonShowCreditsDefaultLayout, 0);
                SortByCreditMovies = xmlreader.GetValueAsString(cTrakt, cSortByCreditMovies, "{\"Field\": 7,\"Direction\": 1}").FromJSON<SortBy>();
                SortByCreditShows = xmlreader.GetValueAsString(cTrakt, cSortByCreditShows, "{\"Field\": 7,\"Direction\": 1}").FromJSON<SortBy>();
                CreditMoviesHideWatched = xmlreader.GetValueAsBool(cTrakt, cCreditMoviesHideWatched, false);
                CreditMoviesHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cCreditMoviesHideWatchlisted, false);
                CreditMoviesHideCollected = xmlreader.GetValueAsBool(cTrakt, cCreditMoviesHideCollected, false);
                CreditMoviesHideRated = xmlreader.GetValueAsBool(cTrakt, cCreditMoviesHideRated, false);
                CreditShowsHideWatched = xmlreader.GetValueAsBool(cTrakt, cCreditShowsHideWatched, false);
                CreditShowsHideWatchlisted = xmlreader.GetValueAsBool(cTrakt, cCreditShowsHideWatchlisted, false);
                CreditShowsHideCollected = xmlreader.GetValueAsBool(cTrakt, cCreditShowsHideCollected, false);
                CreditShowsHideRated = xmlreader.GetValueAsBool(cTrakt, cCreditShowsHideRated, false);
                CreditsMovieDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cCreditsMovieDefaultLayout, 0);
                CreditsShowDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cCreditsShowDefaultLayout, 0);
                AnticipatedMoviesDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cAnticipatedMoviesDefaultLayout, 0);
                AnticipatedShowsDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cAnticipatedShowsDefaultLayout, 0);
                SortByAnticipatedMovies = xmlreader.GetValueAsString(cTrakt, cSortByAnticipatedMovies, "{\"Field\": 8,\"Direction\": 1}").FromJSON<SortBy>();
                SortByAnticipatedShows = xmlreader.GetValueAsString(cTrakt, cSortByAnticipatedShows, "{\"Field\": 8,\"Direction\": 1}").FromJSON<SortBy>();
                BoxOfficeDefaultLayout = xmlreader.GetValueAsInt(cTrakt, cBoxOfficeDefaultLayout, 0);
                ParentalControlsEnabled = xmlreader.GetValueAsBool(cTrakt, cParentalControlsEnabled, false);
                ParentalControlsPinCode = xmlreader.GetValueAsString(cTrakt, cParentalControlsPinCode, "");
                ParentalIgnoreAfterEnabled = xmlreader.GetValueAsBool(cTrakt, cParentalIgnoreAfterEnabled, false);
                ParentalIgnoreAfterTime = xmlreader.GetValueAsString(cTrakt, cParentalIgnoreAfterTime, new DateTime().ToShortTimeString());
                ParentalIgnoreMovieRatingEnabled = xmlreader.GetValueAsBool(cTrakt, cParentalIgnoreMovieRatingEnabled, false);
                ParentalIgnoreShowRatingEnabled = xmlreader.GetValueAsBool(cTrakt, cParentalIgnoreShowRatingEnabled, false);
                ParentalIgnoreMovieRating = xmlreader.GetValueAsString(cTrakt, cParentalIgnoreMovieRating, "G");
                ParentalIgnoreShowRating = xmlreader.GetValueAsString(cTrakt, cParentalIgnoreShowRating, "TV-G");
                TmdbConfiguration = xmlreader.GetValueAsString(cTrakt, cTmdbConfiguration, "{}").FromJSON<TmdbConfiguration>();
                TmdbConfigurationAge = xmlreader.GetValueAsString(cTrakt, cTmdbConfigurationAge, new DateTime().ToString());
                TmdbPreferredBackdropSize = xmlreader.GetValueAsString(cTrakt, cTmdbPreferredBackdropSize, "w1280");
                TmdbPreferredPosterSize = xmlreader.GetValueAsString(cTrakt, cTmdbPreferredPosterSize, "w342");
                TmdbPreferredEpisodeThumbSize = xmlreader.GetValueAsString(cTrakt, cTmdbPreferredEpisodeThumbSize, "w300");
                TmdbPreferredHeadshotSize = xmlreader.GetValueAsString(cTrakt, cTmdbPreferredHeadshotSize, "h632");
                TmdbShowImageMaxCacheAge = GetValueAsIntAndValidate(cTrakt, cTmdbShowImageMaxCacheAge, 30, 1, 365);
                TmdbMovieImageMaxCacheAge = GetValueAsIntAndValidate(cTrakt, cTmdbMovieImageMaxCacheAge, 30, 1, 365);
                TmdbSeasonImageMaxCacheAge = GetValueAsIntAndValidate(cTrakt, cTmdbSeasonImageMaxCacheAge, 30, 1, 365);
                TmdbEpisodeImageMaxCacheAge = GetValueAsIntAndValidate(cTrakt, cTmdbEpisodeImageMaxCacheAge, 30, 1, 365);
                TmdbPersonImageMaxCacheAge = GetValueAsIntAndValidate(cTrakt, cTmdbPersonImageMaxCacheAge, 30, 1, 365);
                TmdbPreferredImageLanguage = xmlreader.GetValueAsString(cTrakt, cTmdbPreferredImageLanguage, "en");
            }

            // initialise API settings
            TraktAPI.TraktAPI.ApplicationId = ApplicationId;
            TraktAPI.TraktAPI.UserAgent = UserAgent;
            TraktAPI.TraktAPI.UseSSL = UseSSL;

            TmdbAPI.TmdbAPI.UserAgent = UserAgent;

            // initialise the last sync activities
            if (LastSyncActivities == null) LastSyncActivities = new TraktLastSyncActivities();
            if (LastSyncActivities.Movies == null) LastSyncActivities.Movies = new TraktLastSyncActivities.MovieActivities();
            if (LastSyncActivities.Episodes == null) LastSyncActivities.Episodes = new TraktLastSyncActivities.EpisodeActivities();
            if (LastSyncActivities.Seasons == null) LastSyncActivities.Seasons = new TraktLastSyncActivities.SeasonActivities();
            if (LastSyncActivities.Shows == null) LastSyncActivities.Shows = new TraktLastSyncActivities.ShowActivities();
            if (LastSyncActivities.Lists == null) LastSyncActivities.Lists = new TraktLastSyncActivities.ListActivities();
            if (LastSyncActivities.Comments == null) LastSyncActivities.Comments = new TraktLastSyncActivities.CommentActivities();

            // initialise the dashboard activity filter
            if (DashboardActivityFilter == null) DashboardActivityFilter = new ActivityFilter();
            if (DashboardActivityFilter.Actions == null) DashboardActivityFilter.Actions = new ActivityFilter.Action();
            if (DashboardActivityFilter.Types == null) DashboardActivityFilter.Types = new ActivityFilter.Type();

            if (loadPersistedCache)
            {
                TraktLogger.Info("Loading persisted file cache");
                LastActivityLoad = TraktCache.LoadFileCache(cLastActivityFileCache, "{}").FromJSON<TraktActivity>();
                LastStatistics = TraktCache.LoadFileCache(cLastStatisticsFileCache, null).FromJSON<TraktUserStatistics>();
                LastUserProfile = TraktCache.LoadFileCache(cLastUserProfileFileCache, null).FromJSON<TraktUserSummary>();
                LastTrendingMovies = TraktCache.LoadFileCache(cLastTrendingMovieFileCache, "[]").FromJSONArray<TraktMovieTrending>();
                LastTrendingShows = TraktCache.LoadFileCache(cLastTrendingShowFileCache, "[]").FromJSONArray<TraktShowTrending>();
            }

            // correct any settings in internal plugins if needed
            UpdateInternalPluginSettings();

            TraktLogger.Info("Finished loading local settings");
        }
示例#2
0
        internal static void ClearLastActivityCache(bool force = false)
        {
            // don't be too aggressive at clearing the last activities
            // its possible that we sync paused and library together or
            // enter/exit plugins frequently which enable paused sync
            if (force || lastClearedAt < DateTime.Now.Subtract(new TimeSpan(0, TraktSettings.SyncPlaybackCacheExpiry, 0)))
            {
                _LastSyncActivities = null;

                UnWatchedEpisodes = null;
                UnWatchedMovies = null;

                lastClearedAt = DateTime.Now;
            }
        }