当前位置: 首页>>代码示例>>Python>>正文


Python SoCo.next方法代码示例

本文整理汇总了Python中soco.SoCo.next方法的典型用法代码示例。如果您正苦于以下问题:Python SoCo.next方法的具体用法?Python SoCo.next怎么用?Python SoCo.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在soco.SoCo的用法示例。


在下文中一共展示了SoCo.next方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sexy_time

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
def sexy_time():
    # connect to the Sonos
    sonos = SoCo(SONOS_IP)

    # connect to Philips Hue Bridge
    hue = Bridge(ip=HUE_IP,
                 username=HUE_USERNAME)

    # get queue
    queue = sonos.get_queue()

    # if we:
    # * already have a queue
    # * music is playing
    # * we are already playing a queue that begins with "Let's Get It On"
    # ...then skip to the next track

    if len(queue) > 0 and \
       sonos.get_current_transport_info()['current_transport_state'] == "PLAYING" and \
       queue[0].title == SEXY_TIME_FIRST_TRACK:
        sonos.next()

    # else, intitiate a fresh Sexy Time

    else:
        # clear Sonos queue
        sonos.clear_queue()

        # turn off shuffle and repeat
        sonos.play_mode = 'NORMAL'

        # set volume
        sonos.volume = 45

        # play Sexy Time playlist

        playlist = get_sonos_playlist(sonos, SEXY_TIME_PLAYLIST_NAME)

        if playlist:
            sonos.add_to_queue(playlist)
            sonos.play()

        # dim the lights (bri out of 254) over the pre-defined amount of time

        command = {
            'transitiontime': (SEXY_TIME_DIMMER_SECONDS * 10),
            'on': True,
            'bri': SEXY_TIME_DIMMER_BRIGHTNESS
        }

        hue.set_light(1, command)

    return jsonify(status="success")
开发者ID:andrewladd,项目名称:auto-awesome,代码行数:55,代码来源:server.py

示例2: sonos_next

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
    def sonos_next(self):
        """Afspeellijst <Next> button, gaat naar volgende nummer in afspeellijst.
        """
        
        # pagina laden voor als antwoord terug aan de server
        h = queuebeheer_temp.sonos_next()
                
        ##
        sonos = SoCo(COORDINATOR)
        sonos.next()

        return h
开发者ID:dirk2011,项目名称:mymc_git,代码行数:14,代码来源:queuebeheer.py

示例3: sonos

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
def sonos(command, volume=-1):
    s = SoCo(app.config['SONOS'])
    try:
        if command == 'play':
            s.play()
        elif command == 'pause':
            s.pause()
        elif command =='volume':
            logging.info('Setting volume of Sonos to %d' % volume)
            s.volume(volume)
        elif command == 'next':
            s.next()
        elif command == 'previous':
            s.previous()
        return "OK"
    except:
        return "FAIL"
开发者ID:qwango,项目名称:lightwaverfserver,代码行数:19,代码来源:lightwaverfserver.py

示例4: arriving_home

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
def arriving_home():
    # connect to Philips Hue Bridge
    hue = Bridge(ip=HUE_IP,
                 username=HUE_USERNAME)

    # set the lights to approximately 80% over 3 seconds

    command = {
        'transitiontime': 30,
        'on': True,
        'bri': 203
    }

    hue.set_light(1, command)

    # connect to the Sonos
    sonos = SoCo(SONOS_IP)

    # clear the queue
    sonos.clear_queue()

    # set volume
    sonos.volume = 25

    # play Arriving Home playlist

    playlist = get_sonos_playlist(sonos, ARRIVING_HOME_PLAYLIST_NAME)
    print playlist

    if playlist:
        sonos.add_to_queue(playlist)

        # turn on shuffle, turn off repeat
        sonos.play_mode = 'SHUFFLE_NOREPEAT'

        # play
        sonos.play()

        # we're in shuffle mode, but the first track is always the same
        sonos.next()

    return jsonify(status="success")
开发者ID:andrewladd,项目名称:auto-awesome,代码行数:44,代码来源:server.py

