diff --git a/README.md b/README.md index c1d84c7..0e1f5fe 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,13 @@ To ensure the bridge can extract correct metadata, you must configure Winamp to *(Note: The separator between Artist, Album, and Title should be an en-dash `–` or a simple dash `-`)*. ### 3. Linux Dependencies -Install the required Python libraries and `wmctrl`: +Install the required Python libraries, `wmctrl`, and `libnotify` (for notifications): ```bash # Python dependencies pip install requests pydbus beautifulsoup4 pygobject -# System tool -sudo dnf install wmctrl # or sudo apt install wmctrl +# System tools +sudo dnf install wmctrl libnotify # or sudo apt install wmctrl libnotify ``` ## Installation & Setup diff --git a/winamp_mpris.py b/winamp_mpris.py index 37731c6..a4aec2b 100755 --- a/winamp_mpris.py +++ b/winamp_mpris.py @@ -83,10 +83,17 @@ class WinampMPRIS: self._last_update_ts = time.time() def _request(self, endpoint): + print(f"COMMAND RECEIVED: {endpoint}") try: - requests.get(f"{BASE_URL}/{endpoint}", auth=AUTH, timeout=2) + r = requests.get(f"{BASE_URL}/{endpoint}", auth=AUTH, timeout=2) + if r.status_code != 200: + msg = f"Failed to send '{endpoint}' to Winamp (Status {r.status_code})." + print(f"ERROR: {msg}") + subprocess.run(["notify-send", "-u", "critical", "-t", "3000", "Winamp Bridge Error", msg]) except Exception as e: - print(f"Request failed: {e}") + msg = f"Connection error while sending '{endpoint}': {e}" + print(f"ERROR: {msg}") + subprocess.run(["notify-send", "-u", "critical", "-t", "3000", "Winamp Bridge Offline", msg]) # MPRIS Methods def Next(self): self._request("next")