def process(self):
     try:
         currentFile=MrcFile.MrcFile('', True, False)
         if self.query.fileid:
             currentFile=MrcFile.getFromFileCache(self.query.fileid)
         if not currentFile.path:
             MrcLogger.error('failed to get file from cache with file id '+self.query.fileid)
             self.error='failed to get file from cache with file id '+self.query.fileid
         if currentFile.ismusicfile:
             MrcPlayer.instance().playFile(currentFile)
         else:
             self.reply.error='not a music file: '+currentFile.path
     except Exception as e:
         self.reply.error=e.__str__()
 def process(self):
     try:
         self.reply.files, self.reply.currentFileIndex, self.reply.isPaused, self.reply.error = (
             MrcPlayer.instance().getPlayList()
         )
     except Exception as e:
         self.reply.error = e.__str__()
    def process(self):
        try:
            currentFile = MrcFile.MrcFile("", True, False)

            if self.query.fileid:
                currentFile = MrcFile.getFromFileCache(self.query.fileid)
            if not currentFile.path:
                MrcLogger.error("failed to get file from cache with file id " + self.query.fileid)
                self.reply.error = "failed to get file from cache with file id " + self.query.fileid
                return
            if not currentFile.isdir:
                self.reply.error = "not a music directory: " + currentFile.path
                return

            self.gatherMusicFiles(currentFile)

            if not self.files:
                self.reply.error = "no music file in: " + currentFile.path
                return

            MrcPlayer.instance().playFiles(self.files)
        except Exception as e:
            self.reply.error = e.__str__()
 def process(self):
     try:
         MrcPlayer.instance().unpause()
     except Exception as e:
         self.reply.error=e.__str__()
    usage()
    exit()

portnum=0
try:
    portnum=int(sys.argv[1])
except ValueError:
    print 'ERROR: you need to specify a port number as first argument!!'
    MrcLogger.error('first argument failed to be parsed as a port number : exiting...')
    usage()
    exit()

httpserverthread = MrcHttpServer.MrcHTTPServerThread(portnum)
httpserverthread.start()

MrcPlayer.instance().wakeUp()

time.sleep(2)

# userinput=''
# while(not userinput):
#     sys.stdout.write(' > ')
#     userinput=sys.stdin.readline()
#     if(not interpret(userinput)):
#         break
#     userinput=''

# MrcPlayer.instance().goToSleep()
# httpserverthread.server.shutdown()

# time.sleep(2)
 def process(self):
     try:
         MrcPlayer.instance().setVolumeUp()
     except Exception as e:
         self.reply.error=e.__str__()