Blame doc/server/dbus/API.txt

Packit 6eaa26
API
Packit 6eaa26
---
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service is a middleware component.  It is designed to be
Packit 6eaa26
launched by d-Bus activation when needed.  It automatically shuts down
Packit 6eaa26
when the last of its clients quits or releases its connection.
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service currently connects to the d-Bus session bus,
Packit 6eaa26
although this may change in the future.  It exposes four different
Packit 6eaa26
types of objects:
Packit 6eaa26
Packit 6eaa26
1. A manager object.  There is only ever a single instance of this
Packit 6eaa26
object.  It can be used to retrieve a list of the DMSs on the local
Packit 6eaa26
area network.  It is also used to perform certain server independent
Packit 6eaa26
tasks.
Packit 6eaa26
Packit 6eaa26
2. Server objects.  One separate object is exposed for each DMS
Packit 6eaa26
available on the LAN.  These objects expose interfaces that allow
Packit 6eaa26
clients to retrieve information about the servers and to browse and
Packit 6eaa26
search their contents.
Packit 6eaa26
Packit 6eaa26
3. Container objects.  Container objects represent separate folders
Packit 6eaa26
within the DMS.  They allow clients to browse and search the contents
Packit 6eaa26
of the folder to which they correspond.
Packit 6eaa26
Packit 6eaa26
4. Item objects.  Represent individual pieces of media content
Packit 6eaa26
published by a DMS.  These objects can be used to retrieve information
Packit 6eaa26
about media objects, such as their name, their authors, and most
Packit 6eaa26
importantly, their URLs.
Packit 6eaa26
Packit 6eaa26
The remainder of this document will describe the four d-Bus objects
Packit 6eaa26
listed above and the interfaces they support.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
The Manager Object:
Packit 6eaa26
-------------------
Packit 6eaa26
Packit 6eaa26
There is only ever a single instance of this object.  The manager
Packit 6eaa26
object exposes two d-Bus interfaces:
Packit 6eaa26
1 - com.intel.dLeynaServer.Manager.
Packit 6eaa26
2 - org.freedesktop.DBus.Properties.
Packit 6eaa26
Packit 6eaa26
com.intel.dLeynaServer.Manager
Packit 6eaa26
------------------------------
Packit 6eaa26
Packit 6eaa26
Methods:
Packit 6eaa26
----------
Packit 6eaa26
Packit 6eaa26
The interface com.intel.dLeynaServer.Manager contains 6 methods.
Packit 6eaa26
Descriptions of each of these methods along with their d-Bus
Packit 6eaa26
signatures are given below.
Packit 6eaa26
Packit 6eaa26
GetServers() -> ao
Packit 6eaa26
Packit 6eaa26
GetServers takes no parameters and returns an array of d-Bus object
Packit 6eaa26
paths.  Each of these paths reference a d-Bus object that represents a
Packit 6eaa26
single DMS.
Packit 6eaa26
Packit 6eaa26
GetVersion() -> s
Packit 6eaa26
Packit 6eaa26
Returns the version number of dleyna-server-service
Packit 6eaa26
Packit 6eaa26
Release()
Packit 6eaa26
Packit 6eaa26
Indicates to dleyna-server-service that a client is no longer interested
Packit 6eaa26
in its services.  Internally, dleyna-server-service maintains a reference
Packit 6eaa26
count.  This reference count is increased when a new client connects.
Packit 6eaa26
It is decreased when a client quits.  When the reference count reaches
Packit 6eaa26
0, dleyna-server-service exits.  A call to Release also decreases the
Packit 6eaa26
reference count.  Clients should call this method if they intend to
Packit 6eaa26
keep running but they have no immediate plans to invoke any of
Packit 6eaa26
dleyna-server-service's methods. This allows dleyna-server-service to quit,
Packit 6eaa26
freeing up system resources.
Packit 6eaa26
Packit 6eaa26
SetProtocolInfo(s ProtocolInfo) -> void
Packit 6eaa26
Packit 6eaa26
Informs dleyna-server-service of the mime types and network protocols
Packit 6eaa26
supported by the client.
Packit 6eaa26
Packit 6eaa26
The explanation behind this function is a little complex.  DMSs often
Packit 6eaa26
support a feature call transcoding.  This allows them to publish each
Packit 6eaa26
media item they manage in a number of different formats.  This is
Packit 6eaa26
useful as not all devices support the same set of media formats and
Packit 6eaa26
codecs.  For example, a DMS might publish two separate URLS for a
Packit 6eaa26
video file.  The first URL might point to the file in its original
Packit 6eaa26
format, e.g., to an ogg vorbis file.  The second URL however, could
Packit 6eaa26
point to a MP4 encoded version of the same file.  The second URL might
Packit 6eaa26
be preferable if viewing the file on a mobile device.  In short,
Packit 6eaa26
SetProtocolInfo allows clients to specify the formats that they would
Packit 6eaa26
like to receive media content in.  This function should be called by
Packit 6eaa26
all MediaPlayers.  Doing so, will ensure that dleyna-server-service only
Packit 6eaa26
returns compatible URLs via the org.gnome.MediaItem2 interface.  For
Packit 6eaa26
more information see the section on MediaServer2Spec below.
Packit 6eaa26
Packit 6eaa26
The Protocol info field is a comma separated list of protocol info
Packit 6eaa26
values.  Each protocol info value consists of 4 fields separated by
Packit 6eaa26
colons.  Unfortunately, the format is too complex to describe in this
Packit 6eaa26
document.  The reader is referred to the UPnP Connection Manager
Packit 6eaa26
Service Template document (1) and the DLNA Guidelines (2) where it is
Packit 6eaa26
described extensively.  However, an example protocol info value is
Packit 6eaa26
presented below, to give the reader an idea of what such a string
Packit 6eaa26
might look like.
Packit 6eaa26
Packit 6eaa26
"http-get:*:audio/mp4:DLNA.ORG_PN=AMR_WBplus,
Packit 6eaa26
http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_MED"
Packit 6eaa26
Packit 6eaa26
The protocol info value above indicates that the client supports the
Packit 6eaa26
retrieval, via HTTP, and the playback of audio MP4 and JPEG files.
Packit 6eaa26
Packit 6eaa26
PreferLocalAddresses(b Prefer) -> void
Packit 6eaa26
Packit 6eaa26
Indicates whether  local addresses should be prioritized  or not. DMSs
Packit 6eaa26
tend to make their services available on multiple interfaces. If a DMP
Packit 6eaa26
and a DMS are running on the same device, the DMP will have the option
Packit 6eaa26
of  communicating with  the  DMS over  the  loopback or  the LAN.   By
Packit 6eaa26
default dleyna-server-service  will return loopback  addresses to clients
Packit 6eaa26
running on  the same device.   This is not  very helpful for  DMCs who
Packit 6eaa26
need  non-local  addresses  to  pass  to renderers  running  on  other
Packit 6eaa26
devices.   DMCs should  therefore call  this function  with  the value
Packit 6eaa26
FALSE before requesting any URLs from any servers.
Packit 6eaa26
Packit 6eaa26
Rescan() -> void
Packit 6eaa26
Packit 6eaa26
Forces a rescan for DMSs on the local area network.  This is useful to
Packit 6eaa26
detect DMSs which have shut down without sending BYE messages or to
Packit 6eaa26
discover new DMSs which for some reason were not detected when either
Packit 6eaa26
they, or the device on which dLeyna-server runs, was started or joined
Packit 6eaa26
the network.  New in version 0.0.2.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Properties:
Packit 6eaa26
---------
Packit 6eaa26
Packit 6eaa26
The com.intel.dLeynaServer.Manager interface exposes information via a number
Packit 6eaa26
of d-Bus properties.  These properties are described below:
Packit 6eaa26
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
|     Name          |   Type    |m/o*|              Description                |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| NeverQuit         |     b     | m  | True if the service always stay in      |
Packit 6eaa26
|                   |           |    | memory running.  False if the service   |
Packit 6eaa26
|                   |           |    | quit when the last client disconnects.  |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| WhiteListEntries  |     as    | m  | The list of entries that compose the    |
Packit 6eaa26
|                   |           |    | white list used to filter the networks. |
Packit 6eaa26
|                   |           |    | An Entry could be an interface name     |
Packit 6eaa26
|                   |           |    | (eth0), an ip address (127.0.0.1) or    |
Packit 6eaa26
|                   |           |    | a SSID (MyWiFi)                         |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| WhiteListEnabled  |     b     | m  | True if the Network Filtering is active.|
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
Packit 6eaa26
A org.freedesktop.DBus.Properties.PropertiesChanged signal is emitted when
Packit 6eaa26
these properties change.
Packit 6eaa26
These properties can be changed using the Set() method of
Packit 6eaa26
org.freedesktop.DBus.Properties interface.
Packit 6eaa26
Packit 6eaa26
Signals:
Packit 6eaa26
---------
Packit 6eaa26
Packit 6eaa26
The com.intel.dLeynaServer.Manager interface also exposes two signals.
Packit 6eaa26
Packit 6eaa26
FoundServer(o)
Packit 6eaa26
Packit 6eaa26
Is generated whenever a new DMS is detected on the local area network.
Packit 6eaa26
The signal contains the path of the newly discovered server.
Packit 6eaa26
Packit 6eaa26
LostServer(o)
Packit 6eaa26
Packit 6eaa26
Is generated whenever a DMS is shutdown.  The signal contains the path
Packit 6eaa26
of the server which has just been shutdown.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
The Server Objects:
Packit 6eaa26
------------------
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service exposes a separate d-Bus object for each DMS it
Packit 6eaa26
detects on the LAN.  These objects serve two purposes.
Packit 6eaa26
Packit 6eaa26
1. They allow the client to retrieve information about the DMS, such
Packit 6eaa26
as its name, the URL of its icon, its manufacturer, etc.
Packit 6eaa26
Packit 6eaa26
2. They represent the root container of the DMS allowing clients to
Packit 6eaa26
search and browse the DMSs contents.
Packit 6eaa26
Packit 6eaa26
Each server object exposes three separate interfaces:
Packit 6eaa26
com.intel.dLeynaServer.MediaDevice, org.gnome.MediaObject2 and
Packit 6eaa26
org.gnome.UPnP.MediaContainer2.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
com.intel.dLeynaServer.MediaDevice:
Packit 6eaa26
---------------------------
Packit 6eaa26
Packit 6eaa26
The com.intel.dLeynaServer.MediaDevice interface exposes information about the
Packit 6eaa26
DMS via a number of d-Bus properties.  These properties are described
Packit 6eaa26
below:
Packit 6eaa26
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
|     Name          |   Type    |m/o*|              Description                |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| DeviceType        |     s     | m  | The UPnP type of the device, e.g.,      |
Packit 6eaa26
|                   |           |    | urn:schemas-upnp-org:device:\           |
Packit 6eaa26
|                   |           |    | MediaServer:1                           |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| UDN               |     s     | m  | The Unique Device Name of the server.   |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| RootUDN           |     s     | o  | The Unique Device Name of the root      |
Packit 6eaa26
|                   |           |    | device, if the server is a sub-device.  |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| FriendlyName      |     s     | m  | The friendly name of the media server.  |
Packit 6eaa26
-------------------------------------------------------------------------------|
Packit 6eaa26
| IconURL           |     s     | o  | A URL pointing to an icon that          |
Packit 6eaa26
|                   |           |    | graphically identifies the server       |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| Manufacturer      |     s     | m  | A string identifying the manufacturer   |
Packit 6eaa26
|                   |           |    | of the server                           |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| ManufacturerUrl   |     s     | o  | A URL pointing to the manufacturer's    |
Packit 6eaa26
|                   |           |    | web site.                               |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| ModelDescription  |     s     | o  | A description of the server.            |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| ModelName         |     s     | m  | The model name of the server.           |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| ModelNumber       |     s     | o  | The server's version number             |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| SerialNumber      |     s     | o  | The server's serial number              |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| PresentationURL   |     s     | o  | The presentation URL of the server,     |
Packit 6eaa26
|                   |           |    | i.e., a link to it's HTML management    |
Packit 6eaa26
|                   |           |    | interface.                              |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| DLNACaps          |   a{sv}   | o  | Represents the device capabilities as   |
Packit 6eaa26
|                   |           |    | announced in the device description     |
Packit 6eaa26
|                   |           |    | file via the dlna:X_DLNACAP element. (1)|
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| SearchCaps        |     as    | m  | List of property names that can be used |
Packit 6eaa26
|                   |           |    | in search queries.                      |
Packit 6eaa26
|                   |           |    | A wildcard (“*”) indicates that the     |
Packit 6eaa26
|                   |           |    | device supports search queries using    |
Packit 6eaa26
|                   |           |    | any property name(s).                   |
Packit 6eaa26
|                   |           |    | Empty if not supported by the device.   |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| SortCaps          |     as    | m  | List of property names that can be used |
Packit 6eaa26
|                   |           |    | to sort Search() or Browse() action     |
Packit 6eaa26
|                   |           |    | results.                                |
Packit 6eaa26
|                   |           |    | A wildcard (“*”) indicates that the     |
Packit 6eaa26
|                   |           |    | device supports sorting using all       |
Packit 6eaa26
|                   |           |    | property names.                         |
Packit 6eaa26
|                   |           |    | Empty if not supported by the device.   |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| SortExtCaps       |     as    | o  | List of sort modifiers that can be used |
Packit 6eaa26
|                   |           |    | to sort Search() or Browse() results.   |
Packit 6eaa26
|                   |           |    | Empty if not supported by the device.   |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| FeatureList       |  a(ssao)  | o  | Each element in the FeatureList array   |
Packit 6eaa26
|                   |           |    | represents a feature supported by the   |
Packit 6eaa26
|                   |           |    | DMS. Each feature contains three pieces |
Packit 6eaa26
|                   |           |    | of information, a name, a version number|
Packit 6eaa26
|                   |           |    | and an array of object paths that can   |
Packit 6eaa26
|                   |           |    | clients can use to take advantage of the|
Packit 6eaa26
|                   |           |    | feature. There are three standardized   |
Packit 6eaa26
|                   |           |    | feature names, BOOKMARK, EPG and TUNER. |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| ServiceResetToken |     s     | o  |  A string containing the current        |
Packit 6eaa26
|                   |           |    |  service reset token of the server.     |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| SystemUpdateID    |     u     | m  | An integer value that is incremenented  |
Packit 6eaa26
|                   |           |    | every time changes are made to the DMS. |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| Sleeping          |     b     | o  | An boolean value which represents the   |
Packit 6eaa26
|                   |           |    | server sleeping state.                  |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
(* where m/o indicates whether the property is optional or mandatory )
Packit 6eaa26
(1) A value of -1 for the srs-rt-retention-period capability denotes an
Packit 6eaa26
infinite retention period.
Packit 6eaa26
Packit 6eaa26
All of the above properties are static with the sole exception
Packit 6eaa26
of SystemUpdateID. A org.freedesktop.DBus.Properties.PropertiesChanged signal
Packit 6eaa26
is emitted when this property changes.
Packit 6eaa26
Packit 6eaa26
Methods:
Packit 6eaa26
---------
Packit 6eaa26
Packit 6eaa26
The com.intel.dLeynaServer.MediaDevice interface currently exposes 8 methods:
Packit 6eaa26
Packit 6eaa26
UploadToAnyContainer(s DisplayName, s FilePath) -> (u UploadId, o ObjectPath)
Packit 6eaa26
Packit 6eaa26
UploadToAnyContainer allows a client to upload a local file to a DMS.
Packit 6eaa26
The DMS chooses the best place to store the file based on the file's
Packit 6eaa26
type.  DisplayName is the friendly name the DMS should associate with
Packit 6eaa26
the file and FilePath is a full path to the file.  The successful
Packit 6eaa26
completion of this method indicates that the upload has begun, but has
Packit 6eaa26
not necessarily finished.  There are two return values.  The UploadId,
Packit 6eaa26
which can be used to monitor the progress of the upload and to
Packit 6eaa26
cancel it and ObjectPath, which contains the path of the newly created object.
Packit 6eaa26
Packit 6eaa26
CreateContainerInAnyContainer(s DisplayName, s TypeEx, as ChildTypes)
Packit 6eaa26
                                                             -> o ObjectPath
