Kodi: “mark as watched” on tv show not working

Had an issue where “Mark as watched” did not actually mark a show as watched as seen on the “in progress shows” page, probably because I’ve removed/moved files since beginning to watch a show.

solution:
1. replace XX with the showId from tvshow table. gist here

select episode.idEpisode
from tvshow, episode
where 
episode.idShow = tvshow.idShow AND
tvshow.idShow = XX
into outfile '/tmp/alleps';

select episode.idEpisode
from tvshow, episode, files
where 
episode.idShow = tvshow.idShow AND
files.idFile = episode.idFile AND
tvshow.idShow = XX
into outfile '/tmp/watchedeps';
  1. diff /tmp/alleps /tmp/watchedeps
  2. DELETE FROM episode WHERE episode.idEpisode = YY, where YY is the episodeId from the diff
  3. profit!