Possible to create a plugin that runs every time an episode becomes watched?

I’d like to sync my Plex watch status with a TV website. Is it possible to create a plugin that could execute with the episode info whenever an episode becomes watched? Really it would need to have the show name plus season and episode number. I’ve already written a short script that will iterate over every episode in my Plex TV library but obviously I don’t want to do that all the time as #1 it takes a long time and #2 it erroneously checks/marks episodes that are already marked.

Thanks for any enlightenment

You could catch in plex logs or better if reading within a web browser with a (chrome) extension for example the read information and update the status (if said website has an api)

Yeah the website has an API which I have written a Python interface to, that’s not an issue at all. I guess the question now becomes how to “catch it in the Plex logs”. It sounds like what you’re saying is I’d have to scrape the Plex logs for whatever function/method call marks an episode watched? Would this have all of the show/season/episode info I need?

Digging a little further I see that in the Plex Media Server.log I get Play progress on 11111.....played at...... The “11111” is I guess the media index number plex assigns to an episode. Is there a way with the API to do a lookup on that number in order to get show name, season number, episode number? I’m using the python Plex API interface found here but am willing to use something else to get what I need done.

You don’t need to reinvent the wheel. You can use PlexPy custom script notifications to trigger a script when something is watched (i.e. your Python script that you have already written).

That’s a nice idea, I’ll give it a shot thanks!

I’m looking at something similar.

At the moment I’ve implemented the Java based solution from this thread: https://forums.plex.tv/discussion/214151/tvshowtime-integration-with-plex#latest

However, it has shortcomings (as well as being externally called rather than triggered) so I’m also looking at other options.
Please let me know if you’re also working on TVShowTime integration.

I’ve not written much Python stuff before, but write shell scripts / TCL / PHP / Java quite a lot for work.

You can see my solution on GitHub here, thanks for the help!