normen / homebridge-bravia

Homebridge plugin for Sony Bravia TVs (AndroidTV based ones and possibly others)
139 stars 26 forks source link

Adding more than 50 channels #140

Closed diegoweb100 closed 3 years ago

diegoweb100 commented 3 years ago

Hi normen,

By default getContentList give as output the first 50 channels, could you please add more than 50 channel?

Considering that homebridge is supporting max 100 for each services is also possible to add multiple identical services to an accessory to split the channels?

I've modify and duplicated the line 484 as below: var post_data = '{"id":13,"method":"getContentList","version":"1.0","params":[{ "source":"' + sourceName + '","stIdx": 0,"cnt":50}]}' that.makeHttpRequest(onError, onSucces, '/sony/avContent', post_data, false); var post_data = '{"id":13,"method":"getContentList","version":"1.0","params":[{ "source":"' + sourceName + '","stIdx": 50,"cnt":30}]} that.makeHttpRequest(onError, onSucces, '/sony/avContent', post_data, false);

but than I faced with the error "Cannot add more than 100 services to a single accessory" (this is why you see cnt=30)... is possible to something similar to this: https://github.com/homebridge/homebridge/issues/139

tnks

normen commented 3 years ago

a) The TV only sends 50 channels in one batch, it would have to be queried multiple times, as mentioned in some issues and the code itself I think. The request sent to the TV has a "from-to" parameter. b) I wouldn't want to add such hacks as having multiple accessories to supply multiple channels. If at all I'd suggest having the option to use the favorites list of the TV instead of the actual channels. Or a selection of channels or something. c) I won't add any features I don't need myself on request but I can answer questions in case you want to add such features. d) I guess you made this PR in mistake but in case you actually want to send a PR, please refrain from doing automated code formatting in your fork - it makes seeing the actual changes very hard.