The UPnP plugin for Rhythmbox generates a large number of duplicate entries when browsing MediaServers such as Mediatomb that have the following container structure:
Root
-Audio
--All Audio
---track
-Artists
--Artist
---track
-Albums
--album
---track
This is because each instance of "track" in the container structure has a different numeric identifier, even though each instance references the same file. The Rhythmbox uses the numeric identifier to check for duplicates, and since each instance of "track" has a different identifier, the plugin's check fails, resulting in duplicate entries for the same file.
One possible solution is given in the attached patch. A tuple named "filter" is parsed each time a new container is encountered while browsing a MediaServer's contents. Each container is assigned a path in the style of the UNIX file system, with containers taking the place of directories. For example, the 'All Audio' container in the structure shown above would have a path "/Audio/All Audio". If one of the strings in the "filter" tuple exists verbatim in the container's path, the container and its contents are added to the Rhythmbox database.