Packit 6eaa26
Packit 6eaa26
Creates a new container. The DMS chooses the best place to create
Packit 6eaa26
this new container. DisplayName is the name of the new container,
Packit 6eaa26
TypeEx is the extended type and ChildTypes is an array of extended types that
Packit 6eaa26
can be stored in the new folder, e.g., ['video','container'].
Packit 6eaa26
A special value of ['*'] indicates that no restriction is placed
Packit 6eaa26
on the types of objects that can be stored in the container.
Packit 6eaa26
The path of the newly created object is returned.
Packit 6eaa26
Packit 6eaa26
GetUploadStatus(u UploadId) -> (s UploadStatus, t Length, t Total)
Packit 6eaa26
Packit 6eaa26
GetUploadStatus returns the current status of an upload previously
Packit 6eaa26
started by a call to Upload or UploadToAnyContainer.  Clients should
Packit 6eaa26
pass in the UploadId they received as a return value from either
Packit 6eaa26
of these two functions.  This method returns three pieces of information.
Packit 6eaa26
Packit 6eaa26
i.   UploadStatus, indicating the status of the upload.  Four separate
Packit 6eaa26
     values are possible.  "IN_PROGRESS", "CANCELLED", "ERROR", "COMPLETED"
Packit 6eaa26
ii.  Length, indicating the number of bytes that have been transferred so far.
Packit 6eaa26
iii. Total, indicating the total size of the upload.
Packit 6eaa26
Packit 6eaa26
Clients can call GetUploadStatus to retrieve the status of an upload up to
Packit 6eaa26
30 seconds after the specified upload has finished.
Packit 6eaa26
Packit 6eaa26
The only exception to this rule is if the DMS to which the file is being
Packit 6eaa26
uploaded shuts down or disappears from the UPnP network.  If this happens
Packit 6eaa26
all active uploads to this DMS will be cancelled and the Device object
Packit 6eaa26
representing this DMS will disappear.  As the Device object is no longer
Packit 6eaa26
available, clients cannot call GetUploadStatus to determine the status
Packit 6eaa26
of their uploads.  Clients that initiate uploads should listen for
Packit 6eaa26
the LostServer signal.  They should assume that any uploads to a DMS that
Packit 6eaa26
were in progress when this signal is received for that DMS, have been
Packit 6eaa26
cancelled.
Packit 6eaa26
Packit 6eaa26
GetUploadIDs() -> (au UploadIDs)
Packit 6eaa26
Packit 6eaa26
GetUploadIDs returns an array containing the IDs of all the outstanding upload
Packit 6eaa26
tasks.  An empty array will be returned if no uploads are in progress on the
Packit 6eaa26
current device.  As with GetUploadStatus, the IDs of upload tasks will be
Packit 6eaa26
returned by GetUploadIDs for 30 seconds after the uploads have finished.
Packit 6eaa26
Packit 6eaa26
CancelUpload(u UploadId) -> void
Packit 6eaa26
Packit 6eaa26
Cancels the upload identified by UploadId.  This function has no effect if the
Packit 6eaa26
upload has already completed, i.e., its status is set to COMPLETED.
Packit 6eaa26
Packit 6eaa26
Cancel() -> void
Packit 6eaa26
Packit 6eaa26
Cancels all requests a client has outstanding on that server.
Packit 6eaa26
Packit 6eaa26
GetIcon(s RequestedMimeType, s Resolution) -> (ay Bytes, s MimeType)
Packit 6eaa26
Packit 6eaa26
Returns the device icon bytes and mime type according to
Packit 6eaa26
the RequestedMimeType and Resolution parameters.
Packit 6eaa26
Both RequestedMimeType and Resolution parameters are currently
Packit 6eaa26
reserved for future use and should be set as an empty string.
Packit 6eaa26
Packit 6eaa26
BrowseObjects(as ObjectPath, as Filter) -> aa{sv}
Packit 6eaa26
Packit 6eaa26
This method returns properties of all media objects specified by the first
Packit 6eaa26
parameter.  The list of properties to return is specified by the second
Packit 6eaa26
parameter.
Packit 6eaa26
The first argument is an array of object paths.
Packit 6eaa26
The second argument is an array of property name.  This is the list of
Packit 6eaa26
properties that would be returned for each object.
Packit 6eaa26
The format and the behaviour of this array is identical to the
Packit 6eaa26
filter argument passed to the Search and List functions.
Packit 6eaa26
The result is an array of property name+value dictionaries, one for each object
Packit 6eaa26
specified in the first argument.
Packit 6eaa26
In case of even a single 'Invalid path' in ObjectPath parameter, the function
Packit 6eaa26
will failed and return an error.
Packit 6eaa26
In case of 'Invalid ID', the function will succeed, and an 'Error' property
Packit 6eaa26
will be set for this object.
Packit 6eaa26
We guarantee that the number of elements of the result array is the same and in
Packit 6eaa26
the same order as the ObjectPath array.
Packit 6eaa26
Packit 6eaa26
The purposes of this method are:
Packit 6eaa26
Packit 6eaa26
1. It allows applications to easily retrieve information about unrelated
Packit 6eaa26
   objects in one call.
