Skip to content

Commit

Permalink
feat: listener subscribes to and emits content directory event
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalopitz authored and svrooij committed Jul 17, 2020
1 parent 781e530 commit a4c4ee6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/events/adv-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const listenAddress = process.env.SONOS_LISTENER || ip.address('public')

const globalEventEndpoints = [
'/AlarmClock/Event',
'/ZoneGroupTopology/Event'
'/ZoneGroupTopology/Event',
'/MediaServer/ContentDirectory/Event'
]
const deviceEventEndpoints = [
'/MediaRenderer/AVTransport/Event',
Expand Down
8 changes: 8 additions & 0 deletions lib/events/eventParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ EventParser.ParseAndEmitEvents = async function (endpoint, body, device) {
return EventParser._parseGroupRenderingControlEvent(body, device)
case '/MediaRenderer/Queue/Event':
return EventParser._parseQueueEvent(body, device)
case '/MediaServer/ContentDirectory/Event':
return EventParser._parseContentDirectoryEvent(body, device)
default:
return EventParser._genericEvent(endpoint, body, device)
}
Expand Down Expand Up @@ -103,6 +105,12 @@ EventParser._genericEvent = function (endpoint, body, device) {
return event
}

EventParser._parseContentDirectoryEvent = function (body, device) {
debug('ContentDirectory event %j', body)
const event = { name: 'ContentDirectory', eventBody: body }
return event
}

EventParser._parseAlarmEvent = function (body, device) {
debug('Alarm event %j', body)
const event = { name: 'AlarmClock', eventBody: body }
Expand Down

0 comments on commit a4c4ee6

Please sign in to comment.