Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 5
  • 6
  • 7(current)
  • 8
  • 9
  • 39
v19 Video Database Cleaner add-on
#91
@skylarking, core kodi behaviour is that you need to delete addon settings by deleting userdata/addon_data/addon.name. I agree kodi should offer to do this, but it is pretty standard computing practice to leave user settings behind.
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
#92
Thanks for creating this addon!

I have followed this tread (and the previous) since the start, but only now got around to try the add on.
The setup went smooth and it ran without problems.

The question I have, is where can I see what was deleted?
I had debug mode enabled in the addon (not in Kodi), and I have checked the database-cleaner.log, and found only like 40 rows there, Is there more statistics available?
Can I see what SQL statments that was run?
Reply
#93
(2016-06-14, 22:26)Ladida Wrote: Thanks for creating this addon!

I have followed this tread (and the previous) since the start, but only now got around to try the add on.
The setup went smooth and it ran without problems.

The question I have, is where can I see what was deleted?
I had debug mode enabled in the addon (not in Kodi), and I have checked the database-cleaner.log, and found only like 40 rows there, Is there more statistics available?
Can I see what SQL statments that was run?

From the first page of the thread -
(2016-04-30, 20:48)black_eagle Wrote: To be clear, debugging needs to be enabled in both the add-on and Kodi itself before you run the script.

That said, if you do enable Kodi debugging and then the add-on debugging and re-run it, it will generate the same SQL statements as it did originally, the only difference is that there won't (shouldn't) be anything to remove as you've already done it.

This is because, it builds a list of paths from sources.xml, adds in the contents of any excludes.xml and any extra items you want to keep (pvr, bookmarks etc) and then deletes the rest.

Enabling debug in the way described above will indeed record the generated statement in Kodi's debug log. The database-cleaner log should include all the details of the paths that were removed. Obviously the amount of stuff in here depends upon how many streams etc you have watched and whether or not you have excluded certain plugins.

Hope that helps, and thank-you for your feedback Smile
Learning Linux the hard way !!
Reply
#94
Ok, I see.
Missed that part about enabling also the Kodi debugging. Maybe the script could warn the user or give the option to enable Kodi debugging before running the script if debugging is enabled in the settings.
(On the other hand you could argue that users that use debugging should be able to read the full instructions, unlike me)

I will give it a go again with both debug settings enabled, just out of curiosity to see what SQL statment that will be created.
Reply
#95
Well, perhaps it isn't crystal clear in the instructions.

Part of the reason is add-ons are not supposed to write debug info into Kodi's standard log, only when this is enabled for Kodi itself. I'm not sure if it is possible in the add-on settings area to depend upon a systemwide setting being enabled although it is certainly possible to add some text underneath clarifying that Kodi's debugging should also be enabled. It's a good point and one that will be addressed in the next release version either by the script checking the systemwide setting at runtime, or by adding some text below the debugging option in the settings.

Your SQL statement should be something along the line of -

DELETE FROM files where idPath in(SELECT idPath from path WHERE(strPath NOT LIKE 'some/path/in/sources%' AND strPath NOT LIKE 'another/path/from/sources%'));

Can be quite long depending upon the size and quantity of the paths in sources.xml

If you don't have any defined sources (some people just use files view) or you just want to quickly remove streaming links, then turning OFF 'use sources.xml' in the add-on settings will generate the following SQL

DELETE FROM files WHERE idPath IN (SELECT idPath FROM path WHERE ((strPath LIKE 'rtmp://%' OR strPath LIKE 'rtmpe:%' OR strPath LIKE 'plugin:%' OR strPath LIKE 'http://%')));

Again, you can add some exlcudes to this with the exclude.xml file.
Learning Linux the hard way !!
Reply
#96
Hi just tried your addon but doesnt run on my pc. I get this error in kodi log.
Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'sqlite3.OperationalError'>
                                            Error Contents: no such column: idFile
                                            Traceback (most recent call last):
                                              File "/home/mac/.kodi/addons/script.database.cleaner/default.py", line 524, in <module>
                                                cleaner_log_file(our_select, False)
                                              File "/home/mac/.kodi/addons/script.database.cleaner/default.py", line 234, in cleaner_log_file
                                                cursor.execute(our_select)
                                            OperationalError: no such column: idFile
                                            -->End of Python script error report<--
Reply
#97
OK, that's a little weird !!

idFile is definitely a column within the database, so just from that little snippet, it's hard to guess what has gone wrong.

Is there any chance that you had debugging turned on in both the add-on and Kodi ? I don't need the full log, just the bits that the add-on writes into it. If you don't have the log, do you think you can reproduce the error (with the same settings you used before) but with both Kodi's and the add-on's debugging enabled and post up a link to the log somewhere so that I can try and figure out what exactly has gone wrong ?

