MCPcopy
hub / github.com/beetbox/beets / random_func

Function random_func

beetsplug/random.py:33–46  ·  view source on GitHub ↗

Select some random items or albums and print the results.

(lib: Library, opts: optparse.Values, args: list[str])

Source from the content-addressed store, hash-verified

31
32
33def random_func(lib: Library, opts: optparse.Values, args: list[str]):
34 """Select some random items or albums and print the results."""
35 # Fetch all the objects matching the query into a list.
36 objs = lib.albums(args) if opts.album else lib.items(args)
37
38 # Print a random subset.
39 for obj in random_objs(
40 objs=objs,
41 equal_chance_field=opts.field,
42 number=opts.number,
43 time_minutes=opts.time,
44 equal_chance=opts.equal_chance,
45 ):
46 print_(format(obj))
47
48
49random_cmd = Subcommand("random", help="choose a random track or album")

Callers

nothing calls this directly

Calls 4

print_Function · 0.90
random_objsFunction · 0.85
albumsMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected