Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Clarification of "Clean library..." & help to clean DB
#31
Yes but Karellen do you have all the junk streaming entries etc that are being complained about?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#32
Nope, not at all.

But I assume that is what they are trying to remove- all the leftover streaming links.

So if they just export their library to NFO to save their valid data, delete the databases and scan the nfo's back into the library, they will rebuild their library, minus all the leftover crud. It will only import valid items.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#33
Oh you mean exporting individual files? Who wants all that nfo and picture crud all over their clean video storage?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#34
I did mean Separate Files, but it can work with Separate or Single file. If the mixed media in the movie folder is not wanted, then use Single File and it will store metadata and images in one location of your choosing.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#35
@nickr 

or simply have your movies stored in folders matching the moviename. Then those nfo and fanart files will be stored in that folder as well. As clean as possible Wink
Reply
#36
(2018-04-08, 21:05)DGenerateKane Wrote: new mysql database so I could go back to the old when this inevitably didn't work) and that just made things worse for me. I exported the entire video library, but when I imported it to the new mysqldatabase I lost 90% of my TV Shows. What's worse, when I tried to go back to the old database, my library is still the new one missing all my shows. I don't know why either, since I was careful which one I had in the advancedsettings.xml. Updating the library only found a few more shows before hanging. 
  

IDK, but just reading this it sounds like you have been maybe doing a lot of adjusting of your MySQL database and ended up with a mess. If it were my system I would probably drop the MySQL database, let Kodi build a new one and start over.

scott s.
.
Reply
#37
For me cleaning of libraries is an issue due to the fact that I run a script every night that lower cases all files in the library (Nothing to do with KODI). if something new is scanned into the library after the lower-case script is run, then 24 hours later the file is un-playbable because on Linux XYZ is not the same as xyz. The only workaround I've found is to rename the file and live with the leftover database entries.

I'd love to see some additional work put into database in general, personally I see it as essential to have a single database for all instances of KODI in a house for things like watched status, consistent artwork etc.
Reply
#38
It's really a shame that no dev looked at this obvious bug for so long time. I read the source and this is what I found:
1. The code is supposed to clean the files but it didn't somehow.
2. The SQL in CleanMediaType to get the files to delete is problematic:
cpp:
// now grab them media items
  std:Confusedtring sql = PrepareSQL("SELECT %s.%s, %s.idFile, path.idPath, parentPath.strPath FROM %s "
                                 "JOIN files ON files.idFile = %s.idFile "
                                 "JOIN path ON path.idPath = files.idPath ",
                               table.c_str(), idField.c_str(), table.c_str(), table.c_str(),
                               table.c_str());
The problem is that, if the file doesn't have a corresponding record in movie, tvshow... tables, it will never get deleted from files table. I'm not sure if this is the root cause but I think we should have a real dev to look at this.
Reply
#39
Yes, a similar observation here... https://forum.kodi.tv/showthread.php?tid...pid2679032

A lot (not all!) of these problems are the result of users not correctly removing library items from Kodi. The correct way is here... https://kodi.wiki/view/Updating_or_removing_videos

It is not being looked at. If you have some knowledge, why not contribute?
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#40
No, this is not a problem of users if my findings are correct. Maybe my description is not detailed enough. I believe that a file having a record in files table while not in movie table is normal, if the file has no meta data scraped. This leads the file and the path related to it will not get deleted forever.
Regarding the contribution, I think reading the source and pointing out the possible root cause is one kind of contribution. In most situation, we need a real dev to look at this because I don't have deep enough understanding of the code and my findings maybe not correct, not to think about to correct the source code.
Reply
#41
(2018-04-13, 06:31)RuralHunter Wrote: The problem is that, if the file doesn't have a corresponding record in movie, tvshow... tables, it will never get deleted from files table. I'm not sure if this is the root cause but I think we should have a real dev to look at this.
 I wonder could this be due to the order that clean library does things? If the corresponding records for a movie/TV Show are deleted before it attempts to delete from the file table, then a file will never get deleted.
Reply
#42
(2018-04-13, 10:23)fr1day Wrote:
(2018-04-13, 06:31)RuralHunter Wrote: The problem is that, if the file doesn't have a corresponding record in movie, tvshow... tables, it will never get deleted from files table. I'm not sure if this is the root cause but I think we should have a real dev to look at this.
 I wonder could this be due to the order that clean library does things? If the corresponding records for a movie/TV Show are deleted before it attempts to delete from the file table, then a file will never get deleted. 
Nope. The movie/tv deleting happens after the files deleting.
Reply
#43
I'm not sure what the requirement is.  I think many things such as streamed files never have entries in the library.  I always thought "cleaning" was about library items, not file table items.

scott s.
.
Reply
#44
(2018-04-14, 00:41)scott967 Wrote: I'm not sure what the requirement is.  I think many things such as streamed files never have entries in the library.  I always thought "cleaning" was about library items, not file table items.

scott s.
.
 If that's the case, then maybe the clean function needs to be expanded to include the cleaning of all items that are no longer valid. What possible benefit is there to a database keeping information on files that no longer exist?
Reply
#45
(2018-04-14, 13:19)fr1day Wrote:
(2018-04-14, 00:41)scott967 Wrote: I'm not sure what the requirement is.  I think many things such as streamed files never have entries in the library.  I always thought "cleaning" was about library items, not file table items.

scott s.
.
 If that's the case, then maybe the clean function needs to be expanded to include the cleaning of all items that are no longer valid. What possible benefit is there to a database keeping information on files that no longer exist? 
I don't know the history of "files", but it seems to serve as the entry point for storing playcount / last played, stream details, resume point, bookmarks, etc.  I assume this was done to allow for keeping info on streamed video across Kodi sessions.

scott s.
.
Reply

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