Class: ITuner::ITunes

Inherits:
Model
  • Object
show all
Defined in:
lib/ituner/itunes.rb

Instance Attribute Summary

Attributes inherited from Model

#app_object

Instance Method Summary collapse

Methods inherited from Model

#==, action, belongs_to, has_many, #initialize, #inspect, property

Constructor Details

This class inherits a constructor from ITuner::Model

Instance Method Details

#current_trackObject



40
41
42
43
44
# File 'lib/ituner/itunes.rb', line 40

def current_track
  Track.new(app.current_track.get)
rescue Appscript::CommandError
  nil
end

#libraryObject



48
49
50
# File 'lib/ituner/itunes.rb', line 48

def library
  sources["Library"]
end

#musicObject



56
57
58
# File 'lib/ituner/itunes.rb', line 56

def music
  playlists["Music"]
end

#paused?Boolean

Returns:

  • (Boolean)


37
# File 'lib/ituner/itunes.rb', line 37

def paused?;  state == :paused;  end

#playing?Boolean

Returns:

  • (Boolean)


36
# File 'lib/ituner/itunes.rb', line 36

def playing?; state == :playing; end

#playlistsObject



52
53
54
# File 'lib/ituner/itunes.rb', line 52

def playlists
  library.playlists
end

#running?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ituner/itunes.rb', line 24

def running?
  app.is_running?
end

#stateObject



32
33
34
# File 'lib/ituner/itunes.rb', line 32

def state
  app.player_state.get
end

#stopped?Boolean

Returns:

  • (Boolean)


38
# File 'lib/ituner/itunes.rb', line 38

def stopped?; state == :stopped; end