Kodi Community Forum

Full Version: Scripting retaining episode play count
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to retain the episode play count when I update an episode or movie (by update I mean replace an existing copy with a better quality source). The new media files are moved into the directories Kodi is aware of via a script, and at that point I should have whatever data flexget would profile. The problem I've got is Kodi doesn't retain the play count from the old version to the new version. My procedure currently works as follows:
  1. Script checks if the same episode already exists (this is done simply by rm *SXXeXX*) before moving the new file to the location.
  2. Run update and clean library in Kodi.

What I want to do is
  1. Script checks if the same episode already exists (this is done simply by rm *SXXeXX*) before moving the new file to the location.
  2. Get the play count for the episode removed from Kodi.
  3. Run update and clean library in Kodi.
  4. Update the play count.

I've been looking at the Kodi JSON RPC api and as far as I can see there is no direct way to look up the removed episode, I have to go though multiple commands to look up the show id, the episode id etc, is there a more straight forward way to do this, something were maybe I can look up the playcount of an episode using it's file path?