Jump to content

Mark as watched from API


muzicman0

Recommended Posts

muzicman0

Is it possible to mark something as watched from the API? I record a show called Heartland for my wife, but I want to mark it as watched as soon as it is done recording.

 

I could use a full on script if I had to, but if I could use the post processing that would be even better (or a combination??). I know enough scripting to be dangerous, but I'm not great. I tried looking through the WIKI, but couldn't find what I was looking for.

 

Thanks for any help! @@chef

Link to comment
Share on other sites

chef

Yes, I believe you set the baseItem watched ticks to the full runtime ticks.

 

This is a per user method, found when requesting baseItems in the API with a user object attached.

 

Please let me know if you would like code samples. (Hopefully in C#)

Link to comment
Share on other sites

muzicman0

code samples would be great.  I already have code to authenticate (that I use in another script), but I am not sure where to go from there.  Thanks!

  • Like 1
Link to comment
Share on other sites

muzicman0

Any chance of getting code snippets?  I really just need the format of the command, for instance, I have this one:

$MediaUrl = $embyServerUrl + "/emby/users/" + $User.User.Id + "/items?Fields=width,height,Path&Recursive=true&IncludeItemTypes=Episode&IsPlayed=True&IsMissing=False&ParentId=6f25559632c2aca7578b4fdc30acb587&SortBy=IndexNumber&SortOrder=Descending" + "&api_key=" + $User.AccessToken

That grabs episodes from a specific library that have been watched.  I am hoping I can just modify my existing script to send the command to mark it as watched.  

Link to comment
Share on other sites

PenkethBoy

5eb1cca2510ab_Annotation20200505212857.j

 

you will need the item ID of each episode and user ID

Link to comment
Share on other sites

muzicman0

I tried that, but it didn't seem to work, but then I wasn't 100% sure that I had the right ID.  where do I get the ID from?

 

Oh, and THANKS!

Link to comment
Share on other sites

muzicman0

would it be 1366453 in the following URL?

 

/web/index.html#!/item?id=1366453&serverId=340d6xxxxxxxxxxx6

Link to comment
Share on other sites

PenkethBoy

the id will show in the web browser url for an item

 

should work on a season or series as well - which i assume without testing would then mark all the childitems played

Link to comment
Share on other sites

PenkethBoy

Any chance of getting code snippets?  I really just need the format of the command, for instance, I have this one:

$MediaUrl = $embyServerUrl + "/emby/users/" + $User.User.Id + "/items?Fields=width,height,Path&Recursive=true&IncludeItemTypes=Episode&IsPlayed=True&IsMissing=False&ParentId=6f25559632c2aca7578b4fdc30acb587&SortBy=IndexNumber&SortOrder=Descending" + "&api_key=" + $User.AccessToken

That grabs episodes from a specific library that have been watched.  I am hoping I can just modify my existing script to send the command to mark it as watched.  

you already have in the returned json all the id's for individual items - just need to move through the list to find them

 

or if its only one series try what i suggested above

Edited by PenkethBoy
Link to comment
Share on other sites

muzicman0

Yeah, it's just one series (right now).  It would be easier to do the series, as I assume the ID wouldn't change, but it doesn't seem to put the ID in the URL when I am in the series view.

 

EDIT: Ignore the above...it is now showing the series ID.  I just uninstalled a plugin and restarted the server, maybe that changed something...either way, I will give this a shot.

Edited by muzicman0
Link to comment
Share on other sites

muzicman0

Hmm...no matter how I try to format it, all I get is 'unable to find the specified file'.  I'm sure I just have the URL wrong.  

 

I appreciate the help, I will figure it out.

Link to comment
Share on other sites

PenkethBoy

../emby/Users/<userid>/PlayedItems/1772?api_key=<api_key>

 

1772 is the id of a series

 

just tested and set all episodes to played (watched)

 

you can test in swagger

  • Like 1
Link to comment
Share on other sites

muzicman0

I know I get my user id from /Users/Public, but I am not sure what it is.  I assumed it would be the "Id", but that didn't seem to work.

Link to comment
Share on other sites

PenkethBoy

go to the users page from the dashboard - click on the user you want to use aand look at the browser url usedid=xxxx.......xxxxx

Link to comment
Share on other sites

muzicman0

so weird.  That is what I was using.  My entire line (with some thing's x'd out) is:

http://10.1.0.122:8096/emby/Users/xxxxxxxxxxxxxxxxxxxxxxx/PlayedItems/1271075?api_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx

I got the API key from the dashboard under API.  

 

But it still doesn't work.  Same error.

Edited by muzicman0
Link to comment
Share on other sites

muzicman0

Got it working.  Doesn't seem to work if you do it from a browser, but works from the PowerShell script you helped me with for my other project.  Thanks again!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
muzicman0

So the problem I am having with this right now is that the ID of the series keeps changing for some reason.  Does the ID get 're-created' if all episodes are deleted?  The series.nfo is staying, but it doesn't seem to matter, the series ID keeps changing anyway.

Link to comment
Share on other sites

muzicman0

Hmmm.  OK, I guess I will have to look into a way to find the series ID based on name, or an episode ID based on name.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...