Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use setPlayContent with a diferent source #150

Open
Triberg opened this issue Mar 4, 2024 · 1 comment
Open

Can't use setPlayContent with a diferent source #150

Triberg opened this issue Mar 4, 2024 · 1 comment

Comments

@Triberg
Copy link

Triberg commented Mar 4, 2024

I have a STR-DN1080 and I'm trying to select the FM Radio source. I can't seem to select it directly through SongPal, but I can set it via setPlayContent. My problem is, if the receiver is currently set to an extInput scheme, like TV, the setPlayContent doesn't work to change it to radio. If the receiver is already set to a radio station, setPlayContent can change the station as expected.

Inputs just lists the extInput sources, not the other sources

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony input
Inputs:
  * SOURCE (uri: extInput:source)
    - extOutput:zone?zone=2
    - extOutput:zone?zone=4
  * BD/DVD (uri: extInput:bd-dvd)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=4
  * GAME (uri: extInput:game)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=4
  * SAT/CATV (uri: extInput:sat-catv)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=2
    - extOutput:zone?zone=4
  * VIDEO 1 (uri: extInput:video?port=1)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=2
  * VIDEO 2 (uri: extInput:video?port=2)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=4
  * TV (uri: extInput:tv)
    - extOutput:zone?zone=1
  * SA-CD/CD (uri: extInput:sacd-cd)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=2
    - extOutput:zone?zone=4
  * Bluetooth Audio (uri: extInput:btAudio)
    - extOutput:zone?zone=1
    - extOutput:zone?zone=2

Calling Sources lists the radio source

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony source
BD/DVD (extInput:bd-dvd) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=4']
GAME (extInput:game) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=4']
SAT/CATV (extInput:sat-catv) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=2', 'extOutput:zone?zone=4']
VIDEO 1 (extInput:video?port=1) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=2', 'extOutput:zone?zone=4']
  No content to list.
VIDEO 2 (extInput:video?port=2) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=4']
  No content to list.
TV (extInput:tv) - outs: ['extOutput:zone?zone=1']
SA-CD/CD (extInput:sacd-cd) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=2', 'extOutput:zone?zone=4']
Bluetooth Audio (extInput:btAudio)
FM (radio:fm) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=2']
  ContentInfo(capability=10, count=30)
   87.50MHZ
        radio:fm?contentId=1
  myStationHere
        radio:fm?contentId=2
   87.50MHZ
        radio:fm?contentId=3
# truncating the other 30 radio IDs
USB (storage:usb1) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=2']
  Got an error for getContentCount: [15, 'unsupported operation']: UnsupportedOperation (15): unsupported operation
Home Network (dlna:music) - outs: ['extOutput:zone?zone=1', 'extOutput:zone?zone=2']
Unable to get sources for cast: Got an error for getSourceList: [3, 'illegal argument']: IllegalArgument (3): illegal argument
Unable to get sources for netService: Got an error for getSourceList: [3, 'illegal argument']: IllegalArgument (3): illegal argument

ExtInput is a different scheme than Radio

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent getSchemeList
Calling avContent.getSchemeList with params None
INFO:songpal.device:Calling avContent.getSchemeList(None)
[{'scheme': 'extInput'}, {'scheme': 'radio'}, {'scheme': 'storage'}, {'scheme': 'dlna'}, {'scheme': 'cast'}, {'scheme': 'netService'}]

But I can get the sources for the radio scheme

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent getSourceList "{'scheme':'radio'}"
Calling avContent.getSourceList with params {'scheme': 'radio'}
INFO:songpal.device:Calling avContent.getSourceList({'scheme': 'radio'})
[{'iconUrl': '', 'isBrowsable': True, 'isPlayable': True, 'meta': 'meta:radio:fm', 'outputs': ['extOutput:zone?zone=1', 'extOutput:zone?zone=2'], 'playAction': 'startPlay', 'source': 'radio:fm', 'title': 'FM'}]