Packit 6eaa26
2. It should be used in preference to GetAll, if an application wishes to
Packit 6eaa26
   retrieve a subset of an object's properties. Browse is likely to be more
Packit 6eaa26
   efficient than GetAll in such cases.
Packit 6eaa26
Packit 6eaa26
Wake() -> void
Packit 6eaa26
Packit 6eaa26
Sends a magic packet to the server to wake it up if it is in sleeping state.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Signals:
Packit 6eaa26
---------
Packit 6eaa26
Packit 6eaa26
The com.intel.dLeynaServer.MediaDevice interface also exposes three signals.
Packit 6eaa26
Packit 6eaa26
Changed (aa{sv} ChangedObjects)
Packit 6eaa26
Packit 6eaa26
The Changed signal is generated by servers to provide precise information
Packit 6eaa26
of changes that have taken place to their content.  Changed is useful for
Packit 6eaa26
synchronisation controllers.  It allows them to dynamically update their local
Packit 6eaa26
cache of the server's content. This signal contains an array of zero or more
Packit 6eaa26
dictionary elements, each of which represents a change to a specific object.
Packit 6eaa26
The dictionary is composed of the following keys:
Packit 6eaa26
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
|      Key       | Type | m/o |                 Description                    |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| ChangeType     |  u   |  m  | Contains the Type of the notification:         |
Packit 6eaa26
|                |      |     |   1 (ADD) an object has been added             |
Packit 6eaa26
|                |      |     |   2 (MOD) an object has been modified          |
Packit 6eaa26
|                |      |     |   3 (DEL) an object has been deleted           |
Packit 6eaa26
|                |      |     |   4 (DONE) an update to a sub-tree has         |
Packit 6eaa26
|                |      |     |      completed                                 |
Packit 6eaa26
|                |      |     |   5 (CONTAINER) a container has been updated   |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| Path           |  o   |  m  | Contains the Object Path property of the       |
Packit 6eaa26
|                |      |     | object that was changed.                       |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| UpdateID       |  u   |  m  | ContainerUpdateID or SystemUpdateID when the   |
Packit 6eaa26
|                |      |     | object was changed.                            |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| SubTreeUpdate  |  b   |  o  | True if the object was added as part of a      |
Packit 6eaa26
|                |      |     | subtree update.                                |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| Parent         |  o   |  o  | Contains the Object Path property of the       |
Packit 6eaa26
|                |      |     | parent container of the changed object.        |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| TypeEx         |  s   |  o  | Contains the value of the TypeEx property      |
Packit 6eaa26
|                |      |     | (converted upnp:class property) of the         |
Packit 6eaa26
|                |      |     |  object that was changed.                      |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
| Type           |  s   |  o  | Contains the value of the Type property        |
Packit 6eaa26
|                |      |     | (converted upnp:class property) of the object  |
Packit 6eaa26
|                |      |     | that was changed.                              |
Packit 6eaa26
|------------------------------------------------------------------------------|
Packit 6eaa26
Packit 6eaa26
ContainerUpdateIDs(a(ou) ContainerPathsIDs)
Packit 6eaa26
Packit 6eaa26
Is generated when the contents of one or more folders maintained by the
Packit 6eaa26
server have changed. This signal contains an array of paths/ContainerUpdateID
Packit 6eaa26
of the server containers that have changed.
Packit 6eaa26
Packit 6eaa26
UploadUpdate(u UploadId, s UploadStatus, Length t, Total t)
Packit 6eaa26
Packit 6eaa26
Is generated when an upload completes, fails or is cancelled.  The first
Packit 6eaa26
parameter is the ID of the upload.   The second contains one of three values,
Packit 6eaa26
"CANCELLED", "COMPLETED", "ERROR", indicating whether the upload was cancelled,
Packit 6eaa26
completed successfully or failed, respectively.  The third parameter indicates
Packit 6eaa26
the total amount of bytes that were uploaded and the fourth, the size of the
Packit 6eaa26
file being uploaded.
Packit 6eaa26
Packit 6eaa26
Here is some example code in python that enumerates all the media
Packit 6eaa26
servers present on the network and prints their names and the paths of
Packit 6eaa26
the d-Bus objects that represent them, to the screen.
Packit 6eaa26
Packit 6eaa26
import dbus
Packit 6eaa26
Packit 6eaa26
bus = dbus.SessionBus()
Packit 6eaa26
manager = dbus.Interface(bus.get_object('com.intel.dleyna-server',
Packit 6eaa26
                                        '/com/intel/dLeynaServer'),
Packit 6eaa26
                         'com.intel.dLeynaServer.Manager')
