本文整理汇总了Python中soco.SoCo.get_pandora_stations方法的典型用法代码示例。如果您正苦于以下问题:Python SoCo.get_pandora_stations方法的具体用法?Python SoCo.get_pandora_stations怎么用?Python SoCo.get_pandora_stations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soco.SoCo
的用法示例。
在下文中一共展示了SoCo.get_pandora_stations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SoCo
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import get_pandora_stations [as 别名]
#!/usr/bin/env python
from soco import SoCo
from soco import SonosDiscovery
if __name__ == '__main__':
sonos = SoCo('192.168.1.103') # Pass in the IP of your Sonos speaker
pandora_email = sonos.get_music_service_email('Pandora')
pandora_stations = sonos.get_pandora_stations(pandora_email)
station_selector = {}
counter = 1
for station in pandora_stations:
print counter,"-", station
station_selector[counter] = station
counter +=1
station_selection = int(raw_input("Please select station by number:"))
selected_station_name = station_selector[station_selection]
selected_station_id = pandora_stations[selected_station_name]
sonos.play_music_station('Pandora', selected_station_name, selected_station_id, pandora_email)
sonos.play()