Starting state is using the extInput:tv source

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent getPlayingContentInfo "{}"
Calling avContent.getPlayingContentInfo with params {}
INFO:songpal.device:Calling avContent.getPlayingContentInfo({})
[{'contentKind': '', 'output': 'extOutput:zone?zone=1', 'parentUri': '', 'source': 'extInput:tv', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:tv'}, {'contentKind': '', 'output': 'extOutput:zone?zone=2', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}, {'contentKind': '', 'output': 'extOutput:zone?zone=4', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}]

Setting the PlayContent to radio returns true. THIS IS A BUG because it didn't actually set the radio successfully.

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent setPlayContent "{'uri':'radio:fm?contentId=2'}
Calling avContent.setPlayContent with params {'uri': 'radio:fm?contentId=2'}
INFO:songpal.device:Calling avContent.setPlayContent({'uri': 'radio:fm?contentId=2'})
True

Even though it should be playing the radio, nothing actually happened and the current playing source is still extInput:tv

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent getPlayingContentInfo "{}"
Calling avContent.getPlayingContentInfo with params {}
INFO:songpal.device:Calling avContent.getPlayingContentInfo({})
[{'contentKind': '', 'output': 'extOutput:zone?zone=1', 'parentUri': '', 'source': 'extInput:tv', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:tv'}, {'contentKind': '', 'output': 'extOutput:zone?zone=2', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}, {'contentKind': '', 'output': 'extOutput:zone?zone=4', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}]

I've gone into the Sony Music Center iOS app and manually changed the current input to radio station 1. So however the official app is setting the source, that works properly.

Afterward, when I query what's playing, it tells me that the source is radio:fm.

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent getPlayingContentInfo "{}"
Calling avContent.getPlayingContentInfo with params {}
INFO:songpal.device:Calling avContent.getPlayingContentInfo({})
[{'broadcastFreq': 87500000, 'broadcastFreqBand': 'fm', 'contentKind': 'radio', 'fileNo': '1', 'output': 'extOutput:zone?zone=1', 'parentUri': 'radio:fm', 'source': 'radio:fm', 'stateInfo': {'state': 'PLAYING', 'supplement': ''}, 'title': '', 'totalCount': 30, 'uri': 'radio:fm?contentId=1'}, {'contentKind': '', 'output': 'extOutput:zone?zone=2', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}, {'contentKind': '', 'output': 'extOutput:zone?zone=4', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}]

Now I try to set the radio to station 2.

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent setPlayContent "{'uri':'radio:fm?contentId=2'}
Calling avContent.setPlayContent with params {'uri': 'radio:fm?contentId=2'}
INFO:songpal.device:Calling avContent.setPlayContent({'uri': 'radio:fm?contentId=2'})
True

I can confirm that the radio is now playing contentId 2 instead of contentId 1, as expected.

songpal --endpoint http://xxx.xxx.xxx.xxx:10000/sony command avContent getPlayingContentInfo "{}"
Calling avContent.getPlayingContentInfo with params {}
INFO:songpal.device:Calling avContent.getPlayingContentInfo({})
[{'broadcastFreq': 89500000, 'broadcastFreqBand': 'fm', 'contentKind': 'radio', 'fileNo': '2', 'output': 'extOutput:zone?zone=1', 'parentUri': 'radio:fm', 'source': 'radio:fm', 'stateInfo': {'state': 'PLAYING', 'supplement': ''}, 'title': '', 'totalCount': 30, 'uri': 'radio:fm?contentId=2'}, {'contentKind': '', 'output': 'extOutput:zone?zone=2', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}, {'contentKind': '', 'output': 'extOutput:zone?zone=4', 'parentUri': '', 'source': 'extInput:source', 'stateInfo': {'state': 'STOPPED', 'supplement': ''}, 'uri': 'extInput:source'}]

In summary, my problem is that I can setPlayContent to a radio source only if the current source is radio. If the current source is extInput, the setPlayContent returns True but doesn't actually change anything.

@blindguynar
Copy link

I would love to know the answer to how to switch the source to radio via command as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants