Edit

thodg/mpd_client/examples/rangeid.rb

Branch :

  • Show log

    Commit

  • Author : Anton Maminov
    Date : 2015-03-18 14:49:12
    Hash : 1c5e69b7
    Message : added rangeid example

  • examples/rangeid.rb
  • require 'bundler'
    Bundler.setup :default
    
    require 'pp'
    require 'logger'
    require 'mpd_client'
    
    MPDClient.log = Logger.new($stderr)
    
    client = MPDClient.new
    client.connect('localhost', 6600)
    
    # Get id of the first song in the playllist
    song = client.playlistinfo(1).first
    pp "#{song['artist']} - #{song['title']}"
    song_id = song['id']
    
    # Specifies the portion of the song that shall be played
    client.rangeid(song_id, [60,70])
    
    # Play the playlist at song 1
    client.play(1)
    
    pp client.status