antonioparraga / braviarc

Python library for Sony Bravia TV remote control
MIT License
79 stars 41 forks source link

Support analog inputs (component/composite) #14

Closed dnschneid closed 7 years ago

dnschneid commented 7 years ago

Currently load_source_list seems to ignore component and composite inputs, and only returns HDMI and TV inputs. It would be useful if the analog inputs were included as well.

dnschneid commented 7 years ago

In addition to HDMI, it appears I have these extra inputs:

{'source': 'extInput:composite'}
{'source': 'extInput:component'}
{'source': 'extInput:cec'}
{'source': 'extInput:widi'}

composite and components are the ones interesting to me. I suspect people who use Miracast or whatever may like widi, and I'm not sure what the CEC input is (since I thought that was just for control).

dnschneid commented 7 years ago

Changing the HDMI section in load_source_list as follows seems to return the extra stuff properly:

if not resp.get('error'):
            results = resp.get('result')[0]
            for result in results:
                if result['source'] in ('extInput:hdmi', 'extInput:composite', 'extInput:component'):  # physical inputs
                    resp = self.bravia_req_json("sony/avContent",
                                                self._jdata_build("getContentList", result))
                    if not resp.get('error'):
                        original_content_list.extend(resp.get('result')[0])

I can turn this into a pull request if it's of interest (or you can just make the same change).

danito commented 7 years ago

Sorry to jump in, but I use still plain old analog cable tv and don't have get this source. Is there a simple way to get all the sources to check the syntax for further filtering?