[coherence-dev] using coherence as a client
Frank Scholz
fs at beebits.net
Sat Apr 18 16:15:57 CEST 2009
Hi Alexandre,
> My problem is what i have to initialize to be able to import media file
> from my server ? av_transport ? ( i see these object but i don't what is
> it for).
>
> I'm interested if you have any information about importing files.
"Importing" is part of the ContentDirectory service. And the actions
needed for that are optional, so you first have to check whether the
MediaServer does support them.
The actions are 'CreateObject' and 'ImportResource'.
If there is only a 'CreateObject' and no 'ImportResource',
your only option is to push the content via a HTTP-Post
to the URI in the result of 'CreateObject'.
service = device.get_service_by_type('ContentDirectory')
if 'CreateObject' in service.get_actions():
....
The Coherence FSStore and the FlickrStore backend both support these
actions btw.
For that HTTP-Post there is already a simple helper
in the ControlPoint class.
http://coherence.beebits.net/browser/trunk/Coherence/coherence/upnp/devices/control_point.py#L158
Now to the example.
There is a Nautilus plugin to upload selected files to
an UPnP A/V MediaServer
http://coherence.beebits.net/wiki/Nautilus#uploadingselectedfilestoUPnPAVMediaServers
The code that actually imports a file is
http://coherence.beebits.net/browser/trunk/Coherence/coherence/ui/av_widgets.py#L275
It uses 'DLNA.ORG_AnyContainer' as the target container, leaving the
choice to the MediaServer where to put it.
Regards,
Frank
More information about the coherence-dev
mailing list