Add hassbridge
A bridge application that exposes Home Assistant media players to MPRIS
This commit is contained in:
parent
ae315445dd
commit
8ccc0ab2a9
3 changed files with 63 additions and 0 deletions
|
@ -270,6 +270,7 @@
|
|||
packages = {
|
||||
dnspyre = pkgs.callPackage ./pkgs/dnspyre { };
|
||||
git-repo-go = pkgs.callPackage ./pkgs/git-repo-go { };
|
||||
hassbridge = pkgs.callPackage ./pkgs/hassbridge { };
|
||||
tinyows = pkgs.callPackage ./pkgs/tinyows { };
|
||||
};
|
||||
|
||||
|
|
23
pkgs/hassbridge/0001-fix-xesam-artist.patch
Normal file
23
pkgs/hassbridge/0001-fix-xesam-artist.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
diff --git a/hassbridge/playerinterface.py b/hassbridge/playerinterface.py
|
||||
index 34159c8..0c337c2 100644
|
||||
--- a/hassbridge/playerinterface.py
|
||||
+++ b/hassbridge/playerinterface.py
|
||||
@@ -279,7 +279,6 @@ class PlayerInterface(ServiceInterface):
|
||||
metadata["mpris:length"] = Variant("x", duration)
|
||||
|
||||
xesam_infos = {
|
||||
- "media_artist": "xesam:artist",
|
||||
"media_album_name": "xesam:album",
|
||||
"media_title": "xesam:title",
|
||||
}
|
||||
@@ -288,6 +287,10 @@ class PlayerInterface(ServiceInterface):
|
||||
if val is not None:
|
||||
metadata[xesam_key] = Variant("s", val)
|
||||
|
||||
+ artist = self.data.get("media_artist")
|
||||
+ if artist is not None:
|
||||
+ metadata["xesam:artist"] = Variant("as", [artist])
|
||||
+
|
||||
entity_picture = self.data.get("entity_picture")
|
||||
if entity_picture is not None:
|
||||
metadata["mpris:artUrl"] = Variant(
|
39
pkgs/hassbridge/default.nix
Normal file
39
pkgs/hassbridge/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
lib,
|
||||
python3,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "hassbridge";
|
||||
version = "unstable-2024-08-10";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rytilahti";
|
||||
repo = "homeassistant-mpris-bridge";
|
||||
rev = "b62f87033be971d265e1e112dc9a3a38dc65bbbd";
|
||||
hash = "sha256-M68H806wQtsgqWeRH4j07dk1E5PzT7e0oEtsE6cl+c0=";
|
||||
};
|
||||
|
||||
patches = [ ./0001-fix-xesam-artist.patch ];
|
||||
|
||||
nativeBuildInputs = [ python3.pkgs.poetry-core ];
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
anyio
|
||||
asyncclick
|
||||
dbus-next
|
||||
websockets
|
||||
];
|
||||
|
||||
# pythonImportsCheck = [ "homeassistant_mpris_bridge" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Control your Home Assistant media players from your desktop using MPRIS";
|
||||
homepage = "https://github.com/rytilahti/homeassistant-mpris-bridge";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ ];
|
||||
mainProgram = "hassbridge";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue