The Music Library Data Structures¶
This page contains a thorough introduction to the data structures used
for the music library items. The data
structures are implemented in the
module and they are used to represent the metadata for music items,
such as music tracks, albums, genres and playlists.
Many music related items have a lot of metadata in common. For example, a music track and an album may both have artist and title metadata. It is therefore possible and useful to derive a hierarchy of items, and to implement them as a class hierarchy. The hierarchy which Sonos has adopted is represented by the DIDL Lite xml schema (DIDL stands for ‘Digital Item Description Language’. For more details, see the UPnP specifications (PDF).
data_structures module, each class represents a particular DIDL-Lite
object and is illustrated in the figure below. The
black lines are the lines of inheritance, going from left to right.
All data structures are subclasses of the abstract
Didl Object item class. You should never need to instantiate this directly. The subclasses are divided into
Items. In general,
Containers are things, like playlists, which are intended to contain other items.
At the bottom of the class hierarchy are 10 types of
DIDL items. On each of these classes, relevant metadata items
are available as attributes (though they may be implemented as properties).
Each has a
item id and
UPnP class. Some have other
attributes. For example,
some extra fields such as
One of the more important attributes which each class has is
didl_metadata. It is used to
produce the metadata that is sent to the Sonos® units in the form of XML. This
metadata is created in an almost identical way for each class, which is why it
is implemented in
DidlObject. It uses the URI, the UPnP
class and the title that the items are instantiated with, along with the two
|||Text of the first footnote.|