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="aspik" data-source="post: 1246206" data-attributes="member: 72523"><p>I did this and the SetUnwatchedAction gets the UserMedia data, but I'm still not sure if this helps me to determine if a MI was watched or not.</p><p></p><p>This <a href="https://github.com/MediaPortal/MediaPortal-2/blob/WIP_2.2/MediaPortal/Source/UI/UiComponents/Media/MediaItemActions/AbstractWatchedAction.cs#L59-L90" target="_blank">ProcessAsync</a> method gets called from my MarkAsWatched/MarkAsUnwatched methods, as well as when invoking the set played and set unplayed actions from the client UI. So, I tested it without trakt, just by applying the MP2 UI actions. The PlayCount from the UserData property is still unchanged when using the UI actions.</p><p></p><p>Looking at the ProcessAsync method shows, that it can't change the play count, because it's missing in the argument list of the <a href="https://github.com/MediaPortal/MediaPortal-2/blob/WIP_2.2/MediaPortal/Source/UI/UiComponents/Media/MediaItemActions/AbstractWatchedAction.cs#L80" target="_blank">NotifyUserPlaybackAsync</a> method:</p><p>[code=csharp]if (userProfile.HasValue)</p><p>{</p><p> await cd.NotifyUserPlaybackAsync(userProfile.Value, mediaItem.MediaItemId, playPercentage, watched);</p><p>}[/code]</p><p></p><p>I think this method needs to be extended by a playCount, something like this:</p><p>[SPOILER][code=csharp]public async Task NotifyUserPlaybackAsync(Guid userId, Guid mediaItemId, int percentage, int playCount, bool updatePlayDate = true)</p><p>{</p><p> CpAction action = GetAction("X_MediaPortal_NotifyUserPlayback");</p><p> IList<object> inParameters = new List<object></p><p> {</p><p> MarshallingHelper.SerializeGuid(userId),</p><p> MarshallingHelper.SerializeGuid(mediaItemId),</p><p> percentage,</p><p> playCount,</p><p> updatePlayDate</p><p> };</p><p> await action.InvokeAsync(inParameters);</p><p>}[/code][/SPOILER]</p><p>and in the <a href="https://github.com/MediaPortal/MediaPortal-2/blob/WIP_2.2/MediaPortal/Source/Core/MediaPortal.Backend/Services/ClientCommunication/UPnPContentDirectoryServiceImpl.cs#L1088-L1093" target="_blank">UPnPContentDirectoryServiceImpl</a></p><p>[SPOILER][code=csharp]DvAction mpnp11NotifyUserPlaybackAction = new DvAction("X_MediaPortal_NotifyUserPlayback", OnMPnP11NotifyUserPlayback,</p><p> new DvArgument[] {</p><p> new DvArgument("UserProfile", A_ARG_TYPE_Uuid, ArgumentDirection.In),</p><p> new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.In),</p><p> new DvArgument("Percentage", A_ARG_TYPE_Integer, ArgumentDirection.In),</p><p> new DvArgument("PlayCount", A_ARG_TYPE_Integer, ArgumentDirection.In),</p><p> new DvArgument("UpdatePlayDate", A_ARG_TYPE_Bool, ArgumentDirection.In),</p><p></p><p> },[/code][/SPOILER]</p><p>What do you think?</p></blockquote><p></p>
[QUOTE="aspik, post: 1246206, member: 72523"] I did this and the SetUnwatchedAction gets the UserMedia data, but I'm still not sure if this helps me to determine if a MI was watched or not. This [URL='https://github.com/MediaPortal/MediaPortal-2/blob/WIP_2.2/MediaPortal/Source/UI/UiComponents/Media/MediaItemActions/AbstractWatchedAction.cs#L59-L90']ProcessAsync[/URL] method gets called from my MarkAsWatched/MarkAsUnwatched methods, as well as when invoking the set played and set unplayed actions from the client UI. So, I tested it without trakt, just by applying the MP2 UI actions. The PlayCount from the UserData property is still unchanged when using the UI actions. Looking at the ProcessAsync method shows, that it can't change the play count, because it's missing in the argument list of the [URL='https://github.com/MediaPortal/MediaPortal-2/blob/WIP_2.2/MediaPortal/Source/UI/UiComponents/Media/MediaItemActions/AbstractWatchedAction.cs#L80']NotifyUserPlaybackAsync[/URL] method: [code=csharp]if (userProfile.HasValue) { await cd.NotifyUserPlaybackAsync(userProfile.Value, mediaItem.MediaItemId, playPercentage, watched); }[/code] I think this method needs to be extended by a playCount, something like this: [SPOILER][code=csharp]public async Task NotifyUserPlaybackAsync(Guid userId, Guid mediaItemId, int percentage, int playCount, bool updatePlayDate = true) { CpAction action = GetAction("X_MediaPortal_NotifyUserPlayback"); IList<object> inParameters = new List<object> { MarshallingHelper.SerializeGuid(userId), MarshallingHelper.SerializeGuid(mediaItemId), percentage, playCount, updatePlayDate }; await action.InvokeAsync(inParameters); }[/code][/SPOILER] and in the [URL='https://github.com/MediaPortal/MediaPortal-2/blob/WIP_2.2/MediaPortal/Source/Core/MediaPortal.Backend/Services/ClientCommunication/UPnPContentDirectoryServiceImpl.cs#L1088-L1093']UPnPContentDirectoryServiceImpl[/URL] [SPOILER][code=csharp]DvAction mpnp11NotifyUserPlaybackAction = new DvAction("X_MediaPortal_NotifyUserPlayback", OnMPnP11NotifyUserPlayback, new DvArgument[] { new DvArgument("UserProfile", A_ARG_TYPE_Uuid, ArgumentDirection.In), new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.In), new DvArgument("Percentage", A_ARG_TYPE_Integer, ArgumentDirection.In), new DvArgument("PlayCount", A_ARG_TYPE_Integer, ArgumentDirection.In), new DvArgument("UpdatePlayDate", A_ARG_TYPE_Bool, ArgumentDirection.In), },[/code][/SPOILER] What do you think? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Trakt for MP2
Contact us
RSS
Top
Bottom