|
@@ -241,16 +241,16 @@ def get_parser():
|
|
|
|
|
|
filters = p.add_argument_group('filters', 'Select only items that match '
|
|
|
'these conditions')
|
|
|
+ filters.add_argument('--min-len', default=0, type=DurationType,
|
|
|
+ help='Exclude any audio that is shorter '
|
|
|
+ 'than MIN_LEN seconds')
|
|
|
filters.add_argument('--max-len', default=0, type=DurationType,
|
|
|
help='Exclude any audio that is longer '
|
|
|
'than MAX_LEN seconds')
|
|
|
filters.add_argument('--sort-by', default='no', type=str,
|
|
|
- choices=('random', 'date'))
|
|
|
+ choices=('random', 'date', 'duration'))
|
|
|
filters.add_argument('--reverse', default=False,
|
|
|
action='store_true', help='Reverse list order')
|
|
|
- filters.add_argument('--min-len', default=0, type=DurationType,
|
|
|
- help='Exclude any audio that is shorter '
|
|
|
- 'than MIN_LEN seconds')
|
|
|
|
|
|
filters.add_argument('--min-age', default=datetime.timedelta(),
|
|
|
type=TimeDeltaType,
|
|
@@ -363,6 +363,8 @@ def main():
|
|
|
random.shuffle(audios)
|
|
|
elif args.sort_by == 'date':
|
|
|
audios.sort(key=lambda x: x.age)
|
|
|
+ elif args.sort_by == 'duration':
|
|
|
+ audios.sort(key=lambda x: x.duration)
|
|
|
|
|
|
if args.reverse:
|
|
|
audios.reverse()
|