mirror of
https://github.com/beetbox/beets.git
synced 2025-12-08 01:23:09 +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 = []
|
objs = []
|
||||||
|
|
||||||
for item in objs_shuffled:
|
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:
|
if (total_time + item.length) <= time_sec:
|
||||||
objs.append(item)
|
objs.append(item)
|
||||||
total_time += item.length
|
total_time += item.length
|
||||||
|
|
@ -63,6 +65,8 @@ def random_item(lib, opts, args):
|
||||||
if not objs_by_artists:
|
if not objs_by_artists:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if opts.album:
|
||||||
|
item.length = sum(a.length for a in item.items())
|
||||||
if (total_time + item.length) <= time_sec:
|
if (total_time + item.length) <= time_sec:
|
||||||
artist = random.choice(list(objs_by_artists.keys()))
|
artist = random.choice(list(objs_by_artists.keys()))
|
||||||
objs_from_artist = objs_by_artists[artist]
|
objs_from_artist = objs_by_artists[artist]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue