rytilahti / python-songpal

Python library for interfacing with Sony's Songpal devices
GNU General Public License v3.0
66 stars 24 forks source link

Add basic DLNA/UPnP support #23

Open thomnico opened 6 years ago

thomnico commented 6 years ago

Hi, The basic works for this device .. but not the dlna/upnp input which is my main usage.

Attached is the dump_devinfo

I can test and do a little python if that helps.

thomnico commented 6 years ago

https://gist.github.com/thomnico/c3ff171ed1204da93affc086a1415129

rytilahti commented 6 years ago

Can you be more specific about the problem you have with upnp/dlna? Is it related to those discussed in #5?

Thanks for the devinfo, could you create a PR to add it to https://github.com/rytilahti/python-songpal/tree/master/devinfos ?

thomnico commented 6 years ago

I added the pull request #27 for devinfo.

Here is one of the non working call I got: songpal --endpoint http://192.168.0.100:10000/sony source WARNING:songpal.service:More than on version for {'versions': [{'version': '1.1'}, {'version': '1.2'}], 'name': 'getSourceList'}, using the first one WARNING:songpal.service:More than on version for {'versions': [{'version': '1.1', 'authLevel': 'generic'}, {'version': '1.2'}], 'name': 'getStorageList'}, using the first one WARNING:songpal.service:More than on version for {'versions': [{'version': '1.3'}, {'version': '1.4'}], 'name': 'getSystemInformation'}, using the first one TV (extInput:tv) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] HDMI1 (extInput:hdmi?port=1) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] HDMI2 (extInput:hdmi?port=2) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] HDMI3 (extInput:hdmi?port=3) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] Bluetooth Audio (extInput:btAudio) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] Analog (extInput:line) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] USB (storage:usb1) Got an error for getContentCount: [15, 'unsupported operation'] Got an error for getContentList: [15, 'there is no usb loaded'] Home Network (dlna:music) ContentInfo(capability=0, count=-1) Got an error for getContentList: [15, 'unsupported operation'] Unable to get sources for cast Unable to get sources for netService

Can you please help me debug that ??

thomnico commented 6 years ago

https://gist.github.com/thomnico/1e78afa45ea7808842994739e9dcfc9f same with debug information

rytilahti commented 6 years ago

Playback from upnp/dlna sources is not currently implemented: https://developer.sony.com/develop/audio-control-api/get-started/play-dlna-file . I think it is not possible to change to that source via this API, but it should be done in DLNA way. The output from source is quite verbose (as it calls both list of content and then tries to read the content list), but do you have some specific functionality which is not working? What do you want to debug?

thomnico commented 6 years ago

Thanks for the answers. All the lines with 'unsupported operation' seems to need some attention or should not log such a message, imho.

My ideal scenario will be to be able to control the dlna from this api code indeed.

rytilahti commented 6 years ago

Indeed, I just changed that in a recent commit (but forgot to remove some debug printouts, which will be removed soonish). There is https://github.com/StevenLooman/async_upnp_client which could be used to facilitate DLNA, but I think the control is more generic and very unlikely to be implemented in this project.