aboutsummaryrefslogtreecommitdiffstats
path: root/beetsplug
diff options
context:
space:
mode:
authorWolfgang Müller2024-09-16 20:45:35 +0200
committerWolfgang Müller2024-09-16 20:48:58 +0200
commit57b1170b1603c814af6bdb9906581912b6e7c29b (patch)
tree021822de56a3a0e3f1b28a464c29aa63ce28b675 /beetsplug
parentbf3cece9b9de955c1df15bc1335dd96cd36a48c3 (diff)
downloadbeets-oriole-57b1170b1603c814af6bdb9906581912b6e7c29b.tar.gz
browse: Improve handling of browse_filesystemHEAD0.1.2trunk
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 'beetsplug')
-rw-r--r--beetsplug/browse.py11
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