OH2 music player software stack advice

Here’s how I have mine set up – Items, Sitemap, and Rules

Items

Number Squeezebox_NJ_Living_Play_PlayList 	"Playlists"
Dimmer SBP_NJ_Living_Volume			"Volume [%d %%]"	{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:volume" }
Switch SBP_NJ_Living_Mute			"Mute"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:mute" }
Switch SBP_NJ_Living_Play			"Play"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:playPause" }
Switch SBP_NJ_Living_Stop			"Stop"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:stop" }
Switch SBP_NJ_Living_Next			"Next"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:next" }
Switch SBP_NJ_Living_Prev			"Previous"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:prev" }
Switch SBP_NJ_Living_Power			"Power"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:power" }
String SBP_NJ_Living_Album			"Album [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:album" }
String SBP_NJ_Living_Artist			"Artist [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:artist" }
String SBP_NJ_Living_Title			"Title [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420164526:title" }
Number Squeezebox_NJ_Family_Play_PlayList 	"Playlists"
Dimmer SBP_NJ_Family_Volume			"Volume [%d %%]"	{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:volume" }
Switch SBP_NJ_Family_Mute			"Mute"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:mute" }
Switch SBP_NJ_Family_Play			"Play"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:playPause" }
Switch SBP_NJ_Family_Stop			"Stop"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:stop" }
Switch SBP_NJ_Family_Next			"Next"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:next" }
Switch SBP_NJ_Family_Prev			"Previous"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:prev" }
Switch SBP_NJ_Family_Power			"Power"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:power" }
String SBP_NJ_Family_Album			"Album [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:album" }
String SBP_NJ_Family_Artist			"Artist [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:artist" }
String SBP_NJ_Family_Title			"Title [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:000420165ee2:title" }
Number Squeezebox_NJ_Master_Play_PlayList 	"Playlists"
Dimmer SBP_NJ_Master_Volume			"Volume [%d %%]"	{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:volume" }
Switch SBP_NJ_Master_Mute			"Mute"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:mute" }
Switch SBP_NJ_Master_Play			"Play"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:playPause" }
Switch SBP_NJ_Master_Stop			"Stop"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:stop" }
Switch SBP_NJ_Master_Next			"Next"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:next" }
Switch SBP_NJ_Master_Prev			"Previous"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:prev" }
Switch SBP_NJ_Master_Power			"Power"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:power" }
String SBP_NJ_Master_Album			"Album [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:album" }
String SBP_NJ_Master_Artist			"Artist [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:artist" }
String SBP_NJ_Master_Title			"Title [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:0004201e44d7:title" }
Number Squeezebox_NJ_Office_Play_PlayList 	"Playlists"
Dimmer SBP_NJ_Office_Volume			"Volume [%d %%]"	{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:volume" }
Switch SBP_NJ_Office_Mute			"Mute"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:mute" }
Switch SBP_NJ_Office_Play			"Play"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:playPause" }
Switch SBP_NJ_Office_Stop			"Stop"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:stop" }
Switch SBP_NJ_Office_Next			"Next"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:next" }
Switch SBP_NJ_Office_Prev			"Previous"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:prev" }
Switch SBP_NJ_Office_Power			"Power"			{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:power" }
String SBP_NJ_Office_Album			"Album [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:album" }
String SBP_NJ_Office_Artist			"Artist [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:artist" }
String SBP_NJ_Office_Title			"Title [%s]"		{ channel="squeezebox:squeezeboxplayer:13B79D32-2360-4A1D-85E7-1B6FE08D217F:b827eb163f1e:title" }

Sitemap

