Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
UpdateLibrary path command?
#1
Hello,

I've excluded all my NAS library sources from updates as its set to sleep when not in use and I don't like kodi and addons waking it up all the time.

What I want to do is set a button on a home submenu that will update all the following NAS sources I have at the same time:

nfs://192.168.1.12/mnt/user/3D HD Movies
nfs://192.168.1.12/mnt/user/HD Movies
nfs://192.168.1.12/mnt/user/Japanese Movies


Is this possible? Can l update just these sources and all with one command/button?

I started playing around and tried to use the following command on one folder - it woke up my NAS but didn't actually scan the folder so I think there is still something wrong with it:
UpdateLibrary(video,nfs://192.168.1.12/mnt/user/3D HD Movies/)


Any thoughts?
Reply
#2
Quote:UpdateLibrary(video,nfs://192.168.1.12/mnt/user/3D HD Movies/)

That's some in-built python function: http://kodi.wiki/view/list_of_built-in_functions

So you need to set up a python script which gets triggered by selecting some button. This can be a button on the home submenu or a remote button which you need to define in the keymap...

The script (which could be named: update_database.py) could look like this:

Code:
import xbmc

xbmc.executebuiltin('XBMC.UpdateLibrary(video,nfs://192.168.1.12/mnt/user/3D HD Movies/)')
xbmc.executebuiltin('XBMC.UpdateLibrary(video,nfs://192.168.1.12/mnt/user/HD Movies/)')
xbmc.executebuiltin('XBMC.UpdateLibrary(video,nfs://192.168.1.12/mnt/user/Japanese Movies/)')

keymap: http://kodi.wiki/view/keymap


The other way could be to update them at kodi start....that can be done with the autoexec.py. So just create that file in the userdata folder and fill it with the content above. Then, each time you start kodi, only those sources are updated.
Reply
#3
Thanks for the reply.

I've saved your code to a file called update_database.py and put it in a userdata/script/

I've then created a button on a home submenu with the following command:
RunScript(special://home/userdata\script\update_database.py)

When i click the button the NAS wakes up so I think that part is working well, however the library doesn't scan the folders.

I have an unraid NAS and the path for the shares I put in my first post I got through smart playlist creator - so I'm not sure if this is correct way to path them?

Any thoughts?


Other stuff I've tried:
I've made the Unraid shares public instead of private
I've replaced the spaces in the shares with underscore - ie 3D_HD_ Movies
I turned exclude folder off for shares but script still didn't work - normal library update does work.
I've tried with the NAS already awake
Reply
#4
You shouldn't need a script. They way you did it initially is correct (but I don't think you can chain updating from 3 sources on a single key action so probably need a script for that). Turn on debug level logging and look at your kodi.log after attempting to update -- see what is reported.

scott s.
.
Reply

Logout Mark Read Team Forum Stats Members Help
UpdateLibrary path command?0
This forum uses Lukasz Tkacz MyBB addons.