first stab at music screensaver
#1
Hi All,
i need some help..

i was looking for a screensaver.. which i could feed a music playlist.. and make it play.. whenever my xbmc is idle..
not having found anything.. i started creating it myselve..

but now i am stuck...and need some help.
Code:
import sys
import xbmcaddon
import xbmcgui
import xbmc
import urllib

Addon = xbmcaddon.Addon('script.screensaver.PlayPlaylist')


__scriptname__ = Addon.getAddonInfo('name')
__path__ = Addon.getAddonInfo('path')
previousfilename = 'nothing'
temppl = ''

class Screensaver(xbmcgui.WindowXMLDialog):

    class ExitMonitor(xbmc.Monitor):

        def __init__(self, exit_callback):
            self.exit_callback = exit_callback

        def onScreensaverDeactivated(self):
            print '3 ExitMonitor: sending exit_callback'
            self.exit_callback()

    def onInit(self):
        global previousfilename
        global temppl
        print '2 Screensaver: onInit'
        if xbmc.Player().isPlaying():
         previousfilename = urllib.unquote(xbmc.Player().getPlayingFile()).decode('utf-8')
         tempfn=xbmc.Player().getPlayingFile()
         temppl = xbmc.PlayList(1)
         temppl.clear()
         temppl.add(tempfn)
         print 'Player was playing ' + previousfilename
        else:
            print 'Not Playing'
        pl = xbmc.PlayList(0)
        pl.clear()
        pl.load('c:\\temp\\myplaylist.pls')
        pl.shuffle()
        print '3 Launching ' 'c:\\temp\\myplaylist.pls'
        xbmc.Player().play(pl)
        self.monitor = self.ExitMonitor(self.exit)

    def exit(self):
        global previousfilename
        global temppl
        print '4 Screensaver: Exit requested'
        xbmc.Player().stop()
        print 'Player play:' + previousfilename
        xbmc.Player().play(temppl)
        #xbmc.Player().pause()
        self.close()


if __name__ == '__main__':
    print '1 Python Screensaver Started'
    screensaver_gui = Screensaver(
            'script-%s-main.xml' % __scriptname__,
            __path__,
            'default',
        )
    screensaver_gui.doModal()
    print '5 Python Screensaver Exited'
    del screensaver_gui
    sys.modules.clear()

the idea is.. see what is paused in the player.. get this filename and store it.. untill the screensaver stops..
then.. launch the previous file again.. and maybe pause again..
i know.. very basic functionality.

but i cannot get it to start playing again after the screensaver stops... the filename is there in the subroutine..
but the debug message says..

NOTICE: Player was playing smb://LP/3TB/Videos/movies/The.Long.Kiss.Goodnight.1996.BluRay.720p.H264/The.Long.Kiss.Goodnight.1996.BluRay.720p.H264.mp4
.......
NOTICE: Player playConfusedmb://LP/3TB/Videos/movies/The.Long.Kiss.Goodnight.1996.BluRay.720p.H264/The.Long.Kiss.Goodnight.1996.BluRay.720p.H264.mp4
DEBUG: CThumbExtractor:Big GrinoWork - trying to extract filestream details from video file D:\downloads\Videos\done\The.Long.Kiss.Goodnight.1996.BluRay.720p.H264\The.Long.Kiss.Goodnight.1996.BluRay.720p.H264.mp4
21:38:03 T:2172 NOTICE: Thread Jobworker start, auto delete: true
21:38:03 T:8004 DEBUG: CThumbExtractor:Big GrinoWork - trying to extract filestream details from video file smb://lp/videos/done/The.Long.Kiss.Goodnight.1996.BluRay.720p.H264/The.Long.Kiss.Goodnight.1996.BluRay.720p.H264.mp4
21:38:03 T:4256 DEBUG: CVideoDatabase::RunQuery took 24 ms for 10 items query: select * from episodeview ORDER BY dateAdded desc, idEpisode desc LIMIT 10
21:38:03 T:8004 DEBUG: Trying to connect to \\lp\videos with username() and password(XXXX)
21:38:03 T:8004 ERROR: CWINFileSMB: Unable to open file \\lp\videos\done\The.Long.Kiss.Goodnight.1996.BluRay.720p.H264\The.Long.Kiss.Goodnight.1996.BluRay.720p.H264.mp4 Error: 3


Huh does it not use the same credentials ?

i guess the problem is in xbmc.Player().play(temppl)
i tried giving it previousfilename directly instead of the temppl..
any suggestions ?




...
just noticed.. that the pathname for the file has changed?? problem with my library probably.
Reply

Logout Mark Read Team Forum Stats Members Help
first stab at music screensaver 0