|
@@ -157,13 +157,15 @@ def get_parser():
|
|
|
|
|
|
filters = p.add_argument_group('filters', 'Select only items that match these conditions')
|
|
|
filters.add_argument('--max-len', default=0, type=int,
|
|
|
- help='Exclude any audio that is longer than MAXLEN seconds')
|
|
|
+ help='Exclude any audio that is longer than MAXLEN seconds')
|
|
|
filters.add_argument('--random', default=False,
|
|
|
- action='store_true', help='Pick randomly')
|
|
|
-
|
|
|
+ action='store_true', help='Pick randomly')
|
|
|
+ filters.add_argument('--min-len', default=0, type=int,
|
|
|
+ help='Exclude any audio that is shorter than MIN_LEN seconds')
|
|
|
p.add_argument('--start', default=0, type=int,
|
|
|
help='0-indexed start number. '
|
|
|
'By default, play from most recent')
|
|
|
+
|
|
|
p.add_argument('--howmany', default=1, type=int,
|
|
|
help='If not specified, only 1 will be played')
|
|
|
p.add_argument('--slotsize', help='Seconds between each audio', type=int)
|
|
@@ -222,9 +224,10 @@ def main():
|
|
|
tree = get_tree(url)
|
|
|
if not args.group:
|
|
|
# get audio urls, removing those that are too long
|
|
|
- audios += [audio for audio in get_urls(tree)
|
|
|
- if args.max_len == 0 or
|
|
|
- audio.duration <= args.max_len]
|
|
|
+ audios += [audio for audio in get_urls(tree) if
|
|
|
+ (args.max_len == 0 or audio.duration <= args.max_len) and
|
|
|
+ (args.min_len == 0 or audio.duration >= args.min_len)
|
|
|
+ ]
|
|
|
else:
|
|
|
groups = get_grouped_urls(tree)
|
|
|
audios += [groups[g] for g in groups.keys()
|