mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
random: make --album work with --time
This commit is contained in:
parent
fc8411f3b8
commit
1bc5456986
1 changed files with 4 additions and 0 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Reference in a new issue