- try:
- opts.playliststart = int(opts.playliststart)
- if opts.playliststart <= 0:
- raise ValueError(u'Playlist start must be positive')
- except (TypeError, ValueError):
- parser.error(u'invalid playlist start number specified')
- try:
- opts.playlistend = int(opts.playlistend)
- if opts.playlistend != -1 and (opts.playlistend <= 0 or opts.playlistend < opts.playliststart):
- raise ValueError(u'Playlist end must be greater than playlist start')
- except (TypeError, ValueError):
- parser.error(u'invalid playlist end number specified')
+ if opts.playliststart <= 0:
+ raise ValueError(u'Playlist start must be positive')
+ if opts.playlistend not in (-1, None) and opts.playlistend < opts.playliststart:
+ raise ValueError(u'Playlist end must be greater than playlist start')