0
@@ -184,32 +184,45 @@ class tvdb:
0
if len(allSeries) == 0:
0
self.log.debug('Series result returned zero')
0
- raise tvdb_shownotfound("Show-name search returned zero results
")
0
+ raise tvdb_shownotfound("Show-name search returned zero results
(cannot find show on TVDB)")
0
- if self.config['interactive']:
0
+ if not self.config['interactive']:
0
+ self.log.debug('Auto-selecting first search result')
0
self.log.debug('Interactivily selecting show')
0
- for i in range(len(allSeries[:6])):
0
+ print "TVDB Search Results:"
0
+ for i in range(len(allSeries[:6])): # list first 6 search results
0
i_show = i + 1 # Start at more human readable number 1 (not zero)
0
self.log.debug( 'Showing allSeries[%s] = %s)' % (i_show,allSeries[i]) )
0
print "%s -> %s (tvdb id: %s)" % (i_show,allSeries[i]['name'].encode("UTF-8","ignore"),allSeries[i]['sid'].encode("UTF-8","ignore"))
0
- print "Enter choice (first number):"
0
- self.log.debug( 'Got choice of: %s' % (ans))
0
- selected_id = int(ans) - 1 # The human entered 1 as first result, not zero
0
- self.log.debug( 'Trying to return ID: %d' % (selected_id))
0
- return allSeries[ selected_id ]
0
- except ValueError: # Input was not number
0
- self.log.debug('Got quit command (q)')
0
- raise tvdb_userabort("User aborted")
0
- self.log.debug('Unknown keypress %s' % (ans))
0
- raise tvdb_userabort("Invalid keypress") # TODO: Better UI
0
- self.log.debug('Auto-selecting first search result')
0
+ while not valid_input:
0
+ print "Enter choice (first number, ? for help):"
0
+ except KeyboardInterrupt:
0
+ raise tvdb_userabort("User aborted ('^c' keyboard interupt)")
0
+ self.log.debug( 'Got choice of: %s' % (ans))
0
+ selected_id = int(ans) - 1 # The human entered 1 as first result, not zero
0
+ self.log.debug( 'Trying to return ID: %d' % (selected_id))
0
+ return allSeries[ selected_id ]
0
+ except ValueError: # Input was not number
0
+ self.log.debug('Got quit command (q)')
0
+ raise tvdb_userabort("User aborted ('q' quit command)")
0
+ print "# Enter the number that corresponds to the correct show."
0
+ print "# ? - this help"
0
+ print "# q - abort tvnamer"
0
+ self.log.debug('Unknown keypress %s' % (ans))
0
+ #end while not valid_input
Comments
No one has commented yet.