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
This commit is contained in:
		
							
								
								
									
										1
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								NEWS
									
									
									
									
									
								
							| @@ -3,6 +3,7 @@ ver 0.21.25 (not yet released) | |||||||
|   - fix crash when using "rangeid" while playing |   - fix crash when using "rangeid" while playing | ||||||
| * database | * database | ||||||
|   - simple: automatically scan new mounts |   - simple: automatically scan new mounts | ||||||
|  |   - upnp: fix compatibility with Plex DLNA | ||||||
| * storage | * storage | ||||||
|   - fix disappearing mounts after mounting twice |   - fix disappearing mounts after mounting twice | ||||||
|   - udisks: fix reading ".mpdignore" |   - udisks: fix reading ".mpdignore" | ||||||
|   | |||||||
| @@ -89,9 +89,18 @@ public: | |||||||
| 		tag.Clear(); | 		tag.Clear(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	gcc_pure | ||||||
|  | 	bool IsRoot() const noexcept { | ||||||
|  | 		return type == Type::CONTAINER && id == "0"; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	gcc_pure | 	gcc_pure | ||||||
| 	bool Check() const noexcept { | 	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 || | 			(type != UPnPDirObject::Type::ITEM || | ||||||
| 			 item_class != UPnPDirObject::ItemClass::UNKNOWN); | 			 item_class != UPnPDirObject::ItemClass::UNKNOWN); | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann