diff options
author | Justin Maggard <jmaggard@netgear.com> | 2017-05-17 14:11:44 -0700 |
---|---|---|
committer | Justin Maggard <jmaggard@netgear.com> | 2017-05-17 14:15:20 -0700 |
commit | 5333ac39c19b9094ecc9c2ee9ab0b1d0cadaa5fa (patch) | |
tree | 45949dca9d898512b79697d01d73ad7c918e5791 /lib | |
parent | bfae7ccf915bea79832f246a76e99926a97bc70a (diff) |
platinum: Fix upnp:lastPlaybackPosition parsing
According to the UPnP spec, upnp:lastPlaybackPosition should use the
same format as duration (HH:MM:SS). So we should at least accept the
proper format if it exists, and fall back to the raw integer value if
it's not in the proper format.
Signed-off-by: Justin Maggard <jmaggard@netgear.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp index 5324dcb0e4..fac16902f7 100644 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp @@ -762,7 +762,10 @@ PLT_MediaObject::FromDidl(NPT_XmlElementNode* entry) m_MiscInfo.original_track_number = value; PLT_XmlHelper::GetChildText(entry, "lastPlaybackPosition", str, didl_namespace_upnp); - if (NPT_FAILED(str.ToInteger(value))) value = 0; + if (NPT_FAILED(PLT_Didl::ParseTimeStamp(str, value))) { + // fall back to raw integer parsing + if (NPT_FAILED(str.ToInteger(value))) value = 0; + } m_MiscInfo.last_position = value; PLT_XmlHelper::GetChildText(entry, "lastPlaybackTime", m_MiscInfo.last_time, didl_namespace_upnp, 256); |