Kodi Community Forum
howto detect if updatelibrary is done? - 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: howto detect if updatelibrary is done? (/showthread.php?tid=107871)



howto detect if updatelibrary is done? - PierreC - 2011-08-16

Is there anyway to detect if a updatelibrary is done ? I have just done a simple autoexec.py script where it start scanning a specific path for new series, and now I also want it to scan for movies. The problem I am having is that using 2 updatelibraries in a row breaks the scan completely, so I need a way to detect if the first scan is done before executing the next one. Is there a way to do this ? if so, how?

And fyi, dont tell me to do a complete library scan at startup, it takes to long time for me (30+ min).


- mkortstiege - 2011-08-16

Something like this might work (untested pseudo code) ..

Code:
while (xbmc.getCondVisibility('Library.IsScanningVideo')):
  xbmc.sleep(100)



- PierreC - 2011-08-16

Thanks, but it didnt seem to work Sad, my code is as follows:

Code:
import os, xbmc, time

print "running autoexec.py"
time.sleep(5)
xbmc.executebuiltin("xbmc.updatelibrary(video,aaa)")
time.sleep(5)
while (xbmc.getCondVisibility("Library.IsScanningVideo")) : xbmc.sleep(10)
xbmc.executebuiltin("Notification(Testing,XBMC Command Success.)")
print "finished autoexec.py"

What happens is that the library is scanning and after 10 seconds the notification is still popping up, while library is still scanning.


- mkortstiege - 2011-08-16

What revision/build of XBMC you're running. The infolabel Library.IsScanningVideo is a pretty new one.


- PierreC - 2011-08-16

I found the solution!

Code:
while (xbmc.getCondVisibility('Window.IsActive(videoscan)')) : xbmc.sleep(10)

Thanks vdrfan for the hint on getCondVisibility Smile


- PierreC - 2011-08-16

vdrfan Wrote:What revision/build of XBMC you're running. The infolabel Library.IsScanningVideo is a pretty new one.

I am on 10.1


- mkortstiege - 2011-08-16

Glad to hear it's working now Wink