Пример #1
0
     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:
             print e
     elif command.startswith('rate'):
         commands.rate_song(command[4:], db)
     elif command.startswith('update '):
         commands.update_song(command[6:], db)
     elif command == 'remake_all':
         commands.remake_all(db)
     elif command == 'update_favorites':
         commands.update_favorites(db)
     elif command == 'req':
         commands.request()
     elif command == 'req_times':
         commands.print_request_time_info()
     elif command == 'export_duplicates':
         commands.find_duplicates(db)
     else:
         print 'Invalid command.'
 # All errors are recoverable
Пример #2
0
         page = 1
     except sqlite3.Error, e:
         show_page = False
         print e
 elif command.startswith('query'):
     # Might get an error, and also need to update certain variables
     try:
         songs = commands.query(command[5:], db)
         num_songs = len(songs)
         num_pages = max(num_songs - 1, 0) / songs_per_page + 1
         page = 1
     except sqlite3.Error, e:
         show_page = False
         print e
 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':
Пример #3
0
     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:
             print e
     elif command.startswith('rate'):
         commands.rate_song(command[4:], db)
     elif command.startswith('update '):
         commands.update_song(command[6:], db)
     elif command == 'remake_all':
         commands.remake_all(db)
     elif command == 'update_favorites':
         commands.update_favorites(db)
     elif command == 'req':
         commands.request()
     elif command == 'req_times':
         commands.print_request_time_info()
     elif command == 'export_duplicates':
         commands.find_duplicates(db)
     else:
         print 'Invalid command.'
 # All errors are recoverable