private void updateMovieResumeState(DBMovieInfo movie, int part, int timePlayed, byte[] resumeData, int titleBD) { if (movie.UserSettings.Count == 0) { return; } // get the user settings for the default profile (for now) DBUserMovieSettings userSetting = movie.ActiveUserSettings; if (timePlayed > 0 && g_Player.SetResumeBDTitleState >= 0) { // set part and time data userSetting.ResumePart = part; userSetting.ResumeTime = timePlayed; userSetting.ResumeData = new ByteArray(resumeData); userSetting.ResumeTitleBD = titleBD; logger.Debug("Updating movie resume state."); } else { // clear the resume settings userSetting.ResumePart = 0; userSetting.ResumeTime = 0; userSetting.ResumeData = null; userSetting.ResumeTitleBD = 1000; g_Player.SetResumeBDTitleState = userSetting.ResumeTitleBD; logger.Debug("Clearing movie resume state."); } // save the changes to the user setting for this movie userSetting.Commit(); }
/// <summary> /// Start playing a movie on a seperate thread /// </summary> /// <param name="movie">Movie to play</param> /// <param name="resume">Ask user to resume?</param> private static void DoPlayMovie(DBMovieInfo movie, bool resume, int startPosition) { if (GUIGraphicsContext.form.InvokeRequired) { PlayMovieAsyncDelegate d = new PlayMovieAsyncDelegate(DoPlayMovie); GUIGraphicsContext.form.Invoke(d, new object[] { movie, resume, startPosition }); return; } WifiRemote.LogMessage("Play movie (resume: " + resume + ", pos: " + startPosition, WifiRemote.LogType.Debug); // Clear resume if (!resume && movie.UserSettings != null && movie.UserSettings.Count > 0) { DBUserMovieSettings userSetting = movie.ActiveUserSettings; userSetting.ResumePart = 0; userSetting.ResumeTime = 0; userSetting.ResumeData = null; userSetting.Commit(); } if (player == null) { player = new MoviePlayer(new MovingPicturesGUI()); } player.Play(movie); if (!resume && startPosition > 0) { g_Player.SeekAbsolute(startPosition); } }
private void updateMovieWatchedCounter(DBMovieInfo movie) { if (movie == null) { return; } // get the user settings for the default profile (for now) DBUserMovieSettings userSetting = movie.ActiveUserSettings; userSetting.WatchedCount++; // increment watch counter userSetting.Commit(); DBWatchedHistory.AddWatchedHistory(movie, userSetting.User); }