示例5: arriving_home

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
def arriving_home():
    # connect to Philips Hue Bridge
    hue = Bridge(ip=HUE_IP,
                 username=HUE_USERNAME)

    # set the lights to appropriate brightness over appropriate time

    command = {
        'transitiontime': (ARRIVING_HOME_DIMMER_SECONDS * 10),
        'on': True,
        'bri': ARRIVING_HOME_DIMMER_BRIGHTNESS
    }

    hue.set_light(ARRIVING_HOME_LIGHTS, command)

    # connect to the Sonos
    sonos = SoCo(SONOS_IP)

    # clear the queue
    sonos.clear_queue()

    # set volume
    sonos.volume = ARRIVING_HOME_VOLUME

    # play Arriving Home playlist
    playlist = get_sonos_playlist(sonos, ARRIVING_HOME_PLAYLIST_NAME)

    if playlist:
        sonos.add_to_queue(playlist)

        # turn on shuffle, turn off repeat
        sonos.play_mode = 'SHUFFLE_NOREPEAT'

        # play
        sonos.play()

        # we're in shuffle mode, but the first track is always the same
        sonos.next()

    return jsonify(status="success")
开发者ID:mrkipling,项目名称:auto-awesome,代码行数:42,代码来源:server.py

示例6: party

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
def party():
    # connect to the Sonos
    sonos = SoCo(SONOS_IP)

    # get queue
    queue = sonos.get_queue()

    # if we:
    # * already have a queue
    # * music is playing
    # ...then skip to the next track

    if len(queue) > 0 and sonos.get_current_transport_info()['current_transport_state'] == "PLAYING":
        sonos.next()

    # else, intitiate a fresh Party Time

    else:
        # clear Sonos queue
        sonos.clear_queue()

        # turn on shuffle, turn off repeat
        sonos.play_mode = 'SHUFFLE_NOREPEAT'

        # set volume
        sonos.volume = 45

        # play Party playlist

        playlist = get_sonos_playlist(sonos, PARTY_TIME_PLAYLIST_NAME)

        if playlist:
            sonos.add_to_queue(playlist)
            sonos.play()

    return jsonify(status="success")
开发者ID:andrewladd,项目名称:auto-awesome,代码行数:38,代码来源:server.py

示例7: SoCo

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
if __name__ == '__main__':
    if (len(sys.argv) != 3):
        print "Usage: sonoshell.py [speaker's IP] [cmd]"
        print ""
        print "Valid commands: play, pause, stop, next, previous, current, and partymode"
        sys.exit()

    speaker_ip = sys.argv[1]
    cmd = sys.argv[2].lower()

    sonos = SoCo(speaker_ip)

    if (cmd == 'partymode'):
        print sonos.partymode()
    elif (cmd == 'play'):
        print sonos.play()
    elif (cmd == 'pause'):
        print sonos.pause()
    elif (cmd == 'stop'):
        print sonos.stop()
    elif (cmd == 'next'):
        print sonos.next()
    elif (cmd == 'previous'):
        print sonos.previous()
    elif (cmd == 'current'):
        track = sonos.get_current_track_info()

        print 'Current track: ' + track['artist'] + ' - ' + track['title'] + '. From album ' + track['album'] + '. This is track number ' + track['playlist_position'] + ' in the playlist. It is ' + track['duration'] + ' minutes long.'
    else:
        print "Valid commands: play, pause, stop, next, previous, current, and partymode"
开发者ID:DonGar,项目名称:SoCo,代码行数:32,代码来源:sonoshell.py

示例8: skip

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
	def skip(self):
		my_zone = SoCo('192.168.1.19')
		print('Sonos - Next track')
		my_zone.next()
开发者ID:bgriffiths,项目名称:ledsign,代码行数:6,代码来源:sonos.py

示例9: Song

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import next [as 别名]
    elif action == 'v-5':
        # Decrease volume
        current_vol = sonos.volume
        new_vol = current_vol - 5
        if new_vol < 0:
            new_vol = 0
        sonos.ramp_to_volume(new_vol)

    elif action == 'mute':
        # Mute Volume
        sonos.volume = 0

    elif action == 'next':
        # Next Song (might be unsupported by playback source e.g. streams)
        try:
            sonos.next()
        except SoCoUPnPException:
            print '[{"icon": "font-awesome:times-circle", "title": "Not supported for current playback source."}]'

    elif action == 'prev':
        # Previous Song (might be unsupported by playback source e.g. streams)
        try:
            sonos.previous()
        except SoCoUPnPException:
            print '[{"icon": "font-awesome:times-circle", "title": "Not supported for current playback source."}]'

    elif action == 'set_zone':
        # Used during setup to save preferred zone
        settings_file_path = os.path.join(os.getenv('LB_SUPPORT_PATH'), 'settings.json')
        settings = {'zone_ip_address': sonos_zone}
        json.dump(settings, file(settings_file_path, 'w'))
开发者ID:mlinzner,项目名称:LaunchBarActions,代码行数:33,代码来源:action.py


注:本文中的soco.SoCo.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。