Updatelibrary script help
#1
ok I have been reading the wiki and searching but seem to have hit that place where it should work but doesn't seem to...

ok long story short, I have a python script that runs a bash script, I cannot seem to get xbmc-send command working in my bash...

testsudo.py - this calls the bash script in same directory (so I can launch from scripts section (I tried System.Exec in remote.xml but it would close xbmc). The idea is that I would use RunScript from remote.xml once I get it working

---testsudo.py--
Code:
import os
os.system('/home/htpc/.xbmc/scripts/testsudo')
----------------

testsudo - this is the bash script that unmounts and mounts my nfs share (long story has to do with smb/nfs mix not updating right), then runs the UpdateLibrary(video) command

--testsudo--
Code:
#!/bin/bash

sudo umount <path>
sudo mount -a
xbmc-send --action="XBMC.UpdateLibrary(video)"
------------

The umount and mount command works (another battle with suboers fileSmile)
the xbmc-send command works from terminal (or seems to, says its sending the command).

But when I run testsudo.py from xbmc scripts section, the library doesn't seem to update (new files do show up in videos section but not movies section). I do not see the dialog of "scan for content" that I see when I run the XBMC.UpdateLibrary from remote.xml...

I have read that I could use curl/get via the http server but I would rather not turn it on so that is why I am trying the xbmc-send package/command...

Any ideas? I am willing to bet its something simple...
Reply
#2
ok so I am now trying to do everything in py, which seems to be working... well except for the xbmc-send command

test.py

Code:
import os
os.system('sudo umount /home/htpc/Documents/Storage2')
os.system('sudo mount -a')
os.system('xbmc-send --action="XBMC.UpdateLibrary(video)"')

I saw references to command "import xbmc" I will play around with that
Reply
#3
me again... I suspect there is some issue with running the scripts from within xbmc

I created a bash script with just:

--up script--
Code:
xbmc-send --action="XBMC.UpdateLibrary(video)"

It kicks off the scan content process from either terminal or if I just make it executable and run it... So the command works great!!!

So I then adjusted by previous py to kick off the new up script, no go..

Code:
import os
os.system('sudo umount /home/htpc/Documents/Storage2')
os.system('sudo mount -a')
os.system('/home/htpc/.xbmc/scripts/up')


So I must be calling this command wrong... maybe xbmc can't call it itselfHuh??

Funny thing is there isn't a script failed message in xbmc, just seems to run....


UPDATE

OK there doesn't seem to be anything wrong with my scripts. My python scripts work if I call them from terminal, everything else works too. Gotta try and find out why the xbmc-send won't work if called by xbmc...
Reply
#4
OK I got it... amazing what reading through the python section of the wiki will do.... didn't understand half of it but I got it solved...

Here is my final working python script

Code:
import os
os.system('sudo umount /home/htpc/Documents/Storage2')
os.system('sudo mount -a')
import xbmc, xbmcgui
xbmc.executebuiltin('XBMC.UpdateLibrary(video)')
Reply

Logout Mark Read Team Forum Stats Members Help
Updatelibrary script help0