Jump to content


Photo

What endpoint to update a user's watched position?


  • Please log in to reply
14 replies to this topic

#1 adampalmer OFFLINE  

adampalmer

    Member

  • Members
  • 15 posts
  • Local time: 07:27 PM

Posted 30 July 2019 - 07:01 AM

I'm currently posting to: /emby/Sessions/Playing/Progress with data "{'PositionTicks': 7690000000, 'ItemId': '7778', 'EventName': 'timeupdate'}"

 

But this has 2 problems:

 

1- Emby takes this as the user actively watching that media

2- That positionticks isn't what gets stored in the database, but for some reason some value greater than that. 

 

Please advise!



#2 adampalmer OFFLINE  

adampalmer

    Member

  • Members
  • 15 posts
  • Local time: 07:27 PM

Posted 30 July 2019 - 07:41 AM

An update that  /emby/Users/$uid/PlayingItems/$item/Progress seems to have the same behaviour in that it shows the item as actively streaming. I don't want to do that - just update the last played position. 



#3 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 140187 posts
  • Local time: 12:27 PM

Posted 30 July 2019 - 01:51 PM

There is currently no API to do this. I guess it is something that has't been needed before. You can mark as played, unplayed, favorite, etc, but setting just the resume position is not possible. I suppose it's reasonable to add. What is the use case?



#4 adampalmer OFFLINE  

adampalmer

    Member

  • Members
  • 15 posts
  • Local time: 07:27 PM

Posted 30 July 2019 - 02:27 PM

Hey Luke,

 

I think I figured it out - I can actually make a DELETE request to "/emby/Users/" + auth_user['user_id'] + "/PlayingItems/" + item and even if the item isn't currently playing, I can update it's play position through that DELETE request without any further issues.

 

RE use case - my wife and I both have separate logins and watch our own stuff on our devices but have a few series and movies that we only watch together. I've written a script that will pull out every media ItemID in a defined playlist "Watching Together" and sync our individual accounts together with watched/unwatched/progress.

 

The script ended up a bit of a mess as it was a rushed job but seems to work well on a 10 minute cron and stands up to all the edge cases I threw at it. https://github.com/i...alsec/embystuff

 

Thanks for a great product, I just bought a lifetime licence. 



#5 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 140187 posts
  • Local time: 12:27 PM

Posted 27 August 2019 - 04:13 PM

Thanks for the feedback ! If you'd be better off with a dedicated api, let me know.



#6 LongMan OFFLINE  

LongMan

    Advanced Member

  • Members
  • 118 posts
  • Local time: 05:27 PM

Posted 21 October 2019 - 06:45 PM

@Luke,

 

Hopefully it's not too old to revive.

 

The Media Import project in Kodi is rolling again and an API endpoint to set resume position would be quite useful.

 

From Montellese, the developer

"The main thing I don't know how to get working is updating metadata on the Emby server from the add-on i.e. if the user has watched a movie from the Emby server in Kodi how to tell Emby that the item has been watched etc."

 

Any guidance here would be greatly appreciated.

 

Cheers.


Edited by LongMan, 21 October 2019 - 06:46 PM.


#7 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 140187 posts
  • Local time: 12:27 PM

Posted 22 October 2019 - 03:05 PM

@LongMan, so you need to send watch status, is that it?



#8 LongMan OFFLINE  

LongMan

    Advanced Member

  • Members
  • 118 posts
  • Local time: 05:27 PM

Posted 22 October 2019 - 08:28 PM

@Luke, Thanks for replying. He fleshed out his request a bit more and pointed to the areas where his research suggest that he can get them done. I copied his requests below.

 

Here's what he wants to be able to update on the server for a video item:

  • watched: this seems to be possible with a call to POST /Users/{UserId}/PlayedItems/{itemId} with the property "DatePlayed" set properly
  • unwatched: this seems to be possible with a call to DELETE /Users/{UserId}/PlayedItems/{itemId}. I'm assuming that this also removes the "DatePlayed" property
  • date played: see watched / unwatched. The only "problem" here is that in Kodi it's possible to manually mark an item as unwatched but keep the "last played" property set
  • resume point: this seems to be possible with a call to DELETE ​/Users​/{UserId}​/PlayingItems​/{Id}

I've also come across https://github.com/M...ik...-Check-ins and maybe it would make sense to extend the Emby Media Importer add-on to support this playback tracking for imported media items. But it still doesn't cover the cases where a user manually marks items as watched / unwatched on the Kodi library without actually playing the item.



#9 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 140187 posts
  • Local time: 12:27 PM

Posted 23 October 2019 - 02:06 PM

I would not use /PlayingItems because that's used to report playback stopped. While it might work as a hack, there will inevitably be side effects, such as various things listening for these events.

 

It would probably be best for me to give you a new api, and then you would just have to check the server version to see if it's supported or not.



#10 LongMan OFFLINE  

LongMan

    Advanced Member

  • Members
  • 118 posts
  • Local time: 05:27 PM

Posted 23 October 2019 - 07:37 PM

Thanks Luke, I forwarded the message. Once the API is in, I'll inform him of the beta version to test with.

 

Cheers



#11 LongMan OFFLINE  

LongMan

    Advanced Member

  • Members
  • 118 posts
  • Local time: 05:27 PM

Posted 04 November 2019 - 11:44 AM

@Luke,

Didn't noticed before that you only spoke to one of the four points, the one using /PlayingItems. Am I to assume that the other 3 using /PlayedItems are ok and can be used as outlined. And further that the API extension would only be to accommodate resume point?

Or is it a new API end point to allow external clients to communicate with the server in all points?

 

Cheers



#12 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 140187 posts
  • Local time: 12:27 PM

Posted 04 November 2019 - 06:24 PM

Yea what you're doing for watched/unwatched is fine because we already have that function. That's what the toggle in our apps use. When you mark watched, you can optionally provide the date along with it to indicate when it was watched.

 

So the only thing you're missing is the ability to explicitly set the playback position.



#13 LongMan OFFLINE  

LongMan

    Advanced Member

  • Members
  • 118 posts
  • Local time: 05:27 PM

Posted 04 November 2019 - 08:25 PM

Ok. Thanks



#14 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 140187 posts
  • Local time: 12:27 PM

Posted 13 November 2019 - 11:53 PM

If you had one endpoint to update all of that at the same time, would you do that, or would you still be updating different values at different times?



#15 LongMan OFFLINE  

LongMan

    Advanced Member

  • Members
  • 118 posts
  • Local time: 05:27 PM

Posted Yesterday, 08:47 AM

@Luke,

 

Montellese's Response,

"Whenever an item has changed I check if one of the properties listed above has changed compared to the information provided by the Emby server. Depending on which of the properties has changed I'm currently using different methods to push those differences / changes to the Emby server. If there would be a single endpoint that would make things easier because I would only have to execute a single API call instead of separate ones"


Edited by LongMan, Yesterday, 08:48 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users