Packit 6eaa26
for path in manager.GetServers():
Packit 6eaa26
    server = dbus.Interface(bus.get_object(
Packit 6eaa26
            'com.intel.dleyna-server', path),
Packit 6eaa26
                            'org.freedesktop.DBus.Properties')
Packit 6eaa26
    folderName = server.Get("", "DisplayName")
Packit 6eaa26
    print '{0:<30}{1:<30}'.format(folderName , path)
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Running this code on a LAN with 3 DMSs produces the following output:
Packit 6eaa26
Packit 6eaa26
My Media                      /com/intel/dLeynaServer/server/3
Packit 6eaa26
Root                          /com/intel/dLeynaServer/server/1
Packit 6eaa26
Test Streams                  /com/intel/dLeynaServer/server/4
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
org.gnome.MediaObject2
Packit 6eaa26
----------------------
Packit 6eaa26
Packit 6eaa26
The org.gnome.MediaObject2 interface exposes some basic properties of
Packit 6eaa26
the server's root directory.  This interface is described
Packit 6eaa26
MediaServer2Spec specification (3).  Dleyna-server-service enhances this
Packit 6eaa26
interface by adding new properties and methods and by defining
Packit 6eaa26
additional values for the Type property.
Packit 6eaa26
Packit 6eaa26
Additional Values for the Type Property:
Packit 6eaa26
----------------------------------------
Packit 6eaa26
Packit 6eaa26
The MediaServer2Spec Type property can be set to one of only seven
Packit 6eaa26
possible values:  'container', 'video', 'video.movie', 'audio',
Packit 6eaa26
'music', 'image' or 'image.photo'.  This causes a number of problems
Packit 6eaa26
for dLeyna-server.  First, there is only one value for container, so
Packit 6eaa26
it is not possible to indicate if the container is an album or a
Packit 6eaa26
playlist, for instance.  Secondly, there is no way to represent an item
Packit 6eaa26
that is not an audio, video or image item, such as a generic item
Packit 6eaa26
(UPnP class of object.item) or a playlist item.
Packit 6eaa26
Packit 6eaa26
dLeyna-server solves these two different problems in two ways:
Packit 6eaa26
Packit 6eaa26
- It provides a new property called TypeEx, which provides extended
Packit 6eaa26
  type information.  TypeEx is a superset of Type, providing specific
Packit 6eaa26
  values of object types that are not supported by Type.  For example,
Packit 6eaa26
  for an album, Type will be container but TypeEx will be set to
Packit 6eaa26
  container.album.musicAlbum.
Packit 6eaa26
Packit 6eaa26
- It provides a new catch all value for Type, item.unclassified.
Packit 6eaa26
  item.unclassified means that the object is an item but it is not
Packit 6eaa26
  an audio, video, or image item, e.g.,a  generic item or a playlist item.
Packit 6eaa26
  The actual type of the item is stored in TypeEx.  item.unclassified
Packit 6eaa26
  may be specified as a value for the Type property in searches.  In such
Packit 6eaa26
  cases it is treated as the UPnP type object.item.
Packit 6eaa26
Packit 6eaa26
Adding an additional value to MediaServer2Spec's Type property breaks our
Packit 6eaa26
compliance with this spec a little, but it is necessary to achieve UPnP
Packit 6eaa26
certification.
Packit 6eaa26
Packit 6eaa26
Additional Properties:
Packit 6eaa26
----------------------
Packit 6eaa26
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
|     Name        | Type  | m/o* |              Description                 |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| DLNAManaged     | a{sb} |  o   |  A dictionary of boolean values          |
Packit 6eaa26
|                 |       |      |  indicating the values of the various    |
Packit 6eaa26
|                 |       |      |  DLNA managed attributes. There are 5    |
Packit 6eaa26
|                 |       |      |  keys: Upload, CreateContainer, Delete,  |
Packit 6eaa26
|                 |       |      |  UploadDelete, ChangeMeta                |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| Restricted      |  b    |  m   |  Indicates whether the object is         |
Packit 6eaa26
|                 |       |      |  modifiable.                             |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| Creator         |  s    |  o   |  Indicates an entity that owns the       |
Packit 6eaa26
|                 |       |      |  content or is primarily responsible for |
Packit 6eaa26
|                 |       |      |  creating the content.                   |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| ObjectUpdateID  |  u    |  o   |  Represents a last-modified timestamp    |
Packit 6eaa26
|                 |       |      |  for the object relative to the          |
Packit 6eaa26
|                 |       |      |  SystemUpdateID state variable.          |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| TypeEx          |  s    |  m   |  The extended Type of the object.        |
Packit 6eaa26
|                 |       |      |  TypeEx permits a superset of the values |
Packit 6eaa26
|                 |       |      |  supported by the Type property.  When   |
Packit 6eaa26
|                 |       |      |  the Type of an object is accurately     |
Packit 6eaa26
|                 |       |      |  described by Type, i.e., the object     |
Packit 6eaa26
|                 |       |      |  is a basic container or is an image,    |
Packit 6eaa26
|                 |       |      |  audio, or video file, TypeEx = Type.    |
Packit 6eaa26
|                 |       |      |  For objects where this is not the case, |
Packit 6eaa26
|                 |       |      |  e.g., an album, the TypeEx value is     |
Packit 6eaa26
|                 |       |      |  formed by removing the                  |
Packit 6eaa26
|                 |       |      |  "object." prefix from the UPnP          |
Packit 6eaa26
|                 |       |      |  class. For example, the TypeEx value    |
Packit 6eaa26
|                 |       |      |  for the UPnP class,                     |
Packit 6eaa26
|                 |       |      |  object.container.playlistContainer is   |
Packit 6eaa26
|                 |       |      |  container.playlistContainer.            |
Packit 6eaa26
|                 |       |      |                                          |
Packit 6eaa26
|                 |       |      |  New in version 0.2.0.                   |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Additional Methods:
Packit 6eaa26
------------------
Packit 6eaa26
Packit 6eaa26
Delete() -> void
Packit 6eaa26
Packit 6eaa26
Delete will simply call the UPnP DestroyObject method on the relevant
Packit 6eaa26
server side object. Note that calling Delete on the root object of a
Packit 6eaa26
server will delete all the contents on the server but not the
Packit 6eaa26
device object itself.
Packit 6eaa26
Packit 6eaa26
Update(a{sv} ToAddUpdate, as ToDelete) -> void
Packit 6eaa26
Packit 6eaa26
Updates the meta data of an existing DMS object.  It is based on the
Packit 6eaa26
MediaServerAv UpdateObject command.  ToAddUpdate is a dictionary of
Packit 6eaa26
property name value pairs that are to be updated, or added if they do
Packit 6eaa26
not already exist.  ToDelete is an array of properties to be deleted.
Packit 6eaa26
The same property cannot appear in both ToAddUpdate and ToDelete.
Packit 6eaa26
Only the following properties can be updated: 'Date', 'DisplayName',
Packit 6eaa26
'Artists', 'Album', 'TypeEx', 'TrackNumber'.
Packit 6eaa26
Packit 6eaa26
GetMetaData() -> s
Packit 6eaa26
Packit 6eaa26
Returns the object meta data information in DIDL-Lite XML format.  This
Packit 6eaa26
is useful when writing Digital Media Controllers. The controllers can
Packit 6eaa26
pass this information to the DMR which can use it to determine the server
Packit 6eaa26
side streaming options for the object. New in v0.0.2.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
org.gnome.MediaContainer2
Packit 6eaa26
----------------------
Packit 6eaa26
Packit 6eaa26
The org.gnome.MediaContainer2 interface exposes some additional
Packit 6eaa26
properties of the root directory.  It also provides methods that can
Packit 6eaa26
be used by clients to perform a recursive search on the root directory
Packit 6eaa26
and to retrieve a list of its children.  The org.gnome.MediaContainer2
Packit 6eaa26
interface is documented in the MediaServer2Spec (3).  However,
Packit 6eaa26
dleyna-server-service's implementation of org.gnome.MediaContainer2
Packit 6eaa26
differs slightly from the specification.  These differences can be
Packit 6eaa26
grouped into two categories: unsupported properties and new methods.
Packit 6eaa26
Packit 6eaa26
Unsupported Properties:
Packit 6eaa26
-----------------------
Packit 6eaa26
Packit 6eaa26
The properties org.gnome.UPnP.MediaContainer2.ItemCount and
Packit 6eaa26
org.gnome.UPnP.MediaContainer2.ContainerCount are not implemented as
Packit 6eaa26
there is no way to efficiently implement these properties in
Packit 6eaa26
dleyna-server-service.
Packit 6eaa26
Packit 6eaa26
In addition, org.gnome.UPnP.MediaContainer2.Icon is not supported
Packit 6eaa26
either as its implementation is really complicated, requiring the
Packit 6eaa26
creation of virtual objects.  Furthermore, it cannot be properly
Packit 6eaa26
implemented in dleyna-server-service as the UPnP servers do not provide
Packit 6eaa26
us with enough information to populate the mandatory properties for
Packit 6eaa26
these virtual objects.  Nevertheless, clients can retrieve a URL that
Packit 6eaa26
points to a server's icon via the com.intel.dLeynaServer.MediaDevice property
Packit 6eaa26
IconURL.
Packit 6eaa26
Packit 6eaa26
Please note that none of these unsupported properties are mandatory,
Packit 6eaa26
so their absence does not affect dleyna-server-service's compatibility
Packit 6eaa26
with MediaServer2Spec.
Packit 6eaa26
Packit 6eaa26
Additional properties unsupported by org.gnome.MediaContainer2
Packit 6eaa26
--------------------------------------------------------------
Packit 6eaa26
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
|     Name               | Type | m/o* |              Description           |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| CreateClasses          |a(sb) |  o   |  The CreateClasses property is an  |
Packit 6eaa26
|                        |      |      |  array of tuples (sb) that lists   |
Packit 6eaa26
|                        |      |      |  the extended types of objects that|
Packit 6eaa26
|                        |      |      |  that can be created in a          |
Packit 6eaa26
|                        |      |      |  container. A boolean value is     |
Packit 6eaa26
|                        |      |      |  associated with each type.  This  |
Packit 6eaa26
|                        |      |      |  boolean indicates whether objects |
Packit 6eaa26
|                        |      |      |  of types derived from the         |
Packit 6eaa26
|                        |      |      |  specified extended type can also  |
Packit 6eaa26
|                        |      |      |  be created in this container.     |
Packit 6eaa26
|                        |      |      |  For example,                      |
Packit 6eaa26
|                        |      |      |  ("container.album.","true")       |
Packit 6eaa26
|                        |      |      |  would indicate that objects of    |
Packit 6eaa26
|                        |      |      |  type container.album,             |
Packit 6eaa26
|                        |      |      |  container.album.music and         |
Packit 6eaa26
|			 |	|      |  container.album.photo can be      |
Packit 6eaa26
|                        |      |      |  created in the container.         |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| ContainerUpdateID      |  u   |  o   |  Contains the value of the         |
Packit 6eaa26
|                        |      |      |  SystemUpdateID state variable     |
Packit 6eaa26
|                        |      |      |  generated by the most recent      |
Packit 6eaa26
|                        |      |      |  container modification for that   |
Packit 6eaa26
|                        |      |      |  container                         |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| TotalDeletedChildCount |  u   |  o   |  Contains the total number of      |
Packit 6eaa26
|                        |      |      |  child objects that have been      |
Packit 6eaa26
|                        |      |      |  deleted from a container object   |
Packit 6eaa26
|                        |      |      |  since the last initialization     |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| Resources              |aa{sv}|  o   |  Returns the set of resources      |
Packit 6eaa26
|                        |      |      |  associated with a container.      |
Packit 6eaa26
|                        |      |      |  New in v0.0.2                     |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| DLNAConversion         | a{sb}|  o   |                                    |
Packit 6eaa26
| DLNAFlags              | a{sb}|  o   |                                    |
Packit 6eaa26
| DLNAOperation          | a{sb}|  o   |  See "Container properties"        |
Packit 6eaa26
| DLNAProfile            |  s   |  o   |  paragraph below. New in v0.0.2    |
Packit 6eaa26
| MIMEType               |  s   |  o   |                                    |
Packit 6eaa26
| Size                   |  x   |  o   |                                    |
Packit 6eaa26
| UpdateCount            |  u   |  o   |                                    |
Packit 6eaa26
| URLs                   |  as  |  o   |                                    |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
Packit 6eaa26
Container properties:
Packit 6eaa26
---------------------
Packit 6eaa26
Each container may expose one or more resources via the Resources
Packit 6eaa26
property. Each resource typically represents a playlist, containing
Packit 6eaa26
references (often URLs) to the container's media items. Multiple
Packit 6eaa26
resources may be specified for a single container as the DMS may
Packit 6eaa26
support different playlist formats, e.g., M3U, DIDL-S, etc. The
Packit 6eaa26
properties of one of these resources may be duplicated directly in the
Packit 6eaa26
Container object itself. The algorithm for selecting this resource
Packit 6eaa26
is given in the section "Transcoding and org.gnome.UPnP.MediaItem2".
Packit 6eaa26
In MediaItem2 section also, you will find the definition for these properties
Packit 6eaa26
in Resources/Additional properties.
Packit 6eaa26
Packit 6eaa26
New Methods:
Packit 6eaa26
------------
Packit 6eaa26
Packit 6eaa26
Eight new methods have been added.  These methods are:
Packit 6eaa26
Packit 6eaa26
ListChildrenEx(u Offset, u Max, as Filter, s SortBy) -> aa{sv}
Packit 6eaa26
Packit 6eaa26
ListItemsEx(u Offset, u Max, as Filter, s SortBy) -> aa{sv}
Packit 6eaa26
Packit 6eaa26
ListContainersEx(u Offset, u Max, as Filter, s SortBy) -> aa{sv}
Packit 6eaa26
Packit 6eaa26
SearchObjectsEx(s Query, u Offset, u Max, as Filter, s SortBy) -> (aa{sv}u)
Packit 6eaa26
Packit 6eaa26
Upload(s DisplayName, s FilePath) -> (u UploadId, o ObjectPath)
Packit 6eaa26
Packit 6eaa26
CreateContainer(s DisplayName, s TypeEx, as ChildTypes) -> o ObjectPath
Packit 6eaa26
Packit 6eaa26
CreateReference(o ObjectPath) -> o ObjectPath
Packit 6eaa26
Packit 6eaa26
GetCompatibleResources(s protocol_info, as filter) -> a{sv}
Packit 6eaa26
Packit 6eaa26
The first four methods are identical in function and behaviour to
Packit 6eaa26
existing the MediaServer2Spec functions ListChildren, ListItems,
Packit 6eaa26
ListContainers, and SearchObjects, with the exception that they take
Packit 6eaa26
one extra parameter, and in the case of SearchObjectsEx, return an
Packit 6eaa26
extra result.
Packit 6eaa26
Packit 6eaa26
This extra parameter allows clients to specify a sort
Packit 6eaa26
order for the returned items.  It is a string that specifies a comma
Packit 6eaa26
separated list of PropertyNames, identifying the order in which
Packit 6eaa26
returned items should be sorted.  Each property name can be preceded
Packit 6eaa26
with a '-' or a '+' to indicate descending or ascending order
Packit 6eaa26
respectively.  An example, is "+Date,-DisplayName", which will sort
Packit 6eaa26
the return items first by date in ascending order and then by name in
Packit 6eaa26
descending order.  White space is not permitted in this string.
Packit 6eaa26
Packit 6eaa26
The return signature of SearchObjectsEx is (aa{sv}u).  Note the extra
Packit 6eaa26
integer return value after the dictionary of objects.  This integer
Packit 6eaa26
contains the total number of items matching the specified search as
Packit 6eaa26
opposed to the total number of objects contained in the returned dictionary
Packit 6eaa26
of objects.  These two values may differ if the client has used the
Packit 6eaa26
Offset and Max parameters to request a portion of the total
Packit 6eaa26
results returned, because for example its screen is only capable of
Packit 6eaa26
displaying 20 objects at any one time.  Knowing the total number of
Packit 6eaa26
objects that match a search is useful for applications.
Packit 6eaa26
It allows them to inform the user as to the total number of matches
Packit 6eaa26
and to correctly compute the scrollbars of the list displaying
Packit 6eaa26
the found items.
Packit 6eaa26
Packit 6eaa26
A small Python function is given below to demonstrate how these new
Packit 6eaa26
methods may be used.  This function accepts one parameter, a path to a
Packit 6eaa26
d-Bus container object, and it prints out the names of all the
Packit 6eaa26
children of that object in descending order.
Packit 6eaa26
Packit 6eaa26
def list_children(server_path):
Packit 6eaa26
    bus = dbus.SessionBus()
