]> git.r.bdr.sh - rbdr/lyricli.rb/blob - lib/lyricli.rb
Finish first wave of documentation.
[rbdr/lyricli.rb] / lib / lyricli.rb
1 require 'uri'
2 require 'net/http'
3 require 'multi_json'
4 require 'nokogiri'
5 require 'open-uri'
6 require 'launchy'
7
8 # This shit causes a lot of warnings. Quick Hack.
9 original_verbosity = $VERBOSE
10 $VERBOSE = nil
11 require 'rdio'
12 $VERBOSE = original_verbosity
13
14 # Local Dependencies
15 require "lyricli/util"
16 require "lyricli/configuration"
17 require "lyricli/lyricli"
18 require "lyricli/lyrics_engine"
19 require "lyricli/source_manager"
20 require "lyricli/sources/arguments"
21 require "lyricli/sources/rdio"
22 require "lyricli/sources/itunes"
23
24 # The Lyricli module allows you to easily search for lyrics by looking for
25 # song and artist data from diverse sources.
26 module Lyricli
27 # Creates a new Lyricli instance and returns lyrics by going through the
28 # sources.
29 # @return [String] the fetched lyrics
30 def self.lyrics
31 @lyricli = Lyricli.new
32 @lyricli.get_lyrics
33 end
34
35 # Returns the version of the library
36 # @return [String] the version
37 def self.version
38 Gem.loaded_specs["lyricli"].version
39 end
40
41 # Returns a list of the available sources to enable or disable
42 # @return [String] the list of available sources. Enabled sources have
43 # a star appended.
44 def self.sources
45 source_manager = SourceManager.new
46 source_manager.available_sources(true).join(", ")
47 end
48
49 # Enables a source via the Source Manager
50 def self.enable(source_name)
51 source_manager = SourceManager.new
52 source_manager.enable(source_name)
53 end
54
55 # Disables a source via the Source Manager
56 def self.disable(source_name)
57 source_manager = SourceManager.new
58 source_manager.disable(source_name)
59 end
60
61 # Resets all configuration for a source via the Source Manager
62 def self.reset(source_name)
63 source_manager = SourceManager.new
64 source_manager.reset(source_name)
65 end
66 end