Beispiel #1
0
     elif command.startswith('rate'):
         (id, rating) = commands.rate_song(command[4:], db)
         # Also apply the rating to the current songs
         for song in songs:
             if song.id == id:
                 song.user_rating = rating 
                 break
     elif command == 'shuffle':
         random.shuffle(songs)
     elif command.startswith('update'):
         commands.update_song(command[6:], db)
     elif command.startswith('delete'):
         commands.delete_song(command[6:], db)
     elif command.startswith('info'):
         show_page = False
         commands.info(command[4:], db)
     elif command == 'req':
         show_page = False
         commands.request()
     elif command == 'req_times':
         show_page = False
         commands.print_request_time_info()
     elif command == '':
         # Do nothing, which lets the user easily view the page again
         continue
     else:
         show_page = False
         print 'Invalid command'
 # All errors are recoverable, so just print them out
 except commands.InvalidArgumentError, e:
     show_page = False
Beispiel #2
0
 while (True):
     command = raw_input("anfo> ")
     command = command.strip()
     try:
         # Just check which command was given, and dispatch.
         if command == 'alfador':
             commands.ALFADOR()
         elif command.startswith('delete'):
             commands.delete_song(command[6:], db)
         elif command in ['exit', 'quit', 'q']:
             exit()
         elif command == 'help':
             print
             print help_str
         elif command.startswith('info'):
             commands.info(command[4:], db)
         elif command == 'queue':
             commands.queue(db)
         elif command == 'queue_songs':
             # sqlite3 might give an error on a bad query
             try:
                 songs = commands.queue_songs(db)
                 pageviewer.pageviewer(songs, db)
             except sqlite3.Error, e:
                 print e
         elif command.startswith('query'):
             # sqlite3 might give an error on a bad query
             try:
                 songs = commands.query(command[5:], db)
                 pageviewer.pageviewer(songs, db)
             except sqlite3.Error, e:
Beispiel #3
0
 def test_info_hosts(self):
     response = info("info hosts", self.hosts)
     self.assertIs(type(response), str)
Beispiel #4
0
 def test_info_host(self):
     response = info("info host MiniVerse", self.hosts)
     self.assertIs(type(response), str)
     response = info("info host host1", self.hosts)
Beispiel #5
0
 def handle_info_command(message):
     commands.info(bot, message)