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


Python SoCo.previous方法代码示例

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


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

示例1: sonos_previous

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

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

示例2: sonos

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [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

示例3: SoCo

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [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

示例4: Song

# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [as 别名]
        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'))
        webbrowser.open("x-launchbar:notification-center?string=Zone%20successfully%20set!&title=Sonos%20Controller")
开发者ID:mlinzner,项目名称:LaunchBarActions,代码行数:32,代码来源:action.py


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