@
ReplayHarry - you only want to run our script on ONE of your KODI boxes. As the database is common to all, then the database only needs cleaning the once.
Do any of those PCs have a "correct" list of sources? That is the PC I'd pick to run our addon from. Otherwise knock up an exceptions.xml for a chosen KODI box and let the script run on there.
As to your theories where the mess has come from. We have done a fair bit of research into this, and can see various reasons causing it. Much of it is going to not be from debugging left behind in the core KODI code. It is more about functions written with a wider effect than expected. Developers come and go, but don't always document what or why they do things. Like the function that stores a list of OSD settings for EVERY video EVER played, even if you didn't change any of those settings from the default. Now, IMHO, that function in the core KODI is plain wrong. By storing all the pointless default values in there - even when they have not been changed from default - means it actually makes the table less useful. Now if the user has 500 films in his collection, and then tries to change a default value... that change will never get propogated to the original 500 films as they have their settings already "fixed" in the database.
Similar issue with the "watched" flag. As each Internet stream was viewed in KODI, it was marked as "watched"... which is clearly an odd thing to mark on a live stream that you will not watch again.
The videos database has this split personality between being somewhere to keep full details of your library of films. AND trying to keep track of settings for every type of video ever played. The main theme of our addon has been to thin your Videos database back to being a database of your library files.
I can also see other bugs and errors in the database... but this may only be in my one. Not sure yet. Once we have settled down the main pre-wash scrubber I see other areas that could be due a repair \ clean. I'm not confusing the discussion yet... those thoughts are for v2.