Class: Lyricli::Sources::Itunes + + + +
+ +-
+
+
- Inherits: +
-
+ Object
+
+
-
+
- Object + +
- Lyricli::Sources::Itunes + +
+
+
+
+
+
+
+
+
+
+ - Defined in: +
- lib/lyricli/sources/itunes.rb + +
Overview
+The source for iTunes +
+ + +Class Attribute Summary (collapse)
+-
+
+
-
+
+
+ + (Object) name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+Returns the value of attribute name. +
+
+
+
+
+ Class Method Summary + (collapse) +
+ +-
+
+
-
+
+
+ + (Object) enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+The enable method should run all of the tasks needed to validate the +source. +
+
+
+
+ -
+
+
+ + (Object) reset
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+The reset method resets any configurations it may have. +
+
+
+
+
+ Instance Method Summary + (collapse) +
+ +-
+
+
-
+
+
+ - (Hash) current_track
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+The current_track method should return the name of the current artist and +song. +
+
+
+
+ -
+
+
+ - (Itunes) initialize
+
+
+
+
+
+
+ constructor
+
+
+
+
+
+
+
+
+ + +
+Instantiates everything it needs to run. +
+
+
+
+
Constructor Details
+ ++ + - (Itunes) initialize + + + + + +
+Instantiates everything it needs to run. +
+ + +
+ + + +19 +20 +21 +22+ |
+
+ # File 'lib/lyricli/sources/itunes.rb', line 19 + +def initialize + @config = Configuration.instance + @script = "current_song.scpt" +end+ |
+
Class Attribute Details
+ + + ++ + + (Object) name + + + + + +
+Returns the value of attribute name +
+ + +
+ + + +7 +8 +9+ |
+
+ # File 'lib/lyricli/sources/itunes.rb', line 7 + +def name + @name +end+ |
+
Class Method Details
+ + ++ + + (Object) enable + + + + + +
+The enable method should run all of the tasks needed to validate the +source. In the case of Rdio it has to authenticate with OAuth. +
+ + +
+ + + +14 +15 +16+ |
+
+ # File 'lib/lyricli/sources/itunes.rb', line 14 + +def self.enable + # Nothing to do +end+ |
+
+ + + (Object) reset + + + + + +
+The reset method resets any configurations it may have +
+ + +
+ + + +36 +37 +38+ |
+
+ # File 'lib/lyricli/sources/itunes.rb', line 36 + +def self.reset + # Nothing to do +end+ |
+
Instance Method Details
+ + ++ + - (Hash) current_track + + + + + +
+The current_track method should return the name of the current artist and +song. +
+ + +
+ + + +27 +28 +29 +30 +31 +32 +33+ |
+
+ # File 'lib/lyricli/sources/itunes.rb', line 27 + +def current_track + path_root = File.(File.dirname(__FILE__)) + path = File.join(path_root, @script) + current = `osascript #{path}` + current = current.split("<-SEP->") + {artist: current[0], song: current[1]} +end+ |
+