home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
Moving Pictures
GUI Toggle Watched Event
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="popy" data-source="post: 1123304" data-attributes="member: 114134"><p>Hey, another question regarding the resumedata in the event.</p><p>My code currently is:</p><p></p><p>[code] </p><p> //ByteArrayToString, helper function for converting byte array to string</p><p> private string ByteArrayToString(byte[] ba)</p><p> {</p><p> if (ba == null) return "null";</p><p> StringBuilder hex = new StringBuilder(ba.Length * 2);</p><p> foreach (byte b in ba)</p><p> hex.AppendFormat("{0:x2}", b);</p><p> return hex.ToString();</p><p> }</p><p></p><p> /// <summary></p><p> /// Fired when an object is updated in the Moving Pictures Database</p><p> /// </summary></p><p> /// <param name="obj"></param></p><p> private void DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui)</p><p> {</p><p> WatchedStateEvent curEvent = new WatchedStateEvent();</p><p> string strDebug;</p><p></p><p> // If it is user settings for a movie</p><p> if (dbObject.GetType() != typeof(DBUserMovieSettings))</p><p> {</p><p> Log.Debug("WatchedSynchronizer: DatabaseManager_ObjectUpdatedEx: dbObject.GetType != DBUserMovieSettings");</p><p> return;</p><p> }</p><p></p><p> DBUserMovieSettings userMovieSettings = (DBUserMovieSettings)dbObject;</p><p> DBMovieInfo movie = userMovieSettings.AttachedMovies[0];</p><p></p><p> //Debug</p><p> strDebug = "WatchedSynchronizer: DatabaseManager_ObjectUpdatedEx: userMovieSettings:" +</p><p> "ID: " + userMovieSettings.ID.ToString() + ", " +</p><p> "User: " + userMovieSettings.User.ToString() + ", " +</p><p> "UserRating: " + userMovieSettings.UserRating.ToString() + ", " +</p><p> "WatchedCount: " + userMovieSettings.WatchedCount.ToString() + ", " +</p><p> "ResumePart: " + userMovieSettings.ResumePart.ToString() + ", " +</p><p> "ResumeTime: " + userMovieSettings.ResumeTime.ToString() + ", " +</p><p> "ResumeTitleBD: " + userMovieSettings.ResumeTitleBD.ToString();</p><p> if (userMovieSettings.ResumeData.Data == null)</p><p> {</p><p> strDebug = strDebug + ", " + "ResumeData: null";</p><p> }</p><p> else</p><p> {</p><p> strDebug = strDebug + ", " + "ResumeData: " + ByteArrayToString(userMovieSettings.ResumeData.Data);</p><p> }</p><p> Log.Debug(strDebug);[/code]</p><p></p><p>I am always getting exception:</p><p></p><p>[code][2015-02-03 13:04:08,132] [Log ] [MPMain ] [DEBUG] - GUIVideoFiles: OnPlayBackStopped store resume time</p><p>[2015-02-03 13:04:08,157] [Log ] [MPMain ] [ERROR] - Exception: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.</p><p> bei Cornerstone.Database.CustomTypes.ByteArray.get_Data()</p><p> bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui)</p><p> bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.Tables.DatabaseTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD)</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename)</p><p> bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)</p><p> bei MediaPortal.Player.g_Player.OnStopped()</p><p> bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)</p><p> bei MediaPortal.Player.g_Player.Stop()</p><p> bei MediaPortalApp.OnAction(Action action) Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Site : Byte[] get_Data() Source : Cornerstone Stack Trace: bei Cornerstone.Database.CustomTypes.ByteArray.get_Data()</p><p> bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui)</p><p> bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.Tables.DatabaseTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD)</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename)</p><p> bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)</p><p> bei MediaPortal.Player.g_Player.OnStopped()</p><p> bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)</p><p> bei MediaPortal.Player.g_Player.Stop()</p><p> bei MediaPortalApp.OnAction(Action action)</p><p>[2015-02-03 13:04:08,170] [Error ] [MPMain ] [ERROR] - Exception: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Cornerstone bei Cornerstone.Database.CustomTypes.ByteArray.get_Data()</p><p> bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui)</p><p> bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.Tables.DatabaseTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD)</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename)</p><p> bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)</p><p> bei MediaPortal.Player.g_Player.OnStopped()</p><p> bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)</p><p> bei MediaPortal.Player.g_Player.Stop()</p><p> bei MediaPortalApp.OnAction(Action action)</p><p>[2015-02-03 13:04:08,175] [Log ] [MPMain ] [ERROR] - Exception: System.Exception: exception occurred ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.</p><p> bei Cornerstone.Database.CustomTypes.ByteArray.get_Data()</p><p> bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui)</p><p> bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject)</p><p> bei Cornerstone.Database.Tables.DatabaseTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit()</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD)</p><p> bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename)</p><p> bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)</p><p> bei MediaPortal.Player.g_Player.OnStopped()</p><p> bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)</p><p> bei MediaPortal.Player.g_Player.Stop()</p><p> bei MediaPortalApp.OnAction(Action action)</p><p> --- Ende der internen Ausnahmestapelüberwachung ---</p><p> bei MediaPortalApp.OnAction(Action action)</p><p> bei MediaPortal.GUI.Library.OnActionHandler.Invoke(Action action)</p><p> bei MediaPortal.GUI.Library.GUIWindowManager.DispatchThreadMessages()</p><p> bei MediaPortalApp.FrameMove() Message: exception occurred Site : Void OnAction(MediaPortal.GUI.Library.Action) Source : MediaPortal Inner Exception(s): -> exception occurred -> Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Stack Trace: bei MediaPortalApp.OnAction(Action action)</p><p> bei MediaPortal.GUI.Library.OnActionHandler.Invoke(Action action)</p><p> bei MediaPortal.GUI.Library.GUIWindowManager.DispatchThreadMessages()</p><p> bei MediaPortalApp.FrameMove()</p><p>[2015-02-03 13:04:08,282] [Log ] [MPMain ] [DEBUG] - D3D: Showing mouse cursor[/code]</p><p></p><p>When ill remove the Debug print of the Resumpart variable the code runs fine.</p><p>What i have understanded is that the resumepart is needed for gplayer to resume settings for BD/DVD playback.</p><p></p><p>how can ill print it correctly to the debug log (best is hex string formated)??</p><p></p><p>how can ill update Resumepart with Update sql statement within c#.</p><p>Currently my code is:</p><p></p><p>[code] string strSQL = String.Format("UPDATE user_movie_settings SET watched = {0}, resume_part = {1}, resume_time = {2}, resume_data = NULL, resume_titlebd = {3} WHERE id = '{4}'", strWatchedStatus, intResumePart.ToString(), intResumeTime.ToString(), intResumeTitleBD.ToString(), strUserMovieSettingsId);</p><p> Log.Debug("WatchedSynchronizer: (SetEpisodeWatchedStatus) SQL statement '" + strSQL + "' is going to be executed in database '" + mDatabase.DatabaseName + "'.");</p><p> mDatabase.Execute(strSQL);</p><p>[/code]</p><p></p><p>thx</p><p>pOpY</p></blockquote><p></p>
[QUOTE="popy, post: 1123304, member: 114134"] Hey, another question regarding the resumedata in the event. My code currently is: [code] //ByteArrayToString, helper function for converting byte array to string private string ByteArrayToString(byte[] ba) { if (ba == null) return "null"; StringBuilder hex = new StringBuilder(ba.Length * 2); foreach (byte b in ba) hex.AppendFormat("{0:x2}", b); return hex.ToString(); } /// <summary> /// Fired when an object is updated in the Moving Pictures Database /// </summary> /// <param name="obj"></param> private void DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui) { WatchedStateEvent curEvent = new WatchedStateEvent(); string strDebug; // If it is user settings for a movie if (dbObject.GetType() != typeof(DBUserMovieSettings)) { Log.Debug("WatchedSynchronizer: DatabaseManager_ObjectUpdatedEx: dbObject.GetType != DBUserMovieSettings"); return; } DBUserMovieSettings userMovieSettings = (DBUserMovieSettings)dbObject; DBMovieInfo movie = userMovieSettings.AttachedMovies[0]; //Debug strDebug = "WatchedSynchronizer: DatabaseManager_ObjectUpdatedEx: userMovieSettings:" + "ID: " + userMovieSettings.ID.ToString() + ", " + "User: " + userMovieSettings.User.ToString() + ", " + "UserRating: " + userMovieSettings.UserRating.ToString() + ", " + "WatchedCount: " + userMovieSettings.WatchedCount.ToString() + ", " + "ResumePart: " + userMovieSettings.ResumePart.ToString() + ", " + "ResumeTime: " + userMovieSettings.ResumeTime.ToString() + ", " + "ResumeTitleBD: " + userMovieSettings.ResumeTitleBD.ToString(); if (userMovieSettings.ResumeData.Data == null) { strDebug = strDebug + ", " + "ResumeData: null"; } else { strDebug = strDebug + ", " + "ResumeData: " + ByteArrayToString(userMovieSettings.ResumeData.Data); } Log.Debug(strDebug);[/code] I am always getting exception: [code][2015-02-03 13:04:08,132] [Log ] [MPMain ] [DEBUG] - GUIVideoFiles: OnPlayBackStopped store resume time [2015-02-03 13:04:08,157] [Log ] [MPMain ] [ERROR] - Exception: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei Cornerstone.Database.CustomTypes.ByteArray.get_Data() bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui) bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject) bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject) bei Cornerstone.Database.Tables.DatabaseTable.Commit() bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit() bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD) bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename) bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename) bei MediaPortal.Player.g_Player.OnStopped() bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn) bei MediaPortal.Player.g_Player.Stop() bei MediaPortalApp.OnAction(Action action) Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Site : Byte[] get_Data() Source : Cornerstone Stack Trace: bei Cornerstone.Database.CustomTypes.ByteArray.get_Data() bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui) bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject) bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject) bei Cornerstone.Database.Tables.DatabaseTable.Commit() bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit() bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD) bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename) bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename) bei MediaPortal.Player.g_Player.OnStopped() bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn) bei MediaPortal.Player.g_Player.Stop() bei MediaPortalApp.OnAction(Action action) [2015-02-03 13:04:08,170] [Error ] [MPMain ] [ERROR] - Exception: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Cornerstone bei Cornerstone.Database.CustomTypes.ByteArray.get_Data() bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui) bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject) bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject) bei Cornerstone.Database.Tables.DatabaseTable.Commit() bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit() bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD) bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename) bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename) bei MediaPortal.Player.g_Player.OnStopped() bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn) bei MediaPortal.Player.g_Player.Stop() bei MediaPortalApp.OnAction(Action action) [2015-02-03 13:04:08,175] [Log ] [MPMain ] [ERROR] - Exception: System.Exception: exception occurred ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei Cornerstone.Database.CustomTypes.ByteArray.get_Data() bei WatchedSynchronizer.WatchedSynchronizer.DatabaseManager_ObjectUpdatedEx(DatabaseTable dbObject, TableUpdateInfo ui) bei Cornerstone.Database.DatabaseManager.update(DatabaseTable dbObject) bei Cornerstone.Database.DatabaseManager.Commit(DatabaseTable dbObject) bei Cornerstone.Database.Tables.DatabaseTable.Commit() bei MediaPortal.Plugins.MovingPictures.Database.MovingPicturesDBTable.Commit() bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.updateMovieResumeState(DBMovieInfo movie, Int32 part, Int32 timePlayed, Byte[] resumeData, Int32 titleBD) bei MediaPortal.Plugins.MovingPictures.MainUI.MoviePlayer.onPlayBackStoppedOrChanged(MediaType type, Int32 timeMovieStopped, String filename) bei MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename) bei MediaPortal.Player.g_Player.OnStopped() bei MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn) bei MediaPortal.Player.g_Player.Stop() bei MediaPortalApp.OnAction(Action action) --- Ende der internen Ausnahmestapelüberwachung --- bei MediaPortalApp.OnAction(Action action) bei MediaPortal.GUI.Library.OnActionHandler.Invoke(Action action) bei MediaPortal.GUI.Library.GUIWindowManager.DispatchThreadMessages() bei MediaPortalApp.FrameMove() Message: exception occurred Site : Void OnAction(MediaPortal.GUI.Library.Action) Source : MediaPortal Inner Exception(s): -> exception occurred -> Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Stack Trace: bei MediaPortalApp.OnAction(Action action) bei MediaPortal.GUI.Library.OnActionHandler.Invoke(Action action) bei MediaPortal.GUI.Library.GUIWindowManager.DispatchThreadMessages() bei MediaPortalApp.FrameMove() [2015-02-03 13:04:08,282] [Log ] [MPMain ] [DEBUG] - D3D: Showing mouse cursor[/code] When ill remove the Debug print of the Resumpart variable the code runs fine. What i have understanded is that the resumepart is needed for gplayer to resume settings for BD/DVD playback. how can ill print it correctly to the debug log (best is hex string formated)?? how can ill update Resumepart with Update sql statement within c#. Currently my code is: [code] string strSQL = String.Format("UPDATE user_movie_settings SET watched = {0}, resume_part = {1}, resume_time = {2}, resume_data = NULL, resume_titlebd = {3} WHERE id = '{4}'", strWatchedStatus, intResumePart.ToString(), intResumeTime.ToString(), intResumeTitleBD.ToString(), strUserMovieSettingsId); Log.Debug("WatchedSynchronizer: (SetEpisodeWatchedStatus) SQL statement '" + strSQL + "' is going to be executed in database '" + mDatabase.DatabaseName + "'."); mDatabase.Execute(strSQL); [/code] thx pOpY [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
Moving Pictures
GUI Toggle Watched Event
Contact us
RSS
Top
Bottom