Frame {
Text label=“Living Room Music” icon=“player” {
Frame label=“Now Playing” {
Text item=SBP_NJ_Living_Title
Text item=SBP_NJ_Living_Album
Text item=SBP_NJ_Living_Artist
}
Frame label=“Control Living Room Player” {
Slider item=SBP_NJ_Living_Volume icon=“soundvolume”
Switch item=SBP_NJ_Living_Play label=“Play” mappings=[ON=“Play”, OFF=“Pause”]
Switch item=SBP_NJ_Living_Mute label=“Mute” mappings=[ON=“Mute”, OFF=“Unmute”]
Switch item=SBP_NJ_Living_Next label=“Next” mappings=[ON=“Next”]
}
Frame label=“Play a Playlist” {
Selection item=Squeezebox_NJ_Living_Play_PlayList label=“Play a Playlist”
mappings=[0=“Playlist0”, 1=“Playlist1”, 2=“Playlist2”, 3=“Playlist3”, 4=“Playlist4”, 5=“Playlist5”]
}
}
Text label=“Office Music” icon=“player” {
Frame label=“Now Playing” {
Text item=SBP_NJ_Office_Title
Text item=SBP_NJ_Office_Album
Text item=SBP_NJ_Office_Artist
}
Frame label=“Control Office Player” {
Slider item=SBP_NJ_Office_Volume icon=“soundvolume”
Switch item=SBP_NJ_Office_Play label=“Play” mappings=[ON=“Play”, OFF=“Pause”]
Switch item=SBP_NJ_Office_Mute label=“Mute” mappings=[ON=“Mute”, OFF=“Unmute”]
Switch item=SBP_NJ_Office_Next label=“Next” mappings=[ON=“Next”]
}
Frame label=“Play a Playlist” {
Selection item=Squeezebox_NJ_Office_Play_PlayList label=“Play a Playlist”
mappings=[0=“Playlist0”, 1=“Playlist1”, 2=“Playlist2”, 3=“Playlist3”, 4=“Playlist4”, 5=“Playlist5”]
}
}
Text label=“Family Room Music” icon=“player” {
Frame label=“Now Playing” {
Text item=SBP_NJ_Family_Title
Text item=SBP_NJ_Family_Album
Text item=SBP_NJ_Family_Artist
}
Frame label=“Control Family Room Player” {
Slider item=SBP_NJ_Family_Volume icon=“soundvolume”
Switch item=SBP_NJ_Family_Play label=“Play” mappings=[ON=“Play”, OFF=“Pause”]
Switch item=SBP_NJ_Family_Mute label=“Mute” mappings=[ON=“Mute”, OFF=“Unmute”]
Switch item=SBP_NJ_Family_Next label=“Next” mappings=[ON=“Next”]
}
Frame label=“Play a Playlist” {
Selection item=Squeezebox_NJ_Family_Play_PlayList label=“Play a Playlist”
mappings=[0=“Playlist0”, 1=“Playlist1”, 2=“Playlist2”, 3=“Playlist3”, 4=“Playlist4”, 5=“Playlist5”]
}
}
Text label=“Master Bedroom Music” icon=“player” {
Frame label=“Now Playing” {
Text item=SBP_NJ_Master_Title
Text item=SBP_NJ_Master_Album
Text item=SBP_NJ_Master_Artist
}
Frame label=“Control Master Bedroom Player” {
Slider item=SBP_NJ_Master_Volume icon=“soundvolume”
Switch item=SBP_NJ_Master_Play label=“Play” mappings=[ON=“Play”, OFF=“Pause”]
Switch item=SBP_NJ_Master_Mute label=“Mute” mappings=[ON=“Mute”, OFF=“Unmute”]
Switch item=SBP_NJ_Master_Next label=“Next” mappings=[ON=“Next”]
}
Frame label=“Play a Playlist” {
Selection item=Squeezebox_NJ_Master_Play_PlayList label=“Play a Playlist”
mappings=[0=“Playlist0”, 1=“Playlist1”, 2=“Playlist2”, 3=“Playlist3”, 4=“Playlist4”, 5=“Playlist5”]
}
}
}

Rules

val String njLivingPlayerMAC = "00:04:20:16:45:26"
val String njFamilyPlayerMAC = "00:04:20:16:5e:e2"
val String njMasterPlayerMAC = "00:04:20:1e:44:d7"
val String njOfficePlayerMAC = "b8:27:eb:16:3f:1e"
val org.eclipse.xtext.xbase.lib.Functions$Function2 squeezePlayPlaylist = [
    String player,
    String playlist |
	logInfo("squeezeplaylist.rules", "In squeezePlayPlaylist with player of " + player)
	var String station
	var String requestURL
	var boolean success = true
	switch(playlist) {
		case "0" : 
			station = "pandora%3A%2F%2F126109272201071737.mp3"
		case "1" : 
			station = "pandora%3A%2F%2F2739670749549530233.mp3"
		case "2" : 
			station = "pandora%3A%2F%2F3019846262429944953.mp3"
		case "3" :
			station = "pandora%3A%2F%2F79741376504106105.mp3"
		case "4" :
			station = "pandora%3A%2F%2F3230131829791886457.mp3"
		case "5" :
			station = "pandora%3A%2F%2F72031231602953337.mp3"
		default : {
			logError("squeezeplaylist.rules", "Received a request for an unknown playlist!")
			success = false
		}
	}
	if (success == true) {
		requestURL = "http://some.host:9000/status.html?p0=playlist&p1=play&p2=" + station + "&player=" + player
		logInfo("squeezeplaylist.rules", "Sending playlist request to server: " + requestURL)
		sendHttpGetRequest(requestURL)
	}
]
rule "Squeezebox_NJ_Living_PlayList"
when
	Item Squeezebox_NJ_Living_Play_PlayList received command
then
	logInfo("squeezeplaylist.rules", "Playing playlist on NJ Living Room player")
	squeezePlayPlaylist.apply(njLivingPlayerMAC, receivedCommand.toString)
end
rule "Squeezebox_NJ_Family_PlayList"
when
	Item Squeezebox_NJ_Family_Play_PlayList received command
then
	logInfo("squeezeplaylist.rules", "Playing playlist on NJ Family Room player")
	squeezePlayPlaylist.apply(njFamilyPlayerMAC, receivedCommand.toString)
end
rule "Squeezebox_NJ_Master_PlayList"
when
	Item Squeezebox_NJ_Master_Play_PlayList received command
then
	logInfo("squeezeplaylist.rules", "Playing playlist on NJ Master Bedroom player")
	squeezePlayPlaylist.apply(njMasterPlayerMAC, receivedCommand.toString)
end
rule "Squeezebox_NJ_Office_PlayList"
when
	Item Squeezebox_NJ_Office_Play_PlayList received command
then
	logInfo("squeezeplaylist.rules", "Playing playlist on NJ Office player with playlist ", receivedCommand.toString)
	squeezePlayPlaylist.apply(njOfficePlayerMAC, receivedCommand.toString)
end