Skip to content

Commit

Permalink
remove nostdout function
Browse files Browse the repository at this point in the history
  • Loading branch information
diomekes committed Jan 10, 2017
1 parent e779c02 commit 0f9ace5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion beetsplug/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _play_command(self, lib, opts, args):
# Perform item query and add tracks to playlist.
else:
if opts.random:
selection = random.random_func(lib, opts, args)
selection = random.random_func(lib, opts, args,
print_list=False)
else:
selection = lib.items(ui.decargs(args))
Expand Down
11 changes: 7 additions & 4 deletions beetsplug/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def random_objs(objs, album, number=1, time=None, equal_chance=False):
return _take(perm, number)


def random_func(lib, opts, args):
def random_func(lib, opts, args, print_list=True):
"""Select some random items or albums and print the results.
"""
# Fetch all the objects matching the query into a list.
Expand All @@ -125,11 +125,14 @@ def random_func(lib, opts, args):
# Print a random subset.
objs = random_objs(objs, opts.album, opts.number, opts.time,
opts.equal_chance)
for obj in objs:
print_(format(obj))

if print_list:
for obj in objs:
print_(format(obj))

# Return random subset to be used by other plugins.
return objs
else:
return objs

random_cmd = Subcommand('random',
help=u'choose a random track or album')
Expand Down

0 comments on commit 0f9ace5

Please sign in to comment.