Skip to content

Conversation

lo92fr
Copy link
Contributor

@lo92fr lo92fr commented Oct 15, 2025

Missing TrackMetaData keys in onValueReceived switch case

We are missing the TrackMetaData keys in onValueReceived function.
In some case, it prevent Openhab to synchronise current playing song metadata because some devices use this key.

Fixed: #19486

Signed-off-by: Laurent ARNAL <laurent@clae.net>
@mherwege
Copy link
Contributor

mherwege commented Oct 15, 2025

What device is emitting this? This is not part of the uPnP standard as far as I can tell: https://openconnectivity.org/developer/specifications/upnp-resources/upnp/mediaserver4-and-mediarenderer3/.

@jlaur jlaur changed the title Missing TrackMetaData keys in onValueReceived switch case [upnpcontrol] Missing TrackMetaData keys in onValueReceived switch case Oct 15, 2025
@lsiepel
Copy link
Contributor

lsiepel commented Oct 16, 2025

What device is emitting this? This is not part of the uPnP standard as far as I can tell: https://openconnectivity.org/developer/specifications/upnp-resources/upnp/mediaserver4-and-mediarenderer3/.

I have limited knowledge of the specs, this is what chatgpt says. Is this helpfull?

Yes, TrackMetaData is part of the UPnP AV (Audio/Video) specifications, but not as a formally defined XML element in the UPnP core specs themselves. It appears as part of the AVTransport service in the UPnP AV specifications (specifically: AVTransport:1 and AVTransport:2) defined by the UPnP Forum / DLNA.

@lo92fr
Copy link
Contributor Author

lo92fr commented Oct 16, 2025

PnP AV (Audio/Video) specifications, but not as a formally defined XML element in the UPnP core specs themselves. It appears as part of the AVTransport service in the UPnP AV specifications (specifically: AVTransport:1 and AVTransport:2) defined by the UPnP Forum / DLNA.

The value comes from my Marantz MCR612 amplifier. The renderer subdevice.

Laurent.

@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label Oct 16, 2025
@lsiepel lsiepel requested a review from Copilot October 16, 2025 07:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for devices that emit the non-standard TrackMetaData event variable so that metadata synchronization works consistently.

  • Add "TrackMetaData" to the onValueReceived switch, routed to onValueReceivedCurrentMetaData(value).

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 1086 to 1092
break;
case "CurrentTrackMetaData":
case "CurrentURIMetaData":
case "TrackMetaData":
onValueReceivedCurrentMetaData(value);
break;
case "NextAVTransportURIMetaData":
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] TrackMetaData appears to be a vendor-specific variant; consider adding a brief inline comment to document why this additional key is handled here (e.g., 'Some renderers emit TrackMetaData instead of CurrentTrackMetaData/CurrentURIMetaData'). This will help future maintainers avoid removing it as redundant.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
break;
case "CurrentTrackMetaData":
case "CurrentURIMetaData":
case "TrackMetaData":
onValueReceivedCurrentMetaData(value);
break;
case "NextAVTransportURIMetaData":
break;
case "CurrentTrackMetaData":
case "CurrentURIMetaData":
case "TrackMetaData": // Some (non-compliant) renderers emit TrackMetaData instead of CurrentTrackMetaData/CurrentURIMetaData
onValueReceivedCurrentMetaData(value);
break;
case "NextAVTransportURIMetaData":

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@mherwege
Copy link
Contributor

Yes, TrackMetaData is part of the UPnP AV (Audio/Video) specifications, but not as a formally defined XML element in the UPnP core specs themselves. It appears as part of the AVTransport service in the UPnP AV specifications (specifically: AVTransport:1 and AVTransport:2) defined by the UPnP Forum / DLNA.

Well, I think ChatGPT is wrong here. CurrentTrackMetaData and CurrentURIMetaData are in the AVTransport specs. TrackMetaData is not. It is or a vendor specific extension, or a non-compliant bug in the device. Anyway, it wouldn't harm to add it if this makes it work with the odd device. But I do think a comment should be put in to indicate it is a non-standard element.

Signed-off-by: Laurent ARNAL <laurent@clae.net>
@lo92fr lo92fr requested a review from lsiepel October 17, 2025 13:05
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@lsiepel lsiepel merged commit 34b4417 into openhab:main Oct 17, 2025
2 checks passed
@lsiepel lsiepel added this to the 5.1 milestone Oct 17, 2025
@lo92fr lo92fr deleted the fixes/missingTransportStateKeys branch October 17, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[upnpcontrol] Missing TrackMetadata keys on switch/case in onValueReceived function

3 participants