Packit 6eaa26
    container = dbus.Interface(bus.get_object(
Packit 6eaa26
                'com.intel.dleyna-server', path),
Packit 6eaa26
                                        'org.gnome.UPnP.MediaContainer2')
Packit 6eaa26
    objects = container.ListChildrenEx(0, 0, ['DisplayName'], "-DisplayName")
Packit 6eaa26
    for item in objects:
Packit 6eaa26
        for key, value in item.iteritems():
Packit 6eaa26
            print '{0:<30}{1:<30}'.format(key, value)
Packit 6eaa26
Packit 6eaa26
The output of this function might look something like this:
Packit 6eaa26
Packit 6eaa26
DisplayName                   Videos
Packit 6eaa26
DisplayName                   Pictures
Packit 6eaa26
DisplayName                   Music
Packit 6eaa26
DisplayName                   Files & Folders
Packit 6eaa26
Packit 6eaa26
when the server_path parameter contains the path of a server object.
Packit 6eaa26
Packit 6eaa26
The fifth new method, Upload, allows clients to upload a local file to
Packit 6eaa26
the org.gnome.UPnP.MediaContainer2 object upon which it was executed.
Packit 6eaa26
It is identical in function and behavior to
Packit 6eaa26
com.intel.dLeynaServer.MediaDevice.UploadToAnyContainer with the sole
Packit 6eaa26
exception that Upload allows the client to specify the server-side
Packit 6eaa26
container into which the file is to be uploaded whereas
Packit 6eaa26
UploadToAnyContainer leaves it up to the server to determine the most
Packit 6eaa26
suitable location for the file.
Packit 6eaa26
Packit 6eaa26
The CreateContainer method creates a new child container.
Packit 6eaa26
DisplayName is the name of the new container,
Packit 6eaa26
TypeEx is the extended type and ChildTypes is an array of extended
Packit 6eaa26
types that can be stored in the new folder, e.g., ['video','container'].
Packit 6eaa26
A special value of ['*'] indicates that no restriction is placed
Packit 6eaa26
on the types of objects that can be stored in the container.
Packit 6eaa26
The path of the newly created object is returned.
Packit 6eaa26
Packit 6eaa26
The CreateReference method creates a reference in the container to the object
Packit 6eaa26
identified by the ObjectPath parameter. This method returns the d-Bus path of
Packit 6eaa26
the newly created reference.  CreateReference is useful when creating
Packit 6eaa26
server side playlists.  CreateContainer can be used to create a new playlist,
Packit 6eaa26
and CreateReference can be used to add items to that playlist.
Packit 6eaa26
Packit 6eaa26
The GetCompatibleResources method: see description in MediaItem2.
Packit 6eaa26
Packit 6eaa26
Recommended Usage:
Packit 6eaa26
------------------
Packit 6eaa26
Packit 6eaa26
All of the list and search functions supported by dleyna-server-service's
Packit 6eaa26
implementation of org.gnome.UPnP.MediaContainer2 contain three
Packit 6eaa26
parameters that should be used to improve the efficiency and
Packit 6eaa26
responsiveness of applications built using dleyna-server-service.
Packit 6eaa26
Packit 6eaa26
The first two parameters of interest are offset and max.  These
Packit 6eaa26
parameters allow the client application to retrieve the contents of a
Packit 6eaa26
directory, or the results of a search, in chunks.  This is vital if
Packit 6eaa26
the client's user interface is limited to displaying a fixed number,
Packit 6eaa26
let's say 30, items on the screen at any one time.  Suppose the client
Packit 6eaa26
performs a search which has 2000 results.  If it passes the Search or
Packit 6eaa26
SearchEx method an offset and a max of 0, all of the results will be
Packit 6eaa26
returned to the client at once, even though it is only capable of
Packit 6eaa26
display 30 items at a time.  This will increase the memory
Packit 6eaa26
requirements of the client and reduce its responsiveness as it must
Packit 6eaa26
wait until all 2000 items have been received before it can update the
Packit 6eaa26
UI.  Also, if the user locates the item he is looking for in the first
Packit 6eaa26
page of items, a lot of network and IPC traffic will have been
Packit 6eaa26
generated in vain.  For these reasons, it is better to retrieve items
Packit 6eaa26
in chunks, as needed.
Packit 6eaa26
Packit 6eaa26
The amount of network and IPC traffic can be reduced further by
Packit 6eaa26
prudent use of the filter parameter.  This parameter is an array of
Packit 6eaa26
strings, each element of which corresponds to a property name.  If the
Packit 6eaa26
client invokes a function specifying a filter parameter that is set to
Packit 6eaa26
a single element array containing the string '*', dleyna-server-service
Packit 6eaa26
will include all the properties of all the requested objects in the
Packit 6eaa26
result.  However, often the client only needs to know a subset of
Packit 6eaa26
these properties.  A UI that displays results of a search might only
Packit 6eaa26
want to display the names and perhaps the dates of the items that
Packit 6eaa26
match the search.  Once the user has identified the item he is looking
Packit 6eaa26
for, the remaining properties for that item, and only that item, can
Packit 6eaa26
be retrieved.  As an example, consider the list_children function
Packit 6eaa26
above.  It requests that only the DisplayName of each of the
Packit 6eaa26
containers' children be returned.  Replacing ['DisplayName'] with
Packit 6eaa26
['*'] will generate a lot more output.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Container Objects:
Packit 6eaa26
------------------
Packit 6eaa26
Packit 6eaa26
Container objects represent folders in a DMS.  In order to manipulate
Packit 6eaa26
a container object one first needs to discover its path.  This can be
Packit 6eaa26
done by calling one of the List or Search methods implemented by the
Packit 6eaa26
server object or another container object.  Note that a server object
Packit 6eaa26
is also a container object so a container object can be constructed by
Packit 6eaa26
using a server's d-Bus object path.
Packit 6eaa26
Packit 6eaa26
Container objects support two interfaces: org.gnome.MediaObject2 and
Packit 6eaa26
org.gnome.MediaContainer2.  Both of these interfaces have been
Packit 6eaa26
described in detail above and will not be discussed further in this
Packit 6eaa26
section.
Packit 6eaa26
Packit 6eaa26
An example of how container objects can be used is given in the
Packit 6eaa26
following function.
Packit 6eaa26
Packit 6eaa26
def tree(server_path, level=0):
Packit 6eaa26
    bus = dbus.SessionBus()