Thanks.
Learning Linux the hard way !!
Reply
#98
http://pastebin.com/2Y7AuLPH
Reply
#99
Thanks. Looks like an issue with keeping bookmarks. I'll see if I can reproduce this and figure out a fix !!
Learning Linux the hard way !!
Reply
Turns out that we had already spotted that this could occur and the latest version should address this. At the moment however, this version is not yet in our repo as it is still undergoing BatterPudding's stringent testing. I haven't heard back from him regarding this yet however.

You can grab the latest stable code (at least I think it's stable Wink) from my github. If you download as a zip file, then you can use Kodi's 'install from zip' to update your version to the latest code. As I said, I haven't yet heard back from BP so I imagine he's busy with real life stuff atm and although this version runs fine for me there may well be other bugs introduced that as yet have not been flagged up.....But hey, it's still in a beta phase Smile

Github link is https://github.com/the-black-eagle/scrip...se.cleaner

Hopefully, this will resolve your issue.
Learning Linux the hard way !!
Reply
I got another error with the git version, did I do something wrong ?

Code:
13:50:20 T:140556176959232   DEBUG: CPythonInvoker(784, /home/mac/.kodi/addons/script.database.cleaner/default.py): start processing
13:50:20 T:140556176959232   DEBUG: -->Python Interpreter Initialized<--
13:50:20 T:140556176959232   DEBUG: CPythonInvoker(784, /home/mac/.kodi/addons/script.database.cleaner/default.py): the source file to load is "/home/mac/.kodi/addons/script.database.cleaner/default.py"
13:50:20 T:140556176959232   DEBUG: CPythonInvoker(784, /home/mac/.kodi/addons/script.database.cleaner/default.py): setting the Python path to /home/mac/.kodi/addons/script.database.cleaner:/home/mac/.kodi/addons/script.module.myconnpy/lib:/usr/lib/python27.zip:/usr/lib/python2.7:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/gtk-2.0:/usr/lib/python2.7/site-packages/wx-3.0-gtk2
13:50:20 T:140556176959232   DEBUG: CPythonInvoker(784, /home/mac/.kodi/addons/script.database.cleaner/default.py): entering source directory /home/mac/.kodi/addons/script.database.cleaner
13:50:20 T:140556176959232   DEBUG: CPythonInvoker(784, /home/mac/.kodi/addons/script.database.cleaner/default.py): instantiating addon using automatically obtained id of "script.database.cleaner" dependent on version 2.1.0 of the xbmc.python api
13:50:20 T:140556176959232   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.NameError'>
                                            Error Contents: global name 'bp_log' is not defined
                                            Traceback (most recent call last):
                                              File "/home/mac/.kodi/addons/script.database.cleaner/default.py", line 412, in <module>
                                                dbglog('script version %s started' % addonversion)
                                              File "/home/mac/.kodi/addons/script.database.cleaner/default.py", line 295, in dbglog
                                                log(txt)
                                              File "/home/mac/.kodi/addons/script.database.cleaner/default.py", line 288, in log
                                                bp_log.write(message)
                                            NameError: global name 'bp_log' is not defined
                                            -->End of Python script error report<--
13:50:20 T:140556504897600   DEBUG: ------ Window Init (DialogKaiToast.xml) ------
13:50:20 T:140556176959232    INFO: Python script stopped
13:50:20 T:140556176959232   DEBUG: Thread LanguageInvoker 140556176959232 terminating
13:50:25 T:140556504897600   DEBUG: ------ Window Deinit (DialogKaiToast.xml) ------
Reply
Erm, no lol. That was entirely down to me. Got the name of a boolean wrong (bp_logging vs bplogging). It's fixed now on git Smile
Learning Linux the hard way !!
Reply
Ok now i have the summary window displayed but i get a error when pressing do it.
Here the link to the log http://pastebin.com/f1TRsyVH
Reply
Thanks for testing !! I'll look at this as soon as I can. There are actually two errors there. One is a python error which is easily fixed, the other is an SQL issue which will require a bit of thinking about. I know what is causing it, I'm just not completely sure yet as to the solution lol
Learning Linux the hard way !!
Reply
Excellent! Exactly what I was looking for.

My OpenElec installation has been hanging for about 5 minutes at 99% cleaning, and I couldn't even abort at that point, I had to wait it out. I knew I could solve the issue by deleting and recreating the database, but I had a lot of folder customization and a huge amount of watched/bookmark status (of existing files) I didn't want to lose... and this worked great! Only took about 5 seconds to run, and now cleanup is as good as instant.

Kudos!
Reply
  • 1
  • 5
  • 6
  • 7(current)
  • 8
  • 9
  • 39

Logout Mark Read Team Forum Stats Members Help
Video Database Cleaner add-on5