2010-12-24, 01:00
PHP Code:
def _fade_volume( self, out=True ):
##############################################
#self.settings = { "slideshow_music_volume": ( 1 - abs( float( Addon.getSetting( "slideshow_music_volume" ) ) ) / 60 ) * 100 }
# set initial start/end values
volumes = range( 0, self.settings[ "slideshow_music_volume" ] )
# if fading out reverse order
if ( out ):
volumes.reverse()
# calc sleep time, 2 seconds for fade time
sleep_time = int( float( 2000 ) / len( volumes ) )
# loop thru and set volume
for volume in volumes:
xbmc.executebuiltin( "XBMC.SetVolume(%d)" % ( volume, ) )
# sleep
xbmc.sleep( sleep_time )
here's a better version, you can place it anywhere insid the class in trivia.py. where to call it. that's a good question, my file is different, but try here
PHP Code:
def _show_intro_outro( self, type="intro" ):
is_playing = "True"
if ( type == "outro" ):
print "## Outro ##"
self._fade_volume()
self._play_video_playlist()
else:
--------------------------------------------------------
def _play_video_playlist( self ):
# set this to -1 as True and False are taken
self.exiting = -1
# cancel timers
self._cancel_timers()
# turn screensaver back on
xbmc.executehttpapi( "SetGUISetting(3,screensaver.mode,%s)" % self.screensaver )
# we play the video playlist here so the screen does not flash
xbmc.Player().play( self.playlist )
self._fade_volume(False)
# close trivia slide show
self.close()