Kodi Community Forum
[Request] Now playing popup - 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: [Request] Now playing popup (/showthread.php?tid=168563)



[Request] Now playing popup - endlesslyonline - 2013-07-06

Here I am again, with a script request.

CAn someone please help me with a script, or as I understand, it should rather be a service, which creates a popup, for say 5 seconds, with the currently playing tv show, episode number and title.

I have 2 smartplaylist, one that plays 25 random watched sitcoms, and one that plays random unwatched. So I would love a popup coming up as soon as the next episode starts displaying the above info

Thanks


RE: [Request] Now playing popup - pkscout - 2013-07-07

You can execute the built in command XBMC.Notification this way:

Code:
import xbmc

command = 'XBMC.Notification(%s, %s, %s, %s)' % (thetitle, thebody, timetoshow, theiconpath)
xbmc.executebuiltin(command)

You don't have much space in the popup, but you should be able to use the title filed for the TV show name and then combine the episode number and episode title into the body. Note that timetoshow and icon are optional.

I'll have to leave to you the exercise of figuring out what show just started playing. And i know that's probably the hard part, as you have to either have XBMC trigger something when a show starts or you have to have some kind of service that constantly checks the currently playing show to see if it's different than the last time you asked.


RE: [Request] Now playing popup - AddonScriptorDE - 2013-07-23

You can also use the default info screen (Keyboard key 'i') to show this stuff (depending on the skin). I only found the WindowID for the InfoScreen with player controls (Keyboard key 'Enter'), but maybe you also find the correct ID without. I modified an existing service addon and implemented both methods (InfoScreen + Notification) for you. The dialog only appears when playing episodes.

Note: If you edit the script, you have to restart xbmc because its executed only once and keeps running in the background...

Code:
import xbmc

class PlayerEvents(xbmc.Player):
    
    def onPlayBackStarted(self):
    
        if xbmc.getInfoLabel('VideoPlayer.Episode'):
            delayInSeconds = 3
            timeToShowInSeconds = 5
            xbmc.sleep(delayInSeconds*1000)
            
            #Style1
            """xbmc.executebuiltin('XBMC.ActivateWindow(12901)')
            xbmc.sleep(timeToShowInSeconds*1000)
            xbmc.executebuiltin('XBMC.ActivateWindow(12005)')"""
            
            #Style2
            title = 'Now playing:'
            tvshowTitle = xbmc.getInfoLabel('VideoPlayer.TVShowTitle')
            episodeTitle = xbmc.getInfoLabel('VideoPlayer.Title')
            episodeNr = xbmc.getInfoLabel('VideoPlayer.Episode')
            seasonNr = xbmc.getInfoLabel('VideoPlayer.Season')
            thumb = xbmc.getInfoImage('VideoPlayer.Cover')
            body = '%s: S%sE%s - %s' % (tvshowTitle, seasonNr, episodeNr, episodeTitle)
            command = 'XBMC.Notification(%s, %s, %s, %s)' % (title, body, timeToShowInSeconds, thumb)
            xbmc.executebuiltin(command)
        
player=PlayerEvents()
while (not xbmc.abortRequested):
  xbmc.sleep(100)

Download full service addon as zip


RE: [Request] Now playing popup - endlesslyonline - 2013-07-26

AddonScripter, thank you very much for your time. It is appreciated