Moving pictures doesn't remember position. (2 Viewers)

ltfearme

Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    Started Playback
    Code:
    [2015-07-03 19:37:32,094] [Log  ] [MPMain  ] [INFO ] - g_Player.OnStarted() D:\Film\Faster (2010) [1080p]\Faster.2010.1080p.BrRip.x264.YIFY.mp4 media:Video

    Send To Trakt (Start Watching):
    Code:
    2015-07-03 19:37:32.685 [INFO] [Scrobble][46]: Sending start scrobble of movie to trakt.tv. Title = 'Faster', Year = '2010', IMDb ID = 'tt1433108', TMDb ID = '41283'
    2015-07-03 19:37:33.225 [INFO] [Scrobble][46]: Scrobble Response: {"action":"start","episode":null,"movie":{"ids":{"slug":"faster-2010","trakt":27285,"imdb":"tt1433108","tmdb":41283},"title":"Faster","year":2010},"progress":0,"sharing":{"facebook":false,"tumblr":false,"twitter":false},"show":null}

    Ended Playback
    Code:
    [2015-07-03 20:10:43,410] [Log  ] [MPMain  ] [INFO ] - VideoPlayer:ended D:\Film\Faster (2010) [1080p]\Faster.2010.1080p.BrRip.x264.YIFY.mp4

    Send To Trakt (Paused Watching):
    Code:
    2015-07-03 20:10:43.411 [INFO] [Scrobble][24]: Sending 'pause' scrobble of movie to trakt.tv. Progress = '0%', Title = 'Faster', Year = '2010', IMDb ID = 'tt1433108', TMDb ID = '41283'
    2015-07-03 20:10:44.063 [INFO] [Scrobble][24]: Scrobble Response: {"action":"pause","episode":null,"movie":{"ids":{"slug":"faster-2010","trakt":27285,"imdb":"tt1433108","tmdb":41283},"title":"Faster","year":2010},"progress":0,"sharing":{"facebook":false,"tumblr":false,"twitter":false},"show":null}

    It looks like it sent the pause with 0% progress watched, so when you restarted mediaportal, the trakt paused sync reset your resume time to 0%.

    The big question is why the trakt plugin didn't know how much you actually watched. This could of happen for a number of reasons.

    We first get the players current position:
    Code:
    // MovingPictures stores duration in milliseconds, g_Player reports in seconds
    double currentPosition = g_Player.CurrentPosition;

    Then we get the total duration of the video:
    Code:
    double duration = GetMovieDuration(movie, IsDVDPlaying);
    
    private double GetMovieDuration(DBMovieInfo movie, bool isDVD)
    {
       double duration = 0.0;
    
       // first try to get from MediaInfo
       if (movie.ActualRuntime != 0)
       {
         // MovingPictures stores duration in milliseconds
         duration = movie.ActualRuntime / 1000.0;
       }
       else if (g_Player.Duration != 0.0)
       {
         // g_Player reports in seconds
         duration = g_Player.Duration;
       }
       else
       {
         // MovingPictures stores scraped runtime in minutes
         duration = movie.Runtime * 60.0;
       }
     
       // MediaInfo runtime from MovingPictures is wrong
       // it sums up all videos on the DVD structure!
       // check if more than 4hrs will suffice
       if (isDVD && duration > (4 * 60 * 60)) duration = movie.Runtime * 60.0;
    
       // sometimes we could be finishing a DVD in an featurette
       // come up with an arbitrary runtime to avoid scrobbling as a trailer,
       // and be rejected, only do this on DVDs
       if (isDVD && duration < 900.0) duration = 120 * 60;
    
       return duration;
    }

    Finially the progress is calculated:
    Code:
    // g_Player reports in seconds
    double progress = duration != 0.0 ? (currentPosition / duration * 100.0) : 0.0;

    I suspect that either the duration of the video as reported in movingpics = 0 or MediaPortal is giving me a current position of 0.

    Can you check your MovingPictures configuration for that movie and see what the Runtime is set to? Check the Movie Details 'Runtime' and the File Details 'Duration'.

    You might need to update MediaInfo for that file or re-scrape the movie. Maybe you have disabled MediaInfo scan?
     
    Last edited:

    Freethefire

    Portal Member
    May 18, 2006
    45
    5
    MediaPortal needs quite a lot of time to shut everything down correctly and close the databases properly with all the data written, is your PC restarting before that is all done? There are OS settings to adjust the time it waits for processes to complete, and will do a hard-kill if time expires.

    Did quite a few trial runs yesterday. I only shut down MP, not the pc, with either the drop down menu X or the "exit mediaportal" command in basic menu. Also tried with and without your backup script. It does remember the timestamp sometimes, but to me it's random. I shut down MP more often in a day than Windows, since my son watches kids stuff on Netflix. So I don't think It has anything to do with the shut down of the actual pc.

    Can you check your MovingPictures configuration for that movie and see what the Runtime is set to? Check the Movie Details 'Runtime' and the File Details 'Duration'.

    The movie I chose, reported runtime as 136 in "Movie details", but in "File details" it shows as 8177168. That seems wierd right? The same is true after a forced MediaInfo update.

    You might need to update MediaInfo for that file or re-scrape the movie. Maybe you have disabled MediaInfo scan?

    I don't think I've disabled it. I add movies quite frequently, and it finds them without interaction almost every time.

    Thanks again for your explanation and reply! Both of you!

    Edit: just saw that all the movies I've started watching have the same "Resume title bd" 1000.
    Edit2: tried starting from scratch again, deleting the db and reimporting all movies. On first MP restart it remembered, then it didin't yet again.
     
    Last edited:

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    The movie I chose, reported runtime as 136 in "Movie details", but in "File details" it shows as 8177168. That seems wierd right? The same is true after a forced MediaInfo update.
    That's okay, File details reports MediaInfo in milliseconds which is 8177168/1000/60 = 136.

    The issue still remains the same though, we need to figure out why the progress is reported as 0 after partially watching a video (that is the root cause). There could be a race condition after watching the video and g_Player.CurrentPosition; reports 0 to trakt. I will give you a test build of trakt with extra logging to figure out why that calculation is incorrect.

    If you want a temp work-around you can disable resume sync in trakt, that way it will not revert your resume time after restart. You can uncheck 'Sync Playback (resume) data on Startup/Resume' from trakt configuration.
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    @Freethefire , can you please repeat your test after installing the trakt package attached to this thread. It's not a fix but just some extra logging to capture the duration and currentposition of the title you watch before sending to trakt. I suspect one of these is 0. I only need the TraktPlugin.log.
     

    Attachments

    • TraktPlugin_v5.5.1.1.mpe1
      3.4 MB

    Freethefire

    Portal Member
    May 18, 2006
    45
    5
    This is really strange. I'm actually having a hard time reproducing the error after I installed the new Trakt version. I haven't changed anything since yesterday. I'll upload the log as soon as I get the problem again, which should be during today.

    Thanks again for your assistance!

    Edit: here we go. I hope that this is the log you need!
     
    Last edited:

    Users who are viewing this thread

    Top Bottom