Пример #1
0
class RealClient(Client):
    
    def __init__(self):
        print "RealClient: Initializing RealClient"
        self.connectionManager = ConnectionManager()
        self.client = self.connectionManager.getClient()
        
    def reset(self):
        print "RealClient: Reseting"
        self.client.play(0)
        
    def goToNextSong(self):
        print "RealClient: Skipping to goToPreviousSong song"
        self.client.next()
    
    def goToPreviousSong(self):
        print "RealClient: Skipping to goToNextSong song"
        self.client.previous()
    
    def getCurrentSong(self):
        print "RealClient: Retrieving current song"
        return self.client.currentsong()
    
    def findSongAtPosition(self, position):
        print "RealClient: Searching song at position: ", position
        if position < 0:
            raise CommandError("Song not found, position index less then zero")
        song = None
        playlist = self.client.playlistinfo(int(position))
        if playlist is not None and len(playlist) > 0:
            song = playlist[0]
        if song is None:
            raise CommandError("Song not found")
        return song
    
    def playSongAtPosition(self, position):
        print "RealClient: Playing song at position: ", position
        self.client.play(position)
Пример #2
0
 def __init__(self):
     print "RealClient: Initializing RealClient"
     self.connectionManager = ConnectionManager()
     self.client = self.connectionManager.getClient()