Wake.py start vpn and scan library

I’m looking for a way to start connect my vpn and scan my library when my vero wakes up. I found out about the possibility to use the wake.py script to do this but I have no experience with python scripting. I’m using the zomboided vpn manager which has an api but I’m not sure this is the way to go. Also I would like to scan my library after waking up from standby but I can’t find much info on both topics and about python scripting with Kodi.
Any help would be appreciated! Thanks…

Hi,

Library scan on startup is built in to kodi:

https://kodi.wiki/view/Updating_or_removing_videos#Update_Library-_Automatic

as for vpn, are you using openvpn?

Thanks Tom.

Hi Tom,

I’m looking for a way to do this on wake up from the Vero’s standby mode, this doesn’t trigger a library scan as with the startup. And I’m using open vpn through the zomboided vpn manager, this is less important since it seems that the connection stays active when the Vero is in standby mode.

Hannes

Hi,

Sorry miss read your post earlier.

I’ve done a google search for kodi & wake.py and yielded no results… Could you please post any link you have for this.

Thanks Tom.

This how to it’s the where I found out that it existed…

Hi,

Sorry forgot about that update.

anyway these links should give you a good overview:

https://kodi.wiki/view/List_of_built-in_functions

https://forum.kodi.tv/showthread.php?tid=317550

Thanks Tom.

Great, thanks Tom! Let’s see what I can find…

1 Like

Did you manage to do it? For Vero to do library update when waking from standby, I must create wake.py and put it in /home/osmc/.kodi/userdata. But what exactly I should enter in wake.py file? I am not an advanced user so a little help is needed :smiley: Should I put: UpdateLibrary(database,[path])

https://kodi.wiki/view/HOW-TO:Remotely_update_library

There is a python example on that page. Vital information in order to get those examples to work is this:

These methods require Settings>Services>Control>Allow remote control via HTTP to be enabled.

I managed to create the wake.py script and have it scan my library when waking up with below code, thanks Tom for the links that helped me figure it out. I’ll continue to look if I can start my vpn this way too.

import xbmc
xbmc.executebuiltin('XBMC.UpdateLibrary(video)')

It could be as simple as adding this to your wake.py

RunScript(special://home/addons/service.vpn.manager/api.py, Reconnect)

Don’t have a VPN to test it with.

I’ll try it right now :slight_smile: Thanks!

That was for zomboided vpn manager.

This is for Brian Hornsbys:
RunScript(special://home/addons/script.openvpn)

Annnddd yep. This really works! I think this option should be in settings by default. We rarely shut Vero off, but I set it to go to sleep after 30 minutes and when it wakes up, it automaticaly check if there is someting new on my NAS. Great feature. Now, question about going to sleep, should the vero be on the main menu to go to sleep, or it will sleep whereever I left the system, let’s say in settings, or, movies screen etc?

Yes – I also agree that it might make sense to do this automatically when you wake up.

It should resume where you left it.

1 Like