Exemple #1
0
 def __init__(self):
     self.client = RealClient()
     self.playlistManager = PlaylistManager(self.client);
     self.invoker = LoggingInvoker()
Exemple #2
0
class PlaylistClient():    
    
    def __init__(self):
        self.client = RealClient()
        self.playlistManager = PlaylistManager(self.client);
        self.invoker = LoggingInvoker()
        
    def playNextAlbum(self):
        command = PlayNextAlbumCommand(self.playlistManager)
        self.invoker.setCommand(command)
        try:
            self.invoker.executeCommand()
        except PlaylistManagerException as detail:
            print "Exception occurred: ", detail.msg
            self.client.reset()    
    
    def playPreviousAlbum(self):
        command = PlayPreviousAlbumCommand(self.playlistManager)
        self.invoker.setCommand(command)
        try:
            self.invoker.executeCommand()
        except PlaylistManagerException as detail:
            print "Exception occurred: ", detail.msg
            self.client.reset()    
                
    def playNextSong(self):
        command = PlayNextSongCommand(self.playlistManager)
        self.invoker.setCommand(command)
        try:
            self.invoker.executeCommand()
        except PlaylistManagerException as detail:
            print "Exception occurred: ", detail.msg
            self.client.reset()    
                
    def playPreviousSong(self):
        command = PlayPreviousSongCommand(self.playlistManager)
        self.invoker.setCommand(command)
        try:
            self.invoker.executeCommand()
        except PlaylistManagerException as detail:
            print "Exception occurred: ", detail.msg
            self.client.reset()