diff options
author | Wolfgang Müller | 2024-09-16 20:45:35 +0200 |
---|---|---|
committer | Wolfgang Müller | 2024-09-16 20:48:58 +0200 |
commit | 57b1170b1603c814af6bdb9906581912b6e7c29b (patch) | |
tree | 021822de56a3a0e3f1b28a464c29aa63ce28b675 /beetsplug | |
parent | bf3cece9b9de955c1df15bc1335dd96cd36a48c3 (diff) | |
download | beets-oriole-trunk.tar.gz |
Stop trying to launch the browser if we do not have a path. Redirect
stderr and stdout to /dev/null to avoid spurious messages in the
terminal.
Diffstat (limited to '')
-rw-r--r-- | beetsplug/browse.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/beetsplug/browse.py b/beetsplug/browse.py index bb06a91..c1d37c7 100644 --- a/beetsplug/browse.py +++ b/beetsplug/browse.py @@ -70,8 +70,17 @@ class BrowseCommand(Subcommand): webbrowser.open(MUSICBRAINZ_LOOKUP + mbid) def browse_filesystem(self, item, _): + path = item.get("path") + + if not path: + return + try: - subprocess.Popen(self.explorer.split(" ") + [item.get("path")]) + subprocess.Popen( + self.explorer.split() + [path.decode()], + stderr=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + ) except OSError as err: raise UserError(err) from err |