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 2
Plugin Development
Trakt for MP2
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="henso" data-source="post: 1246207" data-attributes="member: 119106"><p>We can't presume that all clients always have an updated play count, so the play count is handled server side <a href="https://github.com/MediaPortal/MediaPortal-2/blob/9a50576f36f4cf11e07553388f073bb997eaafc3/MediaPortal/Source/Core/MediaPortal.Backend/Services/MediaLibrary/MediaLibrary.cs#L2433" target="_blank">here</a>. The same user could be logged in on multiple clients and then his play count could be updated incorrectly.</p><p>My guess is you are not reloading the user data after changing the play count? If not then the user data on the client will not be changed before next time it is loaded.</p><p>As you can see there is a little "cheat" for KEY_PLAY_PERCENTAGE to avoid reloading the user data by just changing the values in the already loaded user data. This will not be saved to the database though. The NotifyUserPlayback handles this. Could you not just add the following line:</p><p>[code=csharp]mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_COUNT] = watched ? 1 : 0;[/code]</p><p>If you need a more correct value you could also just increment the current value by 1 if watched. If you need the current "real" value, you need to reload the user data from the database.</p></blockquote><p></p>
[QUOTE="henso, post: 1246207, member: 119106"] We can't presume that all clients always have an updated play count, so the play count is handled server side [URL='https://github.com/MediaPortal/MediaPortal-2/blob/9a50576f36f4cf11e07553388f073bb997eaafc3/MediaPortal/Source/Core/MediaPortal.Backend/Services/MediaLibrary/MediaLibrary.cs#L2433']here[/URL]. The same user could be logged in on multiple clients and then his play count could be updated incorrectly. My guess is you are not reloading the user data after changing the play count? If not then the user data on the client will not be changed before next time it is loaded. As you can see there is a little "cheat" for KEY_PLAY_PERCENTAGE to avoid reloading the user data by just changing the values in the already loaded user data. This will not be saved to the database though. The NotifyUserPlayback handles this. Could you not just add the following line: [code=csharp]mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_COUNT] = watched ? 1 : 0;[/code] If you need a more correct value you could also just increment the current value by 1 if watched. If you need the current "real" value, you need to reload the user data from the database. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Trakt for MP2
Contact us
RSS
Top
Bottom