--- /dev/null
+*.gem
+*.rbc
+.bundle
+.config
+coverage
+InstalledFiles
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
+
+# YARD artifacts
+.yardoc
+_yardoc
+doc/
\ No newline at end of file
lib/lyricli.rb 51e33086d1cbac6ccd601dd481a3b455376efb46
lib/lyricli/util.rb 26284bcf3521994d5f81c5f10a750dad8fda1593
-lib/lyricli/lyricli.rb 067ba6355bce4ce18cc5552580b91b4e266250a2
-lib/lyricli/sources/rdio.rb affae043fecd57d068a54a710718d19933d53b81
-lib/lyricli/lyrics_engine.rb be6feb81f3c3c040420d1fb33df4d1282a959d15
-lib/lyricli/configuration.rb eab80327c885fe827811de01de1e9e64c312b0c0
-lib/lyricli/sources/itunes.rb 8f0b1201051be95df66f8a94554e393681795eb7
-lib/lyricli/source_manager.rb fd571d1c1a169f86efed5c886b40f912fb5ad01f
-lib/lyricli/sources/arguments.rb de3b31f05d118cf00fccb41e47fd35979da9eb14
+lib/lyricli/lyricli.rb 5a966a6402b5646b2c755cf79c3f7006b4a6d818
+lib/lyricli/sources.rb 69d670f2d008827b861dcd543caad3986ccc323e
+lib/lyricli/exceptions.rb 943e408e869981dded31cd236da1da937e6b0574
+lib/lyricli/sources/rdio.rb 8936e4de676719c26fe6b8fcf2396b85d5723996
+lib/lyricli/lyrics_engine.rb 9ebc53647e5be739ce8a0fe1e7d10fbce02d7083
+lib/lyricli/configuration.rb f08b1caf4dffacccf888c5b22e4a8e3107f004d6
+lib/lyricli/sources/itunes.rb aadca88a9ad0d0b4c918d86874f403d10ec3add7
+lib/lyricli/source_manager.rb d16a3e3592f48dbda8adbef1b1cfe49a9dc42617
+lib/lyricli/sources/arguments.rb fa19b956453041cf5df0402142cbe073f2c9e686
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">lib/lyricli.rb<span class="defines">,<br />
- lib/lyricli/util.rb,<br /> lib/lyricli/lyricli.rb,<br /> lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/lyrics_engine.rb,<br /> lib/lyricli/configuration.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/source_manager.rb,<br /> lib/lyricli/sources/arguments.rb</span>
+ lib/lyricli/util.rb,<br /> lib/lyricli/lyricli.rb,<br /> lib/lyricli/sources.rb,<br /> lib/lyricli/exceptions.rb,<br /> lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/lyrics_engine.rb,<br /> lib/lyricli/configuration.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/source_manager.rb,<br /> lib/lyricli/sources/arguments.rb</span>
</dd>
</dl>
<p class="children">
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span>, <span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span>
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Lyricli/Exceptions.html" title="Lyricli::Exceptions (module)">Exceptions</a></span>, <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span>, <span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+This class handles the configuration of Lyricli
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+</div>
<h2>Constant Summary</h2>
<dl class="constants">
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Ensure this is only called once.
+</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(key) </a>
+ <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (String, ...) <strong>[]</strong>(key) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Access configuration properties, loads config if needed beforehand.
+</p>
+</div></span>
</li>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Assigns a new value to a configuration key, loads config if needed and
+saves it after updating.
+</p>
+</div></span>
</li>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Deletes a key from the configuration, loads config if needed and saves it
+after deleting.
+</p>
+</div></span>
</li>
<span class="summary_desc"><div class='inline'><p>
-A new instance of Configuration.
+Defines the paths to the default and user configuration files.
</p>
</div></span>
<span class="summary_desc"><div class='inline'><p>
-TODO: Apart from this, load a default yml that will be used for this.
+Loads the configuration from the user file, attempts to create it from
+defaults if it’s not present.
</p>
</div></span>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Serializes the `@config` Hash to JSON and saves it to a file.
+</p>
+</div></span>
</li>
</h3><div class="docstring">
<div class="discussion">
<p>
-A new instance of Configuration
+Defines the paths to the default and user configuration files
</p>
<pre class="lines">
-4
-5
-6
7
-8</pre>
+8
+9
+10
+11</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 4</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 7</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@config_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>~/.lyricli.conf</span><span class='tstring_end'>"</span></span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Ensure this is only called once. Only use the instance class variable to
+access this method, as its constructor is private.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-12
-13
-14</pre>
+17
+18
+19</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 12</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 17</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
<span class='cvar'>@@instance</span>
<div class="method_details first">
<h3 class="signature first" id="[]-instance_method">
- - (<tt>Object</tt>) <strong>[]</strong>(key)
+ - (<tt>String</tt>, ...) <strong>[]</strong>(key)
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Access configuration properties, loads config if needed beforehand.
+</p>
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
-</h3><table class="source_code">
+ <li>
+
+ <span class='name'>key</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the configuration key to access
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>, <tt>Hash</tt>, <tt>Array</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the value of the configuration key.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-16
-17
-18
-19</pre>
+25
+26
+27
+28</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 16</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 25</span>
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
<span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Assigns a new value to a configuration key, loads config if needed and
+saves it after updating.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>key</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the configuration key to set
+</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>value</span>
+
+
+ <span class='type'>(<tt>Object</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the value for the configuration key, can be any object as long as it can be
+converted to JSON
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-21
-22
-23
-24
-25</pre>
+36
+37
+38
+39
+40</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 21</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 36</span>
<span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Deletes a key from the configuration, loads config if needed and saves it
+after deleting.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>key</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the key to delete
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-27
-28
-29
-30
-31</pre>
+46
+47
+48
+49
+50</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 27</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
<span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
</h3><div class="docstring">
<div class="discussion">
<p>
-TODO: Apart from this, load a default yml that will be used for this. And
-just extend everything from the user’s config.
+Loads the configuration from the user file, attempts to create it from
+defaults if it’s not present. sets the `@config` instance variable.
</p>
<pre class="lines">
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46</pre>
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 37</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 56</span>
<span class='kw'>def</span> <span class='id identifier rubyid_load_config'>load_config</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='ivar'>@config_path</span><span class='rparen'>)</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Serializes the `@config` Hash to JSON and saves it to a file.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-48
-49
-50
-51
-52
-53</pre>
+68
+69
+70
+71
+72
+73</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 48</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 68</span>
<span class='kw'>def</span> <span class='id identifier rubyid_save_config'>save_config</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='ivar'>@config_path</span><span class='rparen'>)</span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Module: Lyricli::Exceptions
+
+ — Documentation by YARD 0.8.2.1
+
+</title>
+
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '../';
+ framesUrl = "../frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (E)</a> »
+ <span class='title'><span class='object_link'><a href="../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span>
+ »
+ <span class="title">Exceptions</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="../method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="../file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Module: Lyricli::Exceptions
+
+
+
+</h1>
+
+<dl class="box">
+
+
+
+
+
+
+
+
+ <dt class="r1 last">Defined in:</dt>
+ <dd class="r1 last">lib/lyricli/exceptions.rb</dd>
+
+</dl>
+<div class="clear"></div>
+
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+The namespace for all exceptions in Lyricli. Has no functionality by itself
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+
+
+
+
+
+
+
+
+</div>
+
+ <div id="footer">
+ Generated on Sat Oct 6 02:34:27 2012 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.2.1 (ruby-1.9.2).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+This class has the basic logic for extracting the lyrics and controlling
+the application
+</p>
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Exits with error when there is an empty field from the current track.
+</p>
+</div></span>
</li>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Raises an InvalidLyricsException which means we did not get any valid
+artist/song from any of the sources.
+</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (Object) <strong>get_lyrics</strong> </a>
+ <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Extracts the current track, validates it and requests the lyrics from our
+LyricsEngine.
+</p>
+</div></span>
</li>
<span class="summary_desc"><div class='inline'><p>
-A new instance of Lyricli.
+Constructor, initializes `@source_manager`.
</p>
</div></span>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Set the `@current_track` instance variable by asking the SourceManager for
+its current track.
+</p>
+</div></span>
</li>
</h3><div class="docstring">
<div class="discussion">
<p>
-A new instance of Lyricli
+Constructor, initializes `@source_manager`
</p>
<pre class="lines">
-4
-5
-6</pre>
+8
+9
+10</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 4</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@source_manager</span> <span class='op'>=</span> <span class='const'>SourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Exits with error when there is an empty field from the current track.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-29
-30
-31
-32</pre>
+44
+45
+46
+47</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 29</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 44</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_params'>check_params</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
</h3><div class="docstring">
<div class="discussion">
-
+ <p>
+Raises an InvalidLyricsException which means we did not get any valid
+artist/song from any of the sources
+</p>
+
</div>
</div>
<li>
- <span class='type'>(<tt>InvalidLyrics</tt>)</span>
+ <span class='type'>(<tt>Lyricli::InvalidLyricsException</tt>)</span>
+
+ —
+ <div class='inline'><p>
+because we found nothing
+</p>
+</div>
</li>
<pre class="lines">
-8
-9
-10</pre>
+16
+17
+18</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 16</span>
<span class='kw'>def</span> <span class='id identifier rubyid_exit_with_error'>exit_with_error</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidLyrics</span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidLyricsException</span>
<span class='kw'>end</span></pre>
</td>
</tr>
<div class="method_details ">
<h3 class="signature " id="get_lyrics-instance_method">
- - (<tt>Object</tt>) <strong>get_lyrics</strong>
+ - (<tt>String</tt>) <strong>get_lyrics</strong>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Extracts the current track, validates it and requests the lyrics from our
+LyricsEngine
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the found lyrics, or a string indicating none were found
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23</pre>
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 12</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 24</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
<span class='id identifier rubyid_set_current_track'>set_current_track</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Set the `@current_track` instance variable by asking the SourceManager for
+its current track
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-25
-26
-27</pre>
+39
+40
+41</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 25</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 39</span>
<span class='kw'>def</span> <span class='id identifier rubyid_set_current_track'>set_current_track</span>
<span class='ivar'>@current_track</span> <span class='op'>=</span> <span class='ivar'>@source_manager</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+This class gets the lyrics according to a given artist and song name.
+</p>
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+
<li class="public ">
<span class="summary_signature">
- <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (Object) <strong>get_lyrics</strong> </a>
+ <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Asks Lyrics Wiki for the lyrics, also cleans up the output a little.
+</p>
+</div></span>
</li>
<span class="summary_desc"><div class='inline'><p>
-A new instance of LyricsEngine.
+Starts a new instance of LyricsEngine.
</p>
</div></span>
</h3><div class="docstring">
<div class="discussion">
<p>
-A new instance of LyricsEngine
+Starts a new instance of LyricsEngine
</p>
</div>
</div>
<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>artist</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the artist
+</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>song</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the song to look for
+</p>
+</div>
+
+ </li>
+</ul>
+
</div><table class="source_code">
<tr>
<pre class="lines">
-6
-7
-8</pre>
+12
+13
+14</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 6</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 12</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_artist'>artist</span><span class='comma'>,</span> <span class='id identifier rubyid_song'>song</span><span class='rparen'>)</span>
<span class='ivar'>@provider</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://lyrics.wikia.com/api.php?artist=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sanitize_param'>sanitize_param</span> <span class='id identifier rubyid_artist'>artist</span><span class='rbrace'>}</span><span class='tstring_content'>&song=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sanitize_param'>sanitize_param</span> <span class='id identifier rubyid_song'>song</span><span class='rbrace'>}</span><span class='tstring_content'>&fmt=realjson</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<div class="method_details first">
<h3 class="signature first" id="get_lyrics-instance_method">
- - (<tt>Object</tt>) <strong>get_lyrics</strong>
+ - (<tt>String</tt>) <strong>get_lyrics</strong>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Asks Lyrics Wiki for the lyrics, also cleans up the output a little.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the lyrics
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-10
-11
-12
-13
-14
-15
-16
-17
-18
19
20
21
27
28
29
-30</pre>
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 10</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
<span class='kw'>begin</span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+Manages the different sources. SourceManager is in charge of enabling and
+disabling them, as well as getting the current track.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+</div>
<li class="public ">
<span class="summary_signature">
- <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Object) <strong>available_sources</strong>(format = false) </a>
+ <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Array) <strong>available_sources</strong>(format = false) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Returns an array with the available sources.
+</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#current_track-instance_method" title="#current_track (instance method)">- (Object) <strong>current_track</strong> </a>
+ <a href="#current_track-instance_method" title="#current_track (instance method)">- (Hash) <strong>current_track</strong> </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Iterates over every source to attempt to retrieve the current song.
+</p>
+</div></span>
</li>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Disables a source.
+</p>
+</div></span>
</li>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Enables a source.
+</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Object) <strong>format_sources</strong>(sources) </a>
+ <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Array) <strong>format_sources</strong>(sources) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Adds a star to all members of the array that correspond to an active
+source.
+</p>
+</div></span>
</li>
<span class="summary_desc"><div class='inline'><p>
-A new instance of SourceManager.
+Creates a new instance of SourceManager.
</p>
</div></span>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Resets a source.
+</p>
+</div></span>
</li>
</h3><div class="docstring">
<div class="discussion">
<p>
-A new instance of SourceManager
+Creates a new instance of SourceManager
</p>
<pre class="lines">
-6
-7
-8
-9
10
11
12
14
15
16
-17</pre>
+17
+18
+19
+20
+21</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 6</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 10</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@enabled_sources</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<div class="method_details first">
<h3 class="signature first" id="available_sources-instance_method">
- - (<tt>Object</tt>) <strong>available_sources</strong>(format = false)
+ - (<tt>Array</tt>) <strong>available_sources</strong>(format = false)
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Returns an array with the available sources. Optionally formats the result
+so active sources are identified by an appended *
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>format</span>
+
+
+ <span class='type'>(<tt>Boolean</tt>)</span>
+
+
+ <em class="default">(defaults to: <tt>false</tt>)</em>
+
+
+ —
+ <div class='inline'><p>
+whether or not to render the stars for active sources.
+</p>
+</div>
+
+ </li>
+
+</ul>
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Array</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the names of the currently available sources.
+</p>
+</div>
+
+ </li>
-</h3><table class="source_code">
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97</pre>
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 81</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 107</span>
<span class='kw'>def</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path_root'>path_root</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_sources'>sources</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='id identifier rubyid_path_root'>path_root</span><span class='op'>+</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/sources/*.rb</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.rb</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
-
- <span class='comment'># Add a star to denote enabled sources
-</span> <span class='id identifier rubyid_name'>name</span>
+ <span class='id identifier rubyid_name'>name</span>
<span class='rbrace'>}</span>
<span class='comment'># Remove arguments (Hack?) We don't want anybody to touch tihs one.
</span> <span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>arguments</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span>
- <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
+ <span class='comment'># Add a star to denote enabled sources
+</span> <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_sources'>sources</span>
<span class='kw'>end</span>
<div class="method_details ">
<h3 class="signature " id="current_track-instance_method">
- - (<tt>Object</tt>) <strong>current_track</strong>
+ - (<tt>Hash</tt>) <strong>current_track</strong>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Iterates over every source to attempt to retrieve the current song.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Hash</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the current track, has an `:artist` and `:song` key.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79</pre>
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 60</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 80</span>
<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
<span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='kw'>nil</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Disables a source. This only removes the source from the `enabled_sources`
+configuration key.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>source_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the name of the source to disable
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45</pre>
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 34</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 47</span>
<span class='kw'>def</span> <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Enables a source. This runs the source’s enable method and adds it to
+the `enabled_sources` configuration key. It will only enable sources that
+are “available” (see #available_sources)
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>source_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the name of the source to enable
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-19
-20
-21
-22
-23
-24
-25
-26
-27
28
29
30
31
-32</pre>
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 19</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 28</span>
<span class='kw'>def</span> <span class='id identifier rubyid_enable'>enable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
<div class="method_details ">
<h3 class="signature " id="format_sources-instance_method">
- - (<tt>Object</tt>) <strong>format_sources</strong>(sources)
+ - (<tt>Array</tt>) <strong>format_sources</strong>(sources)
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Adds a star to all members of the array that correspond to an active source
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>sources</span>
+
+
+ <span class='type'>(<tt>Array</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the array of sources to format
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Array</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the formatted array
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-99
-100
-101
-102
-103
-104</pre>
+129
+130
+131
+132
+133
+134</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 99</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 129</span>
<span class='kw'>def</span> <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
<span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Resets a source. This runs the source’s reset method. It will also
+disable them.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>source_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the name of the source to reset.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58</pre>
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 47</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 64</span>
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
<dt class="r1 last">Defined in:</dt>
- <dd class="r1 last">lib/lyricli/sources/rdio.rb<span class="defines">,<br />
- lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/sources/arguments.rb</span>
+ <dd class="r1 last">lib/lyricli/sources.rb<span class="defines">,<br />
+ lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/sources/arguments.rb</span>
</dd>
</dl>
<div class="clear"></div>
-<h2>Defined Under Namespace</h2>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+The namespace for all sources in Lyricli. Has no functionality by itself
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><h2>Defined Under Namespace</h2>
<p class="children">
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+The arguments source. This one is special since it expects two arguments.
+It is treated specially by the SourceManager.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+</div>
<pre class="lines">
-18
-19
-20</pre>
+20
+21
+22</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 18</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 20</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='comment'># Nothing to do.
<pre class="lines">
-6
-7
-8</pre>
+8
+9
+10</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 6</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 8</span>
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
<span class='ivar'>@name</span>
<pre class="lines">
-13
-14
-15</pre>
+15
+16
+17</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 13</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 15</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
<span class='comment'># Nothing to do.
<pre class="lines">
-32
-33
-34</pre>
+34
+35
+36</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 32</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 34</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
<span class='comment'># Reset Code
<pre class="lines">
-25
-26
27
28
-29</pre>
+29
+30
+31</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 25</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
<span class='id identifier rubyid_artist'>artist</span> <span class='op'>=</span> <span class='const'>ARGV</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Class: Lyricli::Sources::Itunes
+
+ — Documentation by YARD 0.8.2.1
+
+</title>
+
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '../../';
+ framesUrl = "../../frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="../../_index.html">Index (I)</a> »
+ <span class='title'><span class='object_link'><a href="../../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span> » <span class='title'><span class='object_link'><a href="../Sources.html" title="Lyricli::Sources (module)">Sources</a></span></span>
+ »
+ <span class="title">Itunes</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../../class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="../../method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="../../file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Class: Lyricli::Sources::Itunes
+
+
+
+</h1>
+
+<dl class="box">
+
+ <dt class="r1">Inherits:</dt>
+ <dd class="r1">
+ <span class="inheritName">Object</span>
+
+ <ul class="fullTree">
+ <li>Object</li>
+
+ <li class="next">Lyricli::Sources::Itunes</li>
+
+ </ul>
+ <a href="#" class="inheritanceTree">show all</a>
+
+ </dd>
+
+
+
+
+
+
+
+
+
+ <dt class="r2 last">Defined in:</dt>
+ <dd class="r2 last">lib/lyricli/sources/itunes.rb</dd>
+
+</dl>
+<div class="clear"></div>
+
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+The source for iTunes
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+
+
+
+ <h2>Class Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#name-class_method" title="name (class method)">+ (Object) <strong>name</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Returns the value of attribute name.
+</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+
+
+
+ <h2>
+ Class Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#enable-class_method" title="enable (class method)">+ (Object) <strong>enable</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+The enable method should run all of the tasks needed to validate the
+source.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#reset-class_method" title="reset (class method)">+ (Object) <strong>reset</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+The reset method resets any configurations it may have.
+</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+ <h2>
+ Instance Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#current_track-instance_method" title="#current_track (instance method)">- (Hash) <strong>current_track</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+The current_track method should return the name of the current artist and
+song.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Itunes) <strong>initialize</strong> </a>
+
+
+
+ </span>
+
+
+ <span class="note title constructor">constructor</span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Instantiates everything it needs to run.
+</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+<div id="constructor_details" class="method_details_list">
+ <h2>Constructor Details</h2>
+
+ <div class="method_details first">
+ <h3 class="signature first" id="initialize-instance_method">
+
+ - (<tt><span class='object_link'><a href="" title="Lyricli::Sources::Itunes (class)">Itunes</a></span></tt>) <strong>initialize</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Instantiates everything it needs to run.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+19
+20
+21
+22</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 19</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
+ <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
+ <span class='ivar'>@script</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>current_song.scpt</span><span class='tstring_end'>"</span></span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+</div>
+
+ <div id="class_attr_details" class="attr_details">
+ <h2>Class Attribute Details</h2>
+
+
+ <span id="name=-class_method"></span>
+ <div class="method_details first">
+ <h3 class="signature first" id="name-class_method">
+
+ + (<tt>Object</tt>) <strong>name</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Returns the value of attribute name
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+7
+8
+9</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 7</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
+ <span class='ivar'>@name</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+
+ <div id="class_method_details" class="method_details_list">
+ <h2>Class Method Details</h2>
+
+
+ <div class="method_details first">
+ <h3 class="signature first" id="enable-class_method">
+
+ + (<tt>Object</tt>) <strong>enable</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+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.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+14
+15
+16</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 14</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
+ <span class='comment'># Nothing to do
+</span><span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="reset-class_method">
+
+ + (<tt>Object</tt>) <strong>reset</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+The reset method resets any configurations it may have
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+36
+37
+38</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 36</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
+ <span class='comment'># Nothing to do
+</span><span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
+
+
+ <div class="method_details first">
+ <h3 class="signature first" id="current_track-instance_method">
+
+ - (<tt>Hash</tt>) <strong>current_track</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+The current_track method should return the name of the current artist and
+song.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Hash</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+A hash containing the current `:song` and `:artist`.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+27
+28
+29
+30
+31
+32
+33</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 27</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
+ <span class='id identifier rubyid_path_root'>path_root</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_path_root'>path_root</span><span class='comma'>,</span> <span class='ivar'>@script</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_current'>current</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>osascript </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='rbrace'>}</span><span class='tstring_end'>`</span></span>
+ <span class='id identifier rubyid_current'>current</span> <span class='op'>=</span> <span class='id identifier rubyid_current'>current</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><-SEP-></span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='lbrace'>{</span><span class='label'>artist:</span> <span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>song:</span> <span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+</div>
+
+ <div id="footer">
+ Generated on Sat Oct 6 02:34:27 2012 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.2.1 (ruby-1.9.2).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+This is the Source for rdio
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+</div>
<pre class="lines">
-27
-28
29
30
-31</pre>
+31
+32
+33</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 27</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 29</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rdio</span><span class='tstring_end'>'</span></span>
<pre class="lines">
-6
-7
-8</pre>
+8
+9
+10</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 6</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 8</span>
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
<span class='ivar'>@name</span>
<pre class="lines">
-51
-52
-53
54
55
56
64
65
66
-67</pre>
+67
+68
+69
+70</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 51</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 54</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_auth_token'>create_auth_token</span>
<span class='id identifier rubyid_rdio'>rdio</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Rdio</span><span class='op'>::</span><span class='const'>SimpleRdio</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_key</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_secret</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<pre class="lines">
-13
-14
15
16
17
21
22
23
-24</pre>
+24
+25
+26</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 13</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 15</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
<span class='comment'># Validation Code
<pre class="lines">
-44
-45
-46
-47</pre>
+47
+48
+49
+50</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 44</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 47</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
<span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
<pre class="lines">
-36
-37
-38
39
40
-41</pre>
+41
+42
+43
+44</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 36</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 39</span>
<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@rdio</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>currentUser</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>extras</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>lastSongPlayed</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='rparen'>)</span>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:27 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</ul>
+ <ul id="alpha_E" class="alpha">
+ <li class="letter">E</li>
+ <ul>
+
+ <li>
+ <span class='object_link'><a href="Lyricli/Exceptions.html" title="Lyricli::Exceptions (module)">Exceptions</a></span>
+
+ <small>(Lyricli)</small>
+
+ </li>
+
+ </ul>
+ </ul>
+
+
<ul id="alpha_I" class="alpha">
<li class="letter">I</li>
<ul>
</ul>
+ </td><td valign='top' width="33%">
+
+
<ul id="alpha_U" class="alpha">
<li class="letter">U</li>
<ul>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:50 2012 by
+ Generated on Sat Oct 6 02:34:26 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
<ul id="full_list" class="class">
<li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
-<li><a class='toggle'></a> <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span> < Object<small class='search_info'>Lyricli</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span><small class='search_info'>Lyricli</small></li><ul><li><span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li></ul><li><span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span><small class='search_info'>Lyricli</small></li></ul>
+<li><a class='toggle'></a> <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Exceptions.html" title="Lyricli::Exceptions (module)">Exceptions</a></span><small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span> < Object<small class='search_info'>Lyricli</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span><small class='search_info'>Lyricli</small></li><ul><li><span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li></ul><li><span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span><small class='search_info'>Lyricli</small></li></ul>
</ul>
</div>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>
+ File: README
+
+ — Documentation by YARD 0.8.2.1
+
+</title>
+
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '';
+ framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="_index.html">Index</a> »
+ <span class="title">File: README</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><div id='filecontents'><h1>Lyricli</h1>
+
+<h2>The command line client for lyrics</h2>
+
+<p>This is a quick introduction for Lyricli. Right now it's in really early
+stages of development, so it's lacking in a lot of stuff (mainly tests
+and documentation) ... But it generally works and here's a tutorial to
+see how to get it working.</p>
+
+<h3>Installing</h3>
+
+<ol>
+<li>Clone this Repo</li>
+<li><code>gem build lyricli.gemspec</code></li>
+<li><code>gem install lyricli-0.0.1.gem</code></li>
+<li>Voila!</li>
+</ol>
+
+<h3>Usage</h3>
+
+<p>Lyricli can be invoked with the command <code>lrc</code> and there are three basic
+ways of using it:</p>
+
+<p><code>lrc</code></p>
+
+<p>When you run it without arguments, it will look in the available sources
+to try to find a playing song and extract the lyrics.</p>
+
+<p><code>lrc artist song</code></p>
+
+<p>When you run it with arguments, it will use them to search for the
+lyrics. This won't work if you manually disable the arguments source in
+your configuration file.</p>
+
+<h4>Commands</h4>
+
+<p>The third way to use it is by passing it one of the following special
+commands:</p>
+
+<ul>
+<li><code>lrc -l</code> or <code>lrc --list-sources</code> lists the available sources.</li>
+<li><code>lrc -e</code> or <code>lrc --enable SOURCE</code> enable a source from the list.</li>
+<li><code>lrc -d</code> or <code>lrc --disable SOURCE</code> disable a source from the list.</li>
+<li><code>lrc -r</code> or <code>lrc --reset SOURCE</code> reset all configuration for a source.</li>
+<li><code>lrc -v</code> or <code>lrc --version</code> show the installed version of lyricli.</li>
+<li><code>lrc -h</code> or <code>lrc --help</code> display some help</li>
+</ul>
+
+<h3>Roadmap</h3>
+
+<p>There is not much defined right now as a roadmap, but this needs to be
+done:</p>
+
+<ul>
+<li>Specs for all the components</li>
+<li>YARD documentation for all the components</li>
+</ul>
+
+<p>And the first thing I want to work on after that is done is separating
+the Lyrics Engines so we can add/remove lyrics engines in a similar way to how
+we currently add/remove sources.</p>
+
+<h3>Leave Feedback Please!</h3>
+
+<p>If you decide to use or hack away at Lyricly, please don't forget to
+post any issues you find.</p>
+
+<h3>License</h3>
+
+<p>Licensed under 3-clause-BSD.</p>
+</div></div>
+
+ <div id="footer">
+ Generated on Sat Oct 6 02:34:26 2012 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.2.1 (ruby-1.9.2).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
</div></div>
<div id="footer">
- Generated on Sat Oct 6 02:05:50 2012 by
+ Generated on Sat Oct 6 02:34:26 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
</div>
<div id="footer">
- Generated on Sat Oct 6 02:05:51 2012 by
+ Generated on Sat Oct 6 02:34:26 2012 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.2.1 (ruby-1.9.2).
</div>
--- /dev/null
+module Lyricli
+ # The namespace for all exceptions in Lyricli. Has no functionality by
+ # itself
+ module Exceptions
+ end
+end
+
module Lyricli
+
+ # This class gets the lyrics according to a given artist and song name.
class LyricsEngine
include Util
+ # Starts a new instance of LyricsEngine
+ #
+ # @param [String] artist the artist
+ # @param [String] song the song to look for
def initialize(artist, song)
@provider = URI("http://lyrics.wikia.com/api.php?artist=#{sanitize_param artist}&song=#{sanitize_param song}&fmt=realjson")
end
+ # Asks Lyrics Wiki for the lyrics, also cleans up the output a little.
+ #
+ # @return [String] the lyrics
def get_lyrics
begin
response = Net::HTTP.get(@provider)
node.inner_text
end
-
end
end
module Lyricli
+
+ # Manages the different sources. SourceManager is in charge of enabling and
+ # disabling them, as well as getting the current track.
class SourceManager
include Util
+ # Creates a new instance of SourceManager
def initialize
@enabled_sources = []
@config = Configuration.instance
end
end
+ # Enables a source. This runs the source's enable method and adds it to the
+ # `enabled_sources` configuration key. It will only enable sources that
+ # are "available" (see #available_sources)
+ #
+ # @param [String] source_name the name of the source to enable
def enable(source_name)
if available_sources.include?(source_name)
if klass = parse_class(camelize(source_name))
end
end
+ # Disables a source. This only removes the source from the `enabled_sources`
+ # configuration key.
+ #
+ # @param [String] source_name the name of the source to disable
def disable(source_name)
if available_sources.include?(source_name)
if klass = parse_class(camelize(source_name))
end
end
+ # Resets a source. This runs the source's reset method. It will also disable
+ # them.
+ #
+ # @param [String] source_name the name of the source to reset.
def reset(source_name)
if available_sources.include?(source_name)
if klass = parse_class(camelize(source_name))
end
end
+ # Iterates over every source to attempt to retrieve the current song.
+ #
+ # @return [Hash] the current track, has an `:artist` and `:song` key.
def current_track
track = nil
lock = false
track
end
+ # Returns an array with the available sources. Optionally formats the result
+ # so active sources are identified by an appended *
+ #
+ # @param [Boolean] format whether or not to render the stars for active
+ # sources.
+ # @return [Array] the names of the currently available sources.
def available_sources(format = false)
path_root = File.expand_path(File.dirname(__FILE__))
sources = Dir[path_root+"/sources/*.rb"].map{ |s|
name = s.split("/").last.gsub(/\.rb/, "")
-
- # Add a star to denote enabled sources
name
}
# Remove arguments (Hack?) We don't want anybody to touch tihs one.
sources.delete("arguments")
if format
+ # Add a star to denote enabled sources
format_sources(sources)
else
sources
end
end
+ # Adds a star to all members of the array that correspond to an active
+ # source
+ #
+ # @param [Array] sources the array of sources to format
+ # @return [Array] the formatted array
def format_sources(sources)
sources.map{ |s|
s << "*" if @config["enabled_sources"].include?(s)
--- /dev/null
+module Lyricli
+ # The namespace for all sources in Lyricli. Has no functionality by
+ # itself
+ module Sources
+ end
+end
module Lyricli
module Sources
+ # The arguments source. This one is special since it expects two
+ # arguments. It is treated specially by the SourceManager.
class Arguments
class << self
module Lyricli
module Sources
+ # The source for iTunes
class Itunes
class << self
module Lyricli
module Sources
+
+ # This is the Source for rdio
class Rdio
class << self
# The current_track method should return the name of the current
# artist and song.
+ #
# @return [Hash] A hash containing the current `:song` and `:artist`.
def current_track
response = @rdio.call('currentUser', {'extras' => 'lastSongPlayed'})