Hi All,
There is a python file in the test directory of media-service-upnp. It
contains some python classes that make it easy to invoke the various
media-service-upnp methods from python. The primary purpose of these
classes is to provide a crude sort of command line interface for testing
media-service-upnp and for manipulating media servers.
To use, you simply need to download, compile and install
media-service-upnp and then start python. Please find below some examples commands.
First, start python and import mediaconsole
cd test
python
>> from mediaconsole import *
>>
Create a manager object
>> manager = UPNP()
Get a list of DMSs. The second column contains the d-Bus path of
the server.
>> manager.servers()
XBMC (mryan6dev)
/com/intel/MediaServiceUPnP/server/0
MediaTomb /com/intel/MediaServiceUPnP/server/1
My Media /com/intel/MediaServiceUPnP/server/2
Create a Container object for the server "My Media". This Container
object represents the server's root directory.
>> root =
Container("/com/intel/MediaServiceUPnP/server/2")
>>
Print the root object's properties. Note this object has multiple
interfaces.
>> root.print_props()
ManufacturerUrl
http://live.gnome.org/Rygel
ModelName Rygel
DisplayName My Media
Searchable 1
Parent /com/intel/MediaServiceUPnP/server/2
Type container
SerialNumber 0000001
IconURL
http://127.0.0.1:39622/MediaExport-48x48x24.jpg
ModelNumber 0.1
DeviceType urn:schemas-upnp-org:device:MediaServer:2
Location
http://127.0.0.1:39622/f1021319-8d2d-470b-843c-c3656bc26a94.xml
FriendlyName My Media
Path /com/intel/MediaServiceUPnP/server/2
UDN uuid:f1021319-8d2d-470b-843c-c3656bc26a94
ChildCount 4
Manufacturer Rygel Developers.
List the type and name of each child of the root folder.
>>
root.list_children(0,0,["DisplayName","Type"])
Type
container
DisplayName Files & Folders
Type container
DisplayName Music
Type container
DisplayName Pictures
Type container
DisplayName Videos
Search the root folder and its sub-folders for images, print the Name,
d-Bus path and URL of each image found. The search is limited to 5
items and the images are sorted by DisplayName in descending order.
>> root.search('Type derivedfrom "image"', 0,
5, ["DisplayName",
"Path", "URLs"],
"-DisplayName")
Total Items: 16
Path
/com/intel/MediaServiceUPnP/server/2/3365323432376438363962393431626332393630393731643736393864386136
DisplayName EU.jpg
URLs
dbus.Array([dbus.String(u'http://127.0.0.1:39622/MediaExport/i/M2UyNDI3ZDg2OWI5NDFiYzI5NjA5NzFkNzY5OGQ4YTY%3D.jpg')],
signature=dbus.Signature('s'), variant_level=1)
Path
/com/intel/MediaServiceUPnP/server/2/3132643265303865363661666437353438313138396139613166656532636238
DisplayName Eton Mess.jpg
URLs
dbus.Array([dbus.String(u'http://127.0.0.1:39622/MediaExport/i/MTJkMmUwOGU2NmFmZDc1NDgxMTg5YTlhMWZlZTJjYjg%3D.jpg')],
signature=dbus.Signature('s'), variant_level=1)
Path
/com/intel/MediaServiceUPnP/server/2/6465316531663566613033633930633730646631373663666565303335353938
DisplayName Collioure.jpg
URLs
dbus.Array([dbus.String(u'http://127.0.0.1:39622/MediaExport/i/ZGUxZTFmNWZhMDNjOTBjNzBkZjE3NmNmZWUwMzU1OTg%3D.jpg')],
signature=dbus.Signature('s'), variant_level=1)
Path
/com/intel/MediaServiceUPnP/server/2/6661633532656530616266613763646366303263663530626237623439666435
DisplayName Cherry Tree.jpg
URLs
dbus.Array([dbus.String(u'http://127.0.0.1:39622/MediaExport/i/ZmFjNTJlZTBhYmZhN2NkY2YwMmNmNTBiYjdiNDlmZDU%3D.jpg')],
signature=dbus.Signature('s'), variant_level=1)
Path
/com/intel/MediaServiceUPnP/server/2/6138616662396333356264336665656365353436343437353934666530636565
DisplayName Ceidhe Fields.jpg
URLs
dbus.Array([dbus.String(u'http://127.0.0.1:39622/MediaExport/i/YThhZmI5YzM1YmQzZmVlY2U1NDY0NDc1OTRmZTBjZWU%3D.jpg')],
signature=dbus.Signature('s'), variant_level=1)
Create a MediaObject object for the last image so we can inspect it
further.
>> item =
MediaObject("/com/intel/MediaServiceUPnP/server/2/6138616662396333356264336665656365353436343437353934666530636565")
>>
>> item.print_props()
MIMEType image/jpeg
DisplayName Ceidhe Fields.jpg
Parent
/com/intel/MediaServiceUPnP/server/2/3766313934373030326436306666613036326631613838316232376538353139
DLNAProfile JPEG_LRG
Height 1448
Width 2576
URLs
dbus.Array([dbus.String(u'http://127.0.0.1:39622/MediaExport/i/YThhZmI5YzM1YmQzZmVlY2U1NDY0NDc1OTRmZTBjZWU%3D.jpg')],
signature=dbus.Signature('s'), variant_level=1)
Date 2010-05-18T10:09:40Z
Path
/com/intel/MediaServiceUPnP/server/2/6138616662396333356264336665656365353436343437353934666530636565
ColorDepth 0
Type image.photo
Size 792454
Resource 0
MIMEType image/jpeg
URL
http://127.0.0.1:39622/MediaExport/i/YThhZmI5YzM1YmQzZmVlY2U1NDY0NDc1OTRm...
DLNAProfile JPEG_LRG
Height 1448
Width 2576
ColorDepth 0
Size 792454
Resource 1
MIMEType image/png
URL
http://127.0.0.1:39622/MediaExport/i/YThhZmI5YzM1YmQzZmVlY2U1NDY0NDc1OTRm...
DLNAProfile PNG_TN
Height 128
Width 128
ColorDepth 32
Size 15673
Resource 2
MIMEType image/jpeg
URL file:///home/mryan/Pictures/Ceidhe%
20Fields.jpg
DLNAProfile JPEG_LRG
Height 1448
Width 2576
ColorDepth 0
Size 792454
Resource 3
MIMEType image/png
URL
file:///home/mryan/.thumbnails/normal/a8afb9c35bd3feece546447594fe0cee.png
DLNAProfile PNG_TN
Height 128
Width 128
ColorDepth 32
Size 15673
>>
Regards,
Mark