Clarification of "Clean library..." & help to clean DB
#1
I've discovered my database is full of items that have either been moved, renamed or deleted.
I have run the "Clean library" function many times, I've also tried an add-on for a deeper clean, without success.

The Wiki says...

http://kodi.wiki/view/Settings/Videos#Library
Quote:Clean library... - Remove items from your library that can't be found (either renamed, deleted, or on removable storage that is currently unplugged)."
...but it's leaving behind moved, renamed and deleted files.

So I've come to the conclusion that "Clean library" function literally only cleans the library, as in the front-end view, and not the whole database.

Is this correct? If so, without deleting and starting again, is there a way to check every database item for its corresponding file and remove entries when a file is missing?

I run a central mySQL database on Ubuntu, if that helps.

Cheers
Reply
#2
(2016-10-17, 01:52)mdh99 Wrote: I've discovered my database is full of items that have either been moved, renamed or deleted.
I have run the "Clean library" function many times, I've also tried an add-on for a deeper clean, without success.

The Wiki says...

http://kodi.wiki/view/Settings/Videos#Library
Quote:Clean library... - Remove items from your library that can't be found (either renamed, deleted, or on removable storage that is currently unplugged)."
...but it's leaving behind moved, renamed and deleted files.

So I've come to the conclusion that "Clean library" function literally only cleans the library, as in the front-end view, and not the whole database.

Is this correct? If so, without deleting and starting again, is there a way to check every database item for its corresponding file and remove entries when a file is missing?

I run a central mySQL database on Ubuntu, if that helps.

Cheers

To clean the database in Kodi, (no idea about mysql) go to the folders & change content to none. When finished, change content back to original.
Reply
#3
If we're taking about just the library, then clean-up works well. Bur once you have exported your library meta-data, thrown in extras like trailers, artwork, themes, posters, logo's and other art. Clean-up just deletes the listing in the library if it can not find an associated real video. Leaving all the other stuff behind. To delete it all would require some sort of file manger, then a library clean would eliminate the listing. Updating or removing videos (wiki)

I personally have used this and give it 3 thumbs up http://forum.kodi.tv/showthread.php?tid=272112

Check out this link, might be useful Texture Cache Maintenance utility (wiki) http://forum.kodi.tv/showthread.php?tid=158373&page=125
Reply
#4
(2016-10-17, 20:24)bubblegum57 Wrote: To clean the database in Kodi, (no idea about mysql) go to the folders & change content to none. When finished, change content back to original.

This does not clean the database; for what I've worked out, all it does is remove entries from the "tvshow" table, it does not remove entries from "files' or "path" tables.
Tv Shows disappear from the front-end view in Kodi, but other tables in the database are still full of dead entries.

(2016-10-17, 21:40)PatK Wrote: If we're taking about just the library, then clean-up works well. Bur once you have exported your library meta-data, thrown in extras like trailers, artwork, themes, posters, logo's and other art. Clean-up just deletes the listing in the library if it can not find an associated real video. Leaving all the other stuff behind. To delete it all would require some sort of file manger, then a library clean would eliminate the listing. Updating or removing videos (wiki)

I personally have used this and give it 3 thumbs up http://forum.kodi.tv/showthread.php?tid=272112

Check out this link, might be useful Texture Cache Maintenance utility (wiki) http://forum.kodi.tv/showthread.php?tid=158373&page=125

I have tried the "Database Pre-Wash Scrub" add-on and since I don't do any stearming and only watch files scanned into the library it didn't do much for me.

It also doesn't compare files to database entries and it ignores sub-folders of your sources, even if they're missing/deleted. So if you have your shows in //drive/tvshows/ it won't delete entries for //drive/tvshows/deletedshow/. Apparently you can specify the sub-folder, but you need to remember the exact path of everything you've deleted; it's easier to edit the database directly.


So, it looks like the built-in clean up is very weak and the only way to actually completely remove dead entries is directly edit the database, which is what I've been doing, or delete it and start again.
Reply
#5
As someone who experiments a lot with Kodi and Media with nfo files, I have found this to be very frustrating.

MyVideodb file just seems to grow and grow.
Entries are still present in the MyVideos107.db file even after a Clean Library, or if the source path has been fully removed from Kodi.

It seems that all scraped data added to the MyVideo db file is never removed. This is a problem, as new scraped data is not correctly written to the db file.
Case in point, If refreshing a movie in a collection, and the nfo has new Set Overview entry, this is never updated to MyVideo db file.

