From 1bc54569860264e4d6184f59f5373f5869fc983b Mon Sep 17 00:00:00 2001 From: diomekes Date: Sat, 17 Dec 2016 17:24:58 -0500 Subject: [PATCH] random: make --album work with --time --- beetsplug/random.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beetsplug/random.py b/beetsplug/random.py index 0dc438927..d719b5910 100644 --- a/beetsplug/random.py +++ b/beetsplug/random.py @@ -42,6 +42,8 @@ def random_item(lib, opts, args): objs = [] for item in objs_shuffled: + if opts.album: + item.length = sum(a.length for a in item.items()) if (total_time + item.length) <= time_sec: objs.append(item) total_time += item.length @@ -63,6 +65,8 @@ def random_item(lib, opts, args): if not objs_by_artists: break + if opts.album: + item.length = sum(a.length for a in item.items()) if (total_time + item.length) <= time_sec: artist = random.choice(list(objs_by_artists.keys())) objs_from_artist = objs_by_artists[artist]