Packit 6eaa26
    container = dbus.Interface(bus.get_object(
Packit 6eaa26
                'com.intel.dleyna-server', server_path),
Packit 6eaa26
                                        'org.gnome.UPnP.MediaContainer2')
Packit 6eaa26
    objects = container.ListChildren(0, 0, ["DisplayName", "Path", "Type"])
Packit 6eaa26
    for props in objects:
Packit 6eaa26
        print " " * (level * 4) + ( props["DisplayName"] +
Packit 6eaa26
                                    " : (" + props["Path"]+ ")")
Packit 6eaa26
        if props["Type"] == "container":
Packit 6eaa26
            tree(props["Path"], level + 1)
Packit 6eaa26
Packit 6eaa26
When given the path of a container, and this could be a server object
Packit 6eaa26
which acts as a root container, it recursively prints the contents of
Packit 6eaa26
that container in depth first order.  For example, to dump the entire
Packit 6eaa26
contents of the My Media server introduced above, one would simply
Packit 6eaa26
need to invoke tree("/com/intel/dLeynaServer/server/3").
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Item Objects:
Packit 6eaa26
-------------
Packit 6eaa26
Packit 6eaa26
Item objects represent a unique piece of media that can be downloaded
Packit 6eaa26
or streamed.  Each item object implements the
Packit 6eaa26
org.gnome.UPnP.MediaObject2 interface, which is described above, and
Packit 6eaa26
the org.gnome.UPnP.MediaItem2 interface that is documented in the
Packit 6eaa26
MediaServer2Spec (3).  Although the org.gnome.UPnP.MediaItem2 is
Packit 6eaa26
documented elsewhere, there are some peculiarities of its
Packit 6eaa26
implementation in dleyna-server-service that merit further explanation.
Packit 6eaa26
These are described in the sections below.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Transcoding and org.gnome.UPnP.MediaItem2
Packit 6eaa26
-----------------------------------------
Packit 6eaa26
Packit 6eaa26
As mentioned above, DMSs often provide different representations of
Packit 6eaa26
the same media file.  Separate sets of meta data, such as a mime type,
Packit 6eaa26
a URL, a size, a ColorDepth, etc., are associated with each
Packit 6eaa26
representation.  Unfortunately, it is difficult to represent this in
Packit 6eaa26
org.gnome.UPnP.MediaItem2.  Although, org.gnome.UPnP.MediaItem2,
Packit 6eaa26
allows multiple URLs to be specified, it only permits a single set of
Packit 6eaa26
meta data to be associated with each item.  For example, the MIMEType
Packit 6eaa26
property is a single string and not an array.  If multiple URLs were
Packit 6eaa26
associated with the same item, one would not know to which URL the
Packit 6eaa26
MIMEType property pertained.  For this reason, dleyna-server-service only
Packit 6eaa26
ever returns one element in the URLs property.  By default, the value
Packit 6eaa26
of this URL and all of the meta data properties that can change with a
Packit 6eaa26
representation (MIMEType, DLNAProfile, Size, Duration, Bitrate,
Packit 6eaa26
SampleRate, BitsPerSample, Width, Height, ColorDepth) refer to the
Packit 6eaa26
first representation returned by the DMS for this item.  However, the
Packit 6eaa26
client can change this behaviour by calling
Packit 6eaa26
com.intel.dLeynaServer.Manager.SetProtocolInfo.  If this is done,
Packit 6eaa26
these properties correspond to the first representation returned by
Packit 6eaa26
the server that is compatible with the specified protocol info.  If no
Packit 6eaa26
representations are compatible, these properties will not be present
Packit 6eaa26
in the item.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Resources
Packit 6eaa26
----------
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service offers a second solution to the above problem that
Packit 6eaa26
may be useful in certain programming environments.  It implements a
Packit 6eaa26
non standard property called "Resources" which is an array of
Packit 6eaa26
dictionaries.  Each dictionary represents a separate representation of
Packit 6eaa26
the item and contains all the properties, including the MIMEType and
Packit 6eaa26
the URL that pertain to that representation.  This can be convenient
Packit 6eaa26
if you wish to display the media item in a web browser.  You can
Packit 6eaa26
simply create a video or an audio tag with one source for each element
Packit 6eaa26
in the resources array and then let the browser work out which one
Packit 6eaa26
suits it best.  The specification for the Resources property is given
Packit 6eaa26
in the table below:
Packit 6eaa26
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
|     Name        | Type | m/o* |              Description                  |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| Resources       |aa{sv}|  m   | Returns the set of resources associated   |
Packit 6eaa26
|                 |      |      |  with an item                             |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
Packit 6eaa26
The names of the properties included in this array are identical to
Packit 6eaa26
the names of the org.gnome.UPnP.MediaItem2 properties to which they
Packit 6eaa26
correspond, e.g., MIMEType, Size.
Packit 6eaa26
However, four additional properties are included.
Packit 6eaa26
Packit 6eaa26
Please note that if you want the resource properties to be included in the
Packit 6eaa26
results of a call to one of the List or the Search functions, and you
Packit 6eaa26
are explicitly filtering properties, you must include "Resources" in
Packit 6eaa26
the filter array.  The filter parameter also applies to the contents
Packit 6eaa26
of the returned resources.  So if you specify a filter of ["MIMEType",
Packit 6eaa26
"URL", "Resources"] the dictionaries in the resources array will contain
Packit 6eaa26
only these properties.
Packit 6eaa26
Packit 6eaa26
dLeyna-server defines four additional resource properties.  These have been
Packit 6eaa26
added to improve our DLNA support.
Packit 6eaa26
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
|     Name        | Type  | m/o* |              Description                 |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| DLNAConversion  | a{sb} |  o   |  Indicates whether the content of the    |
Packit 6eaa26
|                 |       |      |  Resource is in original source format   |
Packit 6eaa26
|                 |       |      |  or if the content is transcoded.        |
Packit 6eaa26
|                 |       |      |  There is 1 key: Transcoded.             |
Packit 6eaa26
|                 |       |      |  See Reference (4): DLNA.ORG_CI.         |
Packit 6eaa26
|                 |       |      |                                          |
Packit 6eaa26
|                 |       |      |  New in v0.0.2                           |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| DLNAFlags       | a{sb} |  o   |  A dictionary of boolean values          |
Packit 6eaa26
|                 |       |      |  indicating the values of the various    |
Packit 6eaa26
|                 |       |      |  operations supported by a resource.     |
Packit 6eaa26
|                 |       |      |  There are 12 keys:                      |
Packit 6eaa26
|                 |       |      |  SenderPaced, TimeBased, ByteBased,      |
Packit 6eaa26
|                 |       |      |  PlayContainer, S0Increase, SNIncrease   |
Packit 6eaa26
|                 |       |      |  RTSPPause, StreamingTM, InteractiveTM   |
Packit 6eaa26
|                 |       |      |  BackgroundTM, ConnectionStall, DLNA_V15 |
Packit 6eaa26
|                 |       |      |  See Reference (5): DLNA.ORG_FLAGS.      |
Packit 6eaa26
|                 |       |      |                                          |
Packit 6eaa26
|                 |       |      |  New in v0.0.2                           |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| DLNAOperation   | a{sb} |  o   |  A dictionary of boolean values          |
Packit 6eaa26
|                 |       |      |  indicating the values of the various    |
Packit 6eaa26
|                 |       |      |  DLNA Operation attributes. There are 2  |
Packit 6eaa26
|                 |       |      |  keys: RangeSeek and TimeSeek.           |
Packit 6eaa26
|                 |       |      |  See Reference (6): DLNA.ORG_OP.         |
Packit 6eaa26
|                 |       |      |                                          |
Packit 6eaa26
|                 |       |      |  New in v0.0.2                           |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| UpdateCount     |  u    |  o   |  Contains the number of times the        |
Packit 6eaa26
|                 |       |      |  implementation detects that a change    |
Packit 6eaa26
|                 |       |      |  was made to the resource.               |
Packit 6eaa26
|                 |       |      |                                          |
Packit 6eaa26
|                 |       |      |  New in v0.0.2                           |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
GetCompatibleResource
Packit 6eaa26
------------------------
Packit 6eaa26
Packit 6eaa26
A third option is provided to make the lives of DMC authors easier.
Packit 6eaa26
In a DMC, the best resource is defined not by the local device but by
Packit 6eaa26
the capabilities of the renderer chosen by the user to play the given
Packit 6eaa26
item.  Once the user selects a file to play and a renderer upon which
Packit 6eaa26
to play it, the DMC needs to retrieve the renderer's Sink
Packit 6eaa26
ProtocolInfo.  It can then pass this data directly to a new function
Packit 6eaa26
that dleyna-server-service adds to the org.gnome.UPnP.MediaItem2
Packit 6eaa26
interface, called GetCompatibleResource.  GetCompatibleResource
Packit 6eaa26
returns a dictionary of properties that corresponds to the item
Packit 6eaa26
representation that best matches a specified protocol info.  The
Packit 6eaa26
signature of GetCompatibleResources is given below:
Packit 6eaa26
Packit 6eaa26
GetCompatibleResources(s protocol_info, as filter) -> a{sv}
Packit 6eaa26
Packit 6eaa26
The first argument is a comma separated list of protocol info values,
Packit 6eaa26
as described above.  The second argument is an array of properties to
Packit 6eaa26
be included in the returned dictionary.  The format and the behaviour
Packit 6eaa26
of this array is identical to the filter argument passed to the Search
Packit 6eaa26
and List functions.
Packit 6eaa26
Packit 6eaa26
Additional Properties
Packit 6eaa26
---------------------
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service defines some additional properties for
Packit 6eaa26
org.gnome.UPnP.MediaItem2. These properties are described in the table
Packit 6eaa26
below:
Packit 6eaa26
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
|     Name        | Type | m/o* |              Description                  |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| AlbumArtURL     |  s    |  o   | Contains the URL of the album art        |
Packit 6eaa26
|                 |       |      |  associated with an item                 |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| RefPath         |  o    |  o   | The presence of this property indicates  |
Packit 6eaa26
|                 |       |      |  that the item is a reference item that  |
Packit 6eaa26
|                 |       |      |  references another item located         |
Packit 6eaa26
|                 |       |      |  elsewhere in the DMS's directory        |
Packit 6eaa26
|                 |       |      |  structure. The value of this property   |
Packit 6eaa26
|                 |       |      |  is the path of the referenced item.     |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| Artists         |  o    |  m   | An array of all the artists who          |
Packit 6eaa26
|                 |       |      |  contributed towards the creation of the |
Packit 6eaa26
|                 |       |      |  item. The array will be empty if no     |
Packit 6eaa26
|                 |       |      |  artists are associated with the item.   |
Packit 6eaa26
|---------------------------------------------------------------------------|
Packit 6eaa26
| DLNAConversion  | a{sb} |  o   |  These 4 properties are copied from the  |
Packit 6eaa26
|--------------------------------   currently selected resource into the    |
Packit 6eaa26
| DLNAFlags       | a{sb} |  o   |  org.gnome.UPnP.MediaItem2 object.       |
Packit 6eaa26
|--------------------------------                                           |
Packit 6eaa26
| DLNAOperation   | a{sb} |  o   |                                          |
Packit 6eaa26
|--------------------------------                                           |
Packit 6eaa26
| UpdateCount     |  u    |  o   |                                          |
Packit 6eaa26
-----------------------------------------------------------------------------
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service does not implement the
Packit 6eaa26
org.gnome.UPnP.MediaItem2.AlbumArt property for the same reasons that
Packit 6eaa26
it does not implement the org.gnome.UPnP.MediaContainer2.Icon
Packit 6eaa26
property. However, it does provide an alternative method of retrieving
Packit 6eaa26
the album art associated with media content. It does this through a
Packit 6eaa26
new property called AlbumArtURL described in the table above that
Packit 6eaa26
exposes the URL of the album art directly.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
Unimplemented Properties
Packit 6eaa26
-----------------------
Packit 6eaa26
Packit 6eaa26
Dleyna-server-service does not support the following MediaServer2Spec
Packit 6eaa26
properties:
Packit 6eaa26
Packit 6eaa26
PixelWidth
Packit 6eaa26
PixelHeight
Packit 6eaa26
Thumbnail
Packit 6eaa26
AlbumArt
Packit 6eaa26
Packit 6eaa26
However, as these properties are optional, dleyna-server-service's
Packit 6eaa26
failure to support them does not affect its compatibility with
Packit 6eaa26
MediaServer2Spec.
Packit 6eaa26
Packit 6eaa26
Packit 6eaa26
References:
Packit 6eaa26
-----------
Packit 6eaa26
Packit 6eaa26
1) ConnectionManager:2 Service Template (http://www.upnp.org/)
Packit 6eaa26
2) DLNA Guidelines December 2011, Part 1 Architectures and Protocols
Packit 6eaa26
(http://www.dlna.org/)
Packit 6eaa26
3) MediaServer2Spec (https://wiki.gnome.org/Projects/Rygel/MediaServer2Spec)
Packit 6eaa26
4) See 2) 7.4.1.3.22 MM ci-param (Conversion Indicator Flag)
Packit 6eaa26
5) See 2) 7.4.1.3.23 MM flags-param (Flags Parameter)
Packit 6eaa26
6) See 2) 7.4.1.3.19 MM op-param (Operations Parameter for HTTP)