(disc, index)
| 45 | disc.quit() |
| 46 | |
| 47 | def cmd_line(disc, index): |
| 48 | while True: |
| 49 | prompt = get_prompt() |
| 50 | if prompt == 'nop': |
| 51 | pass |
| 52 | elif prompt == 'help': |
| 53 | print 'help: get this message' |
| 54 | print 'nop: does nothing' |
| 55 | print 'total: shows total tracks' |
| 56 | print 'play: plays the selected track' |
| 57 | print 'quit: leaves the commmand line' |
| 58 | elif prompt == 'total': |
| 59 | print 'There are %s tracks.' % len(index) |
| 60 | elif prompt == 'play': |
| 61 | track = get_track(len(index)) |
| 62 | if track != -1: |
| 63 | disc.play(index[track]) |
| 64 | else: |
| 65 | print 'Okay ...' |
| 66 | elif prompt == 'quit': |
| 67 | return |
| 68 | else: |
| 69 | print '"%s" cannot be understood.' % prompt |
| 70 | |
| 71 | def get_prompt(): |
| 72 | try: |
no test coverage detected