Kodi Community Forum
Run Python script with SQLite commands on startup - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Run Python script with SQLite commands on startup (/showthread.php?tid=357938)



Run Python script with SQLite commands on startup - djokenzi - 2020-10-24

Hi guys

I have a Python script with some SQLite3 commands which runs through the tables in TV29.db file, hides all channel lists except 'All channels', hides a large number of channels and then sorts them in a particular order.
I would like to make this script run automatically at startup, but I can't figure out how to do it.

It's not a big deal on my Windows computer as I can double click the script before running Kodi and everything is fine. But I can't do the same on my Android device.

Can anyone help, please?

Thanks in advance!


RE: Run Python script with SQLite commands on startup - jbinkley60 - 2020-10-24

(2020-10-24, 21:22)djokenzi Wrote: Hi guys

I have a Python script with some SQLite3 commands which runs through the tables in TV29.db file, hides all channel lists except 'All channels', hides a large number of channels and then sorts them in a particular order.
I would like to make this script run automatically at startup, but I can't figure out how to do it.

It's not a big deal on my Windows computer as I can double click the script before running Kodi and everything is fine. But I can't do the same on my Android device.

Can anyone help, please?

Thanks in advance!

If you want it to start with Kodi you can leverage an autoexec.py in the userdata folder.  I do this to position Kodi with the window and content I want to display on startup. 


Jeff


RE: Run Python script with SQLite commands on startup - djokenzi - 2020-10-24

@jbinkley60 Isn't this method deprecated? I tried it already, but it didn't work for me...


RE: Run Python script with SQLite commands on startup - jbinkley60 - 2020-10-24

(2020-10-24, 22:18)djokenzi Wrote: @jbinkley60 Isn't this method deprecated? I tried it already, but it didn't work for me...

There is a newer autoexec service but as far as I know autoexec.py still works.  What specifically isn't working ? Can you post your autoexec.py file ?


Jeff


RE: Run Python script with SQLite commands on startup - djokenzi - 2020-10-25

Hi Jeff,

You were right, it's working! In my version of Kodi there are two userdata folders, and I wasn't aware of that, so it turned out that I wasn't using the correct one...

Thanks for your comment, it really helped!


RE: Run Python script with SQLite commands on startup - jbinkley60 - 2020-10-25

(2020-10-25, 00:40)djokenzi Wrote: Hi Jeff,

You were right, it's working! In my version of Kodi there are two userdata folders, and I wasn't aware of that, so it turned out that I wasn't using the correct one...

Thanks for your comment, it really helped!

Excellent.  Glad it is working for you.  Yes, depending upon what Kodi is running on the correct location of the userdata folder varies.  You should be able to use this technique on both your Windows and Android installations. 

Jeff