[Request] Now playing popup

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
endlesslyonline Offline
Senior Member
Posts: 168
Joined: Aug 2011
Reputation: 2
Post: #1
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
find quote
pkscout Offline
Posting Freak
Posts: 1,087
Joined: Jan 2011
Reputation: 23
Location: Honolulu, HI
Post: #2
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.
find quote
AddonScriptorDE Offline
Skilled Python Coder
Posts: 707
Joined: May 2012
Reputation: 56
Location: Germany
Post: #3
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

https://github.com/AddonScriptorDE
Categories | Chrome Launcher | Commands | SimplePlaylists | SubCentral | Video Screensavers | XBMC WebBrowser
BestOfYoutube | CBSnews | DailyMotion | Discovery Networks | EuroNews | IGN | LoveFilm | NetfliXBMC | RedBull | Reddit | TheOnion | TIME | VEVO TV | VICE | WIRED | YouTube Billboard/Channels
German Add-ons
(This post was last modified: 2013-07-23 20:27 by AddonScriptorDE.)
find quote
endlesslyonline Offline
Senior Member
Posts: 168
Joined: Aug 2011
Reputation: 2
Post: #4
AddonScripter, thank you very much for your time. It is appreciated
find quote