X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/34d0bf15a6f4009de376ceed1d7d5cca24a8dfe7..178ffe1377a571b7ce0a73186c03b5e296ac8922:/doc/Lyricli/Sources/Itunes.html diff --git a/doc/Lyricli/Sources/Itunes.html b/doc/Lyricli/Sources/Itunes.html new file mode 100644 index 0000000..e1a0f05 --- /dev/null +++ b/doc/Lyricli/Sources/Itunes.html @@ -0,0 +1,553 @@ + + + + + + Class: Lyricli::Sources::Itunes + + — Documentation by YARD 0.8.2.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::Sources::Itunes + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/lyricli/sources/itunes.rb
+ +
+
+ +

Overview

+
+

+The source for iTunes +

+ + +
+
+
+ + +
+ + + +

Class Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

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. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +

    +A hash containing the current `:song` and `:artist`. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/lyricli/sources/itunes.rb', line 27
+
+def current_track
+  path_root = File.expand_path(File.dirname(__FILE__))
+  path = File.join(path_root, @script)
+  current = `osascript #{path}`
+  current = current.split("<-SEP->")
+  {artist: current[0], song: current[1]}
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file