public MpDialogMovingPicturesPin(Cornerstone.MP.GUIPinCodeDialog dialog) : base(dialog) { this.mpDialog = dialog; this.DialogType = dialog.GetModuleName(); this.DialogId = dialog.GetID; GetHeading(dialog, 1); GetText(dialog, 2, 3, 4, 5); this.AvailableActions.Add("cancel"); this.AvailableActions.Add("setpin"); this.AvailableActions.Add("deletepin"); this.AvailableActions.Add("confirmpin"); }
public MpDialogMovingPicturesRating(Cornerstone.MP.GUIGeneralRating dialog) : base(dialog) { this.mpDialog = dialog; this.DialogType = dialog.GetModuleName(); this.DialogId = dialog.GetID; this.Rating = dialog.Rating; this.RatingMax = (dialog._displayStars == Cornerstone.MP.GUIGeneralRating.StarDisplay.FIVE_STARS) ? 5 : 10; GetHeading(dialog, 1); GetText(dialog, 2, 3, 4, 5); this.AvailableActions.Add("cancel"); this.AvailableActions.Add("setrating"); this.AvailableActions.Add("confirmrating"); }
/// <summary> /// Fired when an object is inserted in the Moving Pictures Database /// </summary> /// <param name="obj"></param> private void DatabaseManager_ObjectInserted(Cornerstone.Database.Tables.DatabaseTable obj) { if (TraktSettings.AccountStatus != ConnectionState.Connected) return; if (obj.GetType() == typeof(DBWatchedHistory)) { //A movie has been watched push that out. DBWatchedHistory watchedEvent = (DBWatchedHistory)obj; if (!TraktSettings.BlockedFilenames.Contains(watchedEvent.Movie.LocalMedia[0].FullPath) && !TraktSettings.BlockedFolders.Any(f => watchedEvent.Movie.LocalMedia[0].FullPath.ToLowerInvariant().Contains(f.ToLowerInvariant()))) { TraktLogger.Info("Watched History updated in MovingPictures for movie '{0}'", watchedEvent.Movie.Title); ShowRateDialog(watchedEvent.Movie); ScrobbleHandler(watchedEvent.Movie, TraktScrobbleStates.scrobble); RemoveMovieFromFiltersAndCategories(watchedEvent.Movie); } else TraktLogger.Info("Movie {0} was found as blocked so did not scrobble", watchedEvent.Movie.Title); } else if (obj.GetType() == typeof(DBMovieInfo)) { //A Movie was inserted into the database update trakt DBMovieInfo insertedMovie = (DBMovieInfo)obj; if (!TraktSettings.BlockedFilenames.Contains(insertedMovie.LocalMedia[0].FullPath) && !TraktSettings.BlockedFolders.Any(f => insertedMovie.LocalMedia[0].FullPath.ToLowerInvariant().Contains(f.ToLowerInvariant()))) { TraktLogger.Info("New movie added into MovingPictures: '{0}'", insertedMovie.Title); SyncMovie(CreateSyncData(insertedMovie), TraktSyncModes.library); UpdateCategoriesAndFilters(); } else TraktLogger.Info("Newly inserted movie, {0}, was found on our block list so wasn't added to Trakt", insertedMovie.Title); } }
/// <summary> /// Fired when an objected is removed from the Moving Pictures Database /// </summary> /// <param name="obj"></param> private void DatabaseManager_ObjectDeleted(Cornerstone.Database.Tables.DatabaseTable obj) { if (TraktSettings.AccountStatus != ConnectionState.Connected) return; //If we have removed a movie from Moving Pictures we want to update Trakt library if (obj.GetType() == typeof(DBMovieInfo)) { //Only remove from collection if the user wants us to if (TraktSettings.KeepTraktLibraryClean) { //A Movie was removed from the database update trakt DBMovieInfo deletedMovie = (DBMovieInfo)obj; SyncMovie(CreateSyncData(deletedMovie), TraktSyncModes.unlibrary); } } }
void Settings_SettingChanged(Cornerstone.Database.Tables.DBSetting setting, object oldValue) { if (setting.Key == "dataprovider_management") { updateGUI(); } }
/// <summary> /// Fired when an object is updated in the Moving Pictures Database /// </summary> /// <param name="obj"></param> private void DatabaseManager_ObjectUpdated(Cornerstone.Database.Tables.DatabaseTable obj) { if (TraktSettings.AccountStatus != ConnectionState.Connected) return; //If it is user settings for a movie if (obj.GetType() == typeof(DBUserMovieSettings)) { DBUserMovieSettings userMovieSettings = (DBUserMovieSettings)obj; DBMovieInfo movie = userMovieSettings.AttachedMovies[0]; // don't do anything if movie is blocked if (TraktSettings.BlockedFilenames.Contains(movie.LocalMedia[0].FullPath) || TraktSettings.BlockedFolders.Any(f => movie.LocalMedia[0].FullPath.ToLowerInvariant().Contains(f.ToLowerInvariant()))) { TraktLogger.Info("Movie {0} is on the blocked list so we didn't update Trakt", movie.Title); return; } // if we are syncing, we maybe manually setting state from trakt // in this case we dont want to resend to trakt if (SyncInProgress) return; //We check the watched flag and update Trakt respectfully //ignore if movie is the current movie being scrobbled, this will be set to watched automatically if (userMovieSettings.WatchCountChanged && movie != currentMovie) { if (userMovieSettings.WatchedCount == 0) { SyncMovie(CreateSyncData(movie), TraktSyncModes.unseen); } else { SyncMovie(CreateSyncData(movie), TraktSyncModes.seen); RemoveMovieFromFiltersAndCategories(movie); } } //We will update the Trakt rating of the Movie //TODO: Create a user setting for what they want to define as love/hate if (userMovieSettings.RatingChanged && userMovieSettings.UserRating > 0) { if (userMovieSettings.UserRating >= 4) { RateMovie(CreateRateData(movie, TraktRateValue.love.ToString())); } else if (userMovieSettings.UserRating <= 2) { RateMovie(CreateRateData(movie, TraktRateValue.hate.ToString())); } } // reset user flags for watched/ratings userMovieSettings.WatchCountChanged = false; userMovieSettings.RatingChanged = false; } }