Playing with 'Database Pre-Wash Scrub' never found any entries that needed to be removed. But it should not be up to a third-party tool to clean up the database, or the Artwork.

Clean Video Library Should take care of removing artwork and database fields from MyVideo and texturecache files. Otherwise, all Clean Library is doing is flagging entries to not be displayed.

For devices with limited storage, over time, this will be a Major issue.
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#6
I couldn't agree more!

I'd like to see "Clean Library" renamed to "Library Clean(Quick): Hide missing files" and a new "Library Clean(Full): Re-scan all files and clean database".

I can't program it, but I'd be happy to test it.
Reply
#7
(2017-01-14, 02:23)mdh99 Wrote: I couldn't agree more!

I'd like to see "Clean Library" renamed to "Library Clean(Quick): Hide missing files" and a new "Library Clean(Full): Re-scan all files and clean database".

I can't program it, but I'd be happy to test it.

Is there an addon or something that does this? Would like to be able to remove all dead/old links to removed files in my database to increase the speed of cleanup.
Reply
#8
Same problem here
any news?
Reply
#9
I've noticed this recently as well. I had some shared directories on a local computer that contained media files. I have since deleted that media off that local computer. The shared directories are no longer sources in Kodi, and the library has been cleaned. But once the share is removed from the local computer, the kodi CLEAN LIBRARY function will cause Kodi to hang. I have found that the "Path" table in my MyVideos99.db file contains many references to the old shared directories on the local computer. So currently the only way the I can keep Kodi from hanging up during a CLEAN LIBRARY is to make sure that local PC is on, and the shared directories are still there... even though they no longer have anything in them.
Reply
#10
Same issue here - I've been playing with MySQL Workbench to figure this out. I really should see if I can fix this but I don't have time right now - I tried to manually (re)move some invalid paths and now a few TV Shows invalid episode counts for some strange reason.

Seems to me that my best option is probably to export the library, drop the DB and then scan the video back in again which shouldn't take too long with the .nfo's created by the export.
Reply
#11
Since I have all individual NFOs, it would not be difficult to re-import. But wouldn't that mess up all of the "Add Dates?" The family always sorts by a "Add Date" to see what I have newly added.
Either way, if the media is gone and the shares are no longer in existence, I would assume either manually removing the sources from Kodi, or Cleaning the library, would do exactly that - remove all references within databases to no longer existing media files or shares.

Unless there is a reason to keep these database entries around, to me this seems like a bug-
Reply
#12
What a shame this doesn't have much traction with the Kodi team; it's obviously not an issue for most users.
Reply
#13
I agree-

While I love Kodi, I find needing to keep empty directories around so Kodi does not crash is a bug....

Call me crazy....
Reply
#14
I upgraded to Kodi 17.3. I have not removed my "fake" placeholder shares (which contain no files), so don't know if it corrects the problem. But I am seeing some other interesting things which I assume are related to bad library entries.

1) I search for a known movie name, and it is found, and I can play it. BUT it is not showing up in the list of movies (by title, or year, etc). I tried correcting by deleting directory (which contains .mkv, nfo, fanart, etc), cleaning library, exiting kodi, restarting kodi, recreating the removed directory, then scanning for new media in that directory. The same symptom is exhibited (movie is there, I can search for it, play it, etc., but it does not show up in any movie lists. The only way to fix this is to delete movie, clean library, copy movie back RENAMED, then rescan into movie library.

2) I also somehow have TWO library entries for the same movie. I delete the movie directory, then clean library. Both movie entries disappear from library listings and search. I then put the movie back in the windows directory and rescan. BOTH entries reappear. I believe (and will test later) that if I rename the movie file to something different, it will scan properly and there will only be one entry in MOVIES.

To me it appears that CLEAN library is not effectively (or reliably) removing entries that are no longer available. They are hanging out in the database, and if you rescan something with the same name, it will "reactivate" them.
Reply
#15
1) Sounds like you have "hide watched" enabled.
For kodi 17 open up movies library, side menu, if you see an "Unwatched" line press on it until it becomes "All videos".
2) Does that movie's folder contain any other videos? Eg trailer, extras etc.
You can see the path of library items by going to information window and highlighting Refresh button.
Reply

Logout Mark Read Team Forum Stats Members Help
Clarification of "Clean library..." & help to clean DB1