Moving pictures doesn't remember position. | Page 2

Discussion in 'Moving Pictures' started by Freethefire, February 11, 2015.

  1. ltfearme
    • Premium Supporter

    ltfearme Community Plugin Dev

    Joined:
    June 10, 2007
    Messages:
    6,457
    Likes Received:
    4,241
    Gender:
    Male
    Occupation:
    Software Test Engineer
    Location:
    Sydney
    Ratings:
    +5,385 / 0
    Home Country:
    Australia Australia
    Started Playback
    Code (Text):
    1.  
    2. [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
    3.  
    Send To Trakt (Start Watching):
    Code (Text):
    1.  
    2. 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'
    3. 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}
    4.  
    Ended Playback
    Code (Text):
    1.  
    2. [2015-07-03 20:10:43,410] [Log  ] [MPMain  ] [INFO ] - VideoPlayer:ended D:\Film\Faster (2010) [1080p]\Faster.2010.1080p.BrRip.x264.YIFY.mp4
    3.  
    Send To Trakt (Paused Watching):
    Code (Text):
    1.  
    2. 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'
    3. 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}
    4.  
    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 (Text):
    1.  
    2. // MovingPictures stores duration in milliseconds, g_Player reports in seconds
    3. double currentPosition = g_Player.CurrentPosition;
    4.  
    Then we get the total duration of the video:
    Code (Text):
    1.  
    2. double duration = GetMovieDuration(movie, IsDVDPlaying);
    3.  
    4. private double GetMovieDuration(DBMovieInfo movie, bool isDVD)
    5. {
    6.    double duration = 0.0;
    7.  
    8.    // first try to get from MediaInfo
    9.    if (movie.ActualRuntime != 0)
    10.    {
    11.      // MovingPictures stores duration in milliseconds
    12.      duration = movie.ActualRuntime / 1000.0;
    13.    }
    14.    else if (g_Player.Duration != 0.0)
    15.    {
    16.      // g_Player reports in seconds
    17.      duration = g_Player.Duration;
    18.    }
    19.    else
    20.    {
    21.      // MovingPictures stores scraped runtime in minutes
    22.      duration = movie.Runtime * 60.0;
    23.    }
    24.  
    25.    // MediaInfo runtime from MovingPictures is wrong
    26.    // it sums up all videos on the DVD structure!
    27.    // check if more than 4hrs will suffice
    28.    if (isDVD && duration > (4 * 60 * 60)) duration = movie.Runtime * 60.0;
    29.  
    30.    // sometimes we could be finishing a DVD in an featurette
    31.    // come up with an arbitrary runtime to avoid scrobbling as a trailer,
    32.    // and be rejected, only do this on DVDs
    33.    if (isDVD && duration < 900.0) duration = 120 * 60;
    34.  
    35.    return duration;
    36. }
    37.  
    Finially the progress is calculated:
    Code (Text):
    1.  
    2. // g_Player reports in seconds
    3. double progress = duration != 0.0 ? (currentPosition / duration * 100.0) : 0.0;
    4.  
    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: July 7, 2015
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Freethefire

    Freethefire Portal Member

    Joined:
    May 18, 2006
    Messages:
    45
    Likes Received:
    3
    Ratings:
    +5 / 2
    Show System Specs
    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.

    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.

    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: July 7, 2015
  4. ltfearme
    • Premium Supporter

    ltfearme Community Plugin Dev

    Joined:
    June 10, 2007
    Messages:
    6,457
    Likes Received:
    4,241
    Gender:
    Male
    Occupation:
    Software Test Engineer
    Location:
    Sydney
    Ratings:
    +5,385 / 0
    Home Country:
    Australia Australia
    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.
     
  5. ltfearme
    • Premium Supporter

    ltfearme Community Plugin Dev

    Joined:
    June 10, 2007
    Messages:
    6,457
    Likes Received:
    4,241
    Gender:
    Male
    Occupation:
    Software Test Engineer
    Location:
    Sydney
    Ratings:
    +5,385 / 0
    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.
     

    Attached Files:

  6. Freethefire

    Freethefire Portal Member

    Joined:
    May 18, 2006
    Messages:
    45
    Likes Received:
    3
    Ratings:
    +5 / 2
    Show System Specs
    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: July 8, 2015
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!