XBMC Log Watcher Service
#1
I would like to know if it is possible to create a XBMC Log watcher (or if it already exists), or to watch program that logs the results below.

I know it’s possible to upload a log file manually with an add-on, I was hoping there was a way to send a push notification or email when the trigger is active from the watcher service.

I would like to be notified about certain events, for example when a live stream fails to play, as in bold in the example below.

Example from Log File
10:45:02 T:28440 NOTICE: DVDPlayer: Opening: <<LINK>>
10:45:02 T:28440 WARNING: CDVDMessageQueue(player):Tongueut MSGQ_NOT_INITIALIZED
10:45:02 T:23888 NOTICE: Thread DVDPlayer start, auto delete: false
10:45:02 T:23888 NOTICE: Creating InputStream
10:45:02 T:23888 ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
10:45:02 T:23888 NOTICE: CCurlFile::FillBuffer - Reconnect, (re)try 1
10:45:02 T:23888 ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
10:45:02 T:23888 ERROR: CCurlFile::CReadState::Connect, didn't get any data from stream.
10:45:02 T:23888 ERROR: XFILE::CFileCache::Open - failed to open source <LINK>
10:45:02 T:23888 NOTICE: Creating Demuxer
10:45:02 T:23888 ERROR: CDVDPlayer::OpenDemuxStream - Error creating demuxer
10:45:02 T:23888 NOTICE: CDVDPlayer::OnExit()
10:45:02 T:23888 NOTICE: CDVDPlayer::OnExit() deleting input stream
10:45:02 T:28440 ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://BLAH]
10:45:02 T:25192 NOTICE: Thread BackgroundLoader start, auto delete: false
10:45:02 T:28440 NOTICE: CDVDPlayer::CloseFile()
10:45:02 T:28440 NOTICE: DVDPlayer: waiting for threads to exit
10:45:02 T:28440 NOTICE: DVDPlayer: finished waiting
10:45:02 T:28440 NOTICE: CDVDPlayer::CloseFile()
10:45:02 T:28440 NOTICE: DVDPlayer: waiting for threads to exit
10:45:02 T:28440 NOTICE: DVDPlayer: finished waiting
Reply
#2
I recall i've seen something like this in an addon...not sure if it was tvguide..
The module name was buggalo or something similar. Try to find/check that: http://forum.xbmc.org/showthread.php?tid=121925
Reply
#3
I have just tried buggalo module, I added the code to the addon i am using, but i can't seem to get it trigger when the playback has failed. (as the addon hasn't caused an exception)

i would like it to trigger or capture when this dialog is visible
IImage
Reply
#4
anyone have any ideas on how to get this to work?
Reply
#5
You can only catch exceptions on your code with buggalo, not in xbmc. So I think you can't grab the playback failed exception (my apologies for not reading your question properly).
I can't say for sure this cannot be done but at least I can't see a direct way to do it... However, you have a couple of options:

1) Check in your addon code if the stream is up before sending it to the player

2) Make your addon read the logs and match a regex of skipping unplayable item + your link

3) You can also do something even more "hackish" (in a more elegant way maybe...) like this:
-Create an inheritance of the xbmc player so you can catch player events like onPlayBackStarted(...) or onPlayBackEnded(...)
-Assign a false value to a variable or xbmc addon hidden setting before calling the player
-Make a while loop while xbmc is playing so the events can be grabbed
-Make that variable/setting True on playback started and (optionally) on playbackended
-Check for the variable value after the while loop and do your stuff
-Make the variable/setting False again

For example, something like this:

Code:
import xbmc,xbmcaddon
    
def test_play():
    selfAddon = xbmcaddon.Addon(id='plugin.video.myaddon')
    url_to_play = "Playable or not playable url"
    player = Player()
    selfAddon.setSetting('stream_checker','false')
    player.play(url_to_play)
    while player.isPlaying():
        xbmc.sleep(1000)
    if selfAddon.getSetting('stream_checker') == "true": print("Stream was up...")
    else: print("stream was down")
    selfAddon.setSetting('stream_checker','false')
    
class Player(xbmc.Player):
    def __init__(self):
        print("Player Initiated")

    def onPlayBackStarted(self):
       print("Playback has started")
       selfAddon.setSetting('stream_checker','true')

    def onPlayBackEnded(self):
       print("Playback has started")
       selfAddon.setSetting('stream_checker','true')

In this case I'm using an hidden setting on settings.xml

Code:
<setting id="stream_checker" type="bool" visible="false" default="false"/>

Too ugly but at least it works Rofl
Reply
#6
Tried to incorporate this into my addon, the stream starts to play and then another dialog pops up on top saying "opening stream" this then times out and then stream stops playing.

is this correct?

do you have a working solution you could send through for me to look at?
Reply
#7
That is not related to what you want to do...you're probably calling the script from a strm file or from another addon...
Instead of calling player.play(url_to_play), create a listitem and use setresolvedurl. Something like this

Code:
liz = xbmcgui.ListItem('name', iconImage="DefaultVideo.png", thumbnailImage="myiconimage")
liz.setInfo('video', {'Title': 'Title to display' })
liz.setProperty('IsPlayable', 'true')
liz.setPath(path=url_to_play)
xbmcplugin.setResolvedUrl(int(sys.argv[1]),True,liz)
player.play(url_to_play,liz)

The code I posted above is ugly but it is a working solution. I tested before posting it.
Reply
#8
I have used what you suggested and tweaked the code a little, I am now able to test the stream and raise error with bugallo if it fails, otherwise the stream is played.

I am having trouble getting the ListItem name of the currently selected item that caused the failure. Do you know how to get this?

I wanted to pass this to buggalo as well.
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC Log Watcher Service0