Req Broadcast "now playing" notification to other XBMC instances in LAN
#1
I'd like to request a new feature (option) that allows you to share what you are playing to other XBMC instances in the network.
This would use the existing notification framework to send a popup message to other XBMC player instances showing what you are playing when you start a new video.

Code:
'instance-name' is watching The Big Bang Theory S01E14

Additionally this functionality can be improved by polling other XBMC instances for what they are currently playing.
Instance A: starts video 1.
- No other instance to broadcast message to
Instance B: boots up
- Poll for now playing from other instances
- Notification on instance B that A is playing video 1.
- starts video 2
- Sends notification to instance A: "XBMC Livingroom is watching video 2".
Platforms: macOS - iOS - OSMC
co-author: Red Bull TV add-on
Reply
#2
I think this should be fairly easy to do using an addon. There are a number of addons that perform actions based on when XBMC starts/stops/ends/pauses playing. All that you would need to do is setup a list of ip addresses of the other XBMC boxes in your network and call the JSON GUI.Notification method on the remote XBMC boxes.

Here's a code snippet of an addon where I tested logging of played files to a MySQL db. If the movie/song is in the library then getTitle() will return the title. If the movie/song is not in the library, then this function returns an empty string and you could use getPlayingFile() as an alternative. The getPlayingFile() method will return the full path of the file playing if I remember correctly.

Code:
# logs entry to database  -> this is where you would call the GUI.ShowNotification JSON method of the remote XBMC's  
    def logEntry(self, action):
        now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        entry = ('timestamp: %s, hostname: %s, userprofile: %s, action: %s, filename: %s, title: %s'
                    %(now, self.hostname, self.userprofile, action, self.filename, self.title))
        log(entry)
        self.db.insertLogEntry(self.hostname, self.userprofile, action, self.filename, self.title)

    def onPlayBackStarted(self):
        self.userprofile = xbmc.getInfoLabel('System.ProfileName')
        try:
            self.filename = self.getPlayingFile()
            if self.isPlayingVideo():
                self.title = self.getVideoInfoTag().getTitle()
            elif self.isPlayingAudio:
                self.getMusicInfoTag().getTitle()
            else:
                self.title = ""
        except Exception, err:
            log(str(err))
        self.logEntry('onPlayBackStarted()')

    def onPlayBackEnded(self):
        self.logEntry('onPlayBackEnded()')
        self.userprofile = ""
        self.filename = ""
        self.title = ""

    def onPlayBackStopped(self):
        self.logEntry('onPlayBackStopped()')
        self.userprofile = ""
        self.filename = ""
        self.title = ""

    def onPlayBackPaused(self):
        self.logEntry('onPlayBackPaused()')

    def onPlayBackResumed(self):
        self.logEntry('onPlayBackResumed()')
Reply

Logout Mark Read Team Forum Stats Members Help
Broadcast "now playing" notification to other XBMC instances in LAN0