diff options
author | Max Kellermann <max@musicpd.org> | 2020-07-06 21:35:31 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-07-06 21:36:30 +0200 |
commit | 00789de7d42429f0fdd8f5282d54ec5e41d567d6 (patch) | |
tree | ebf85b094036c18a02769ca0547d8338b784ff50 | |
parent | 5ece9685c2dc0441bb0bf1aef3b3e5e548a8ee0c (diff) |
db/upnp/Object: root nodes are allowed to omit parent_id and name
This fixes compatibility with Plex DLNA.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/851
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/db/plugins/upnp/Object.hxx | 11 |
2 files changed, 11 insertions, 1 deletions
@@ -3,6 +3,7 @@ ver 0.21.25 (not yet released) - fix crash when using "rangeid" while playing * database - simple: automatically scan new mounts + - upnp: fix compatibility with Plex DLNA * storage - fix disappearing mounts after mounting twice - udisks: fix reading ".mpdignore" diff --git a/src/db/plugins/upnp/Object.hxx b/src/db/plugins/upnp/Object.hxx index e17cdfbdd..e27fcfc2d 100644 --- a/src/db/plugins/upnp/Object.hxx +++ b/src/db/plugins/upnp/Object.hxx @@ -90,8 +90,17 @@ public: } gcc_pure + bool IsRoot() const noexcept { + return type == Type::CONTAINER && id == "0"; + } + + gcc_pure bool Check() const noexcept { - return !id.empty() && !parent_id.empty() && !name.empty() && + return !id.empty() && + /* root nodes don't need a parent id and a + name */ + (IsRoot() || (!parent_id.empty() && + !name.empty())) && (type != UPnPDirObject::Type::ITEM || item_class != UPnPDirObject::ItemClass::UNKNOWN); } |