Solved Catch OnScanFinished anouncement
#1
Yo, I want to catch this anouncement
Code:
T:6464   DEBUG: GOT ANNOUNCEMENT, type: 16, from xbmc, message OnScanFinished
in a python plugin.

Is it easily achievable ? Around the xbmc.Monitor object perhaps (I see a onDatabaseUpdate, no onScanFinished, I'm not sure the doc I have (http://mirrors.xbmc.org/docs/python-docs...ml#Monitor) is up-to-date) ?
Reply
#2
That's the same.
https://github.com/XBMC-Addons/service.s...default.py
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
Ok thank's, indeed the anouncements are both "type 16".

I'm not sure how to use this Monitor class though, and especially how to catch the message, I need to be sure it is "OnScanFinished".
The idea I get from the link you posted is that I override xbmc.Monitor, call xbmc.Monitor.__init__(), override the method ondatabaseupdated to do what I need, then instantiate this class in my plugin before calling UpdateLibrary ? This doesn't seem to be working xD

Code:
class CustMonitor(xbmc.Monitor):
    def __init__(self, *args, **kwargs):
        xbmc.Monitor.__init__(self)

    def onDatabaseUpdated(self, database):
        xbmc.executebuiltin("Notification(%s, blou, 500)" % self.message)
        logging.warning("YoYoMonitor")

Code:
monitor = CustMonitor()
xbmc.executebuiltin('UpdateLibrary(video)', True)

ps noob question: I would love to see the xbmc python modules, are they available somehow ?
Reply
#4
This is supposed to work, isn't it ? Found other examples of this code used in the same way.

https://github.com/xbmc/xbmc/pull/856
http://pastebin.com/YnNteB4m
Reply
#5
(2013-05-08, 10:48)rkjdid Wrote: ps noob question: I would love to see the xbmc python modules, are they available somehow ?

http://mirrors.xbmc.org/docs/python-docs/
Reply
#6
Your script needs to be running at the time the event occurs in order for the monitor class to catch it. The most common way to do this is through a service
Reply
#7
It is running, it calls UpdateLibrary and sleeploop until I catch the announcement, I would like to avoid sleeping a fixed amount of time before going on in the script, that needs this update to be done.

I thought of an alternate way, using something like that
Code:
logging.warn("Window 6 : %s" % xbmc.getCondVisibility('Window.IsVisible(6)'))
logging.warn("20 : %s" % xbmc.getCondVisibility('Control.IsVisible(20)'))
logging.warn("22 : %s" % xbmc.getCondVisibility('Control.IsVisible(22)'))
logging.warn("10 : %s" % xbmc.getCondVisibility('Control.IsVisible(10)'))
logging.warn("11 : %s" % xbmc.getCondVisibility('Control.IsVisible(11)'))

I put a bunch of them for testing, none of these method calls ever return True, all of the controls should exist. The idea would be to determine when the main video window/controlgroup/whatever is visible, since I have an empty db before UpdateLibrary, and the method refreshes the skin once it's done (I would like to avoid it but I don't have much hope about this at this point), and check to see if the videos are displayed to get out of my sleeploop.

edit: it was because of the progressbar stealing all the focus, I might be onto something, hang tight !
Reply
#8
Code:
xbmc.getCondVisibility('Library.IsScanningVideo()')

made my day ! (Monitor did not)
thank's guys :3
Reply
#9
Well damn lol I didn't realize that's what you were after, coulda saved ya some time =P
Reply
#10
(2013-05-07, 18:09)Martijn Wrote: That's the same.
https://github.com/XBMC-Addons/service.s...default.py

Hi Martijn, this is a little old, but i was just trying to find something like that, very thanks, will be very useful to me.
Clayton
Reply
#11
(2013-05-07, 18:09)Martijn Wrote: That's the same.
Well that's good to know.

Seeing it's called 'OnDatabaseUpdated' I'd expect it to have something to do with database being updated. Apparently not. It's just called when scan finish, regardless of anything being updated or not. And not called when data is removed from database etc. Fine by me, it's actually what I've been looking for, but odd naming..

(2013-05-08, 15:27)rkjdid Wrote:
Code:
xbmc.getCondVisibility('Library.IsScanningVideo()')

made my day ! (Monitor did not)
thank's guys :3
Be careful with that though. It will be false right after scanning has started because it takes time to render.
Reply
#12
I know this is an old thread but does anyone know how to capture the onScanFinished.
I am writing a VB6 app to do some basic jasonrpc things and wanted to have my app
listen for this. But i dont know whats required.
At present i use the Inet Control to pass the Jsonrpc request. all ok.

Do i need to use a different control to listen to responses from kodi, did see somthing about TCP
to send & receive notifications.

thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
Catch OnScanFinished anouncement0