Kodi Community Forum
UpdateLibrary path command? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Windows (https://forum.kodi.tv/forumdisplay.php?fid=59)
+---- Thread: UpdateLibrary path command? (/showthread.php?tid=317550)

UpdateLibrary path command? - waltzin - 2017-07-01


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:// HD Movies
nfs:// Movies
nfs:// 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:// HD Movies/)

Any thoughts?

RE: UpdateLibrary path command? - DaVu - 2017-07-01

Quote:UpdateLibrary(video,nfs:// 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:

import xbmc

xbmc.executebuiltin('XBMC.UpdateLibrary(video,nfs:// HD Movies/)')
xbmc.executebuiltin('XBMC.UpdateLibrary(video,nfs:// Movies/)')
xbmc.executebuiltin('XBMC.UpdateLibrary(video,nfs:// 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.

RE: UpdateLibrary path command? - waltzin - 2017-07-02

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:

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

RE: UpdateLibrary path command? - scott967 - 2017-07-03

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.

This forum uses Lukasz Tkacz MyBB addons.