Class: LastFM::AudioOutput::ITunes

Inherits:
Object
  • Object
show all
Defined in:
lib/lastfm.rb

Instance Method Summary collapse

Constructor Details

#initialize(stream_url) ⇒ ITunes

Returns a new instance of ITunes.



358
359
360
361
# File 'lib/lastfm.rb', line 358

def initialize(stream_url)
  @itunes = OSX::SBApplication.applicationWithBundleIdentifier("com.apple.iTunes")
  @stream_url = stream_url
end

Instance Method Details

#playObject



367
368
369
# File 'lib/lastfm.rb', line 367

def play
  skip
end

#quitObject



363
364
365
# File 'lib/lastfm.rb', line 363

def quit
  @itunes.stop
end

#skipObject



373
374
375
376
377
378
# File 'lib/lastfm.rb', line 373

def skip
  # simply restart the stream
  fork do
    %x{open -g -a iTunes.app #{@stream_url} &}
  end
end

#startObject



379
380
381
382
383
# File 'lib/lastfm.rb', line 379

def start
  fork do
    %x{open -g -a iTunes.app #{@stream_url} &}
  end
end

#stopObject



370
371
372
# File 'lib/lastfm.rb', line 370

def stop
  @itunes.stop
end

#volumeObject



384
385
386
# File 'lib/lastfm.rb', line 384

def volume
  @itunes.soundVolume 
end

#volume=(value) ⇒ Object



387
388
389
# File 'lib/lastfm.rb', line 387

def volume=(value)
  @itunes.soundVolume = value
end