I want to create a last watched list but I'm still a beginner with the API, and I have no clue how I could call a function after the user has finished the video or is like 7 minutes in the video.
If someone could point me in the right direction that would be extremely helpfull!
There isn't really support for that in the channel framework presently. There are no hooks to/from the player available to channel code. Once you hand off to the player for playback, we don't know what's going on regarding progress/pause/etc.
It's theoretically possible to set up a timer in the background that starts counting when a request for playback is processed but that would be less than ideal since we don't really know if the video is stopped/paused prior to reaching point "x" for progress. The code would need to assume that any playback attempt reaches the success point and then the timer is really pretty superfluous.
There isn't really support for that in the channel framework presently. There are no hooks to/from the player available to channel code. Once you hand off to the player for playback, we don't know what's going on regarding progress/pause/etc.
It's theoretically possible to set up a timer in the background that starts counting when a request for playback is processed but that would be less than ideal since we don't really know if the video is stopped/paused prior to reaching point "x" for progress. The code would need to assume that any playback attempt reaches the success point and then the timer is really pretty superfluous.
I think I found a decent way correct me if I'm using things the wrong way
The sessions API _could_ work for what you want. Unless I'm missing something, it appears that the code assumes a single user environment as there doesn't appear to be any effort made to determine that the current playback session actually relates to the plugin rather than local content or another channel playback on another client app.
As a side note, the plugin framework tends to dislike global variables (particularly when they are declared or modified within functions). You may see some undesirable behaviour related to your "WatchingThread", "WatchingAnime", and "WatchingEpisode" variables.
The sessions API _could_ work for what you want. Unless I'm missing something, it appears that the code assumes a single user environment as there doesn't appear to be any effort made to determine that the current playback session actually relates to the plugin rather than local content or another channel playback on another client app.
As a side note, the plugin framework tends to dislike global variables (particularly when they are declared or modified within functions). You may see some undesirable behaviour related to your "WatchingThread", "WatchingAnime", and "WatchingEpisode" variables.
I see you're still using a global variable (CURRENTLY_PLAYING) which may come back to bite you. I tend to make use of the plugin Dict() for storing variables which I need to have global scope. ie.
Dict['CURRENTLY_PLAYING'] = blah
...
len(Dict['CURRENTLY_PLAYING'])
...
etc.