]>
git.r.bdr.sh - rbdr/lyricli.rb/blob - lib/lyricli.rb
e995c45945a115e36f756f6feef8539e1d5b249f
9 # This shit causes a lot of warnings. Quick Hack.
10 original_verbosity
= $VERBOSE
13 $VERBOSE = original_verbosity
16 require "lyricli/util"
17 require "lyricli/configuration"
18 require "lyricli/lyricli"
19 require "lyricli/lyrics_engine"
20 require "lyricli/source_manager"
21 require "lyricli/sources"
22 require "lyricli/sources/arguments"
23 require "lyricli/sources/rdio"
24 require "lyricli/sources/itunes"
25 require "lyricli/exceptions"
26 require "lyricli/exceptions/disable_source_error"
27 require "lyricli/exceptions/enable_source_error"
28 require "lyricli/exceptions/invalid_lyrics_error"
29 require "lyricli/exceptions/lyrics_not_found_error"
30 require "lyricli/exceptions/reset_source_error"
31 require "lyricli/exceptions/source_configuration_error"
32 require "lyricli/exceptions/start_source_error"
33 require "lyricli/exceptions/unknown_source_error"
35 # The Lyricli module allows you to easily search for lyrics by looking for
36 # song and artist data from diverse sources.
38 # Creates a new Lyricli instance and returns lyrics by going through the
40 # @return [String] the fetched lyrics
42 @lyricli = Lyricli
.new
43 @lyricli.get_lyrics(@show_title)
46 # Returns the version of the library
47 # @return [String] the version
49 Gem
.loaded_specs
["lyricli"].version
52 # Returns a list of the available sources to enable or disable
53 # @return [String] the list of available sources. Enabled sources have
56 source_manager
= SourceManager
.new
57 source_manager
.available_sources(true).join(", ")
60 # Enables a source via the Source Manager
61 def self.enable(source_name
)
62 source_manager
= SourceManager
.new
64 source_manager
.enable(source_name
)
65 rescue Exceptions
::UnknownSourceError
66 "There is no such Source"
70 # Disables a source via the Source Manager
71 def self.disable(source_name
)
72 source_manager
= SourceManager
.new
74 source_manager
.disable(source_name
)
75 rescue Exceptions
::UnknownSourceError
76 "There is no such Source"
80 # Resets all configuration for a source via the Source Manager
81 def self.reset(source_name
)
82 source_manager
= SourceManager
.new
84 source_manager
.reset(source_name
)
85 rescue Exceptions
::UnknownSourceError
86 "There is no such Source"
90 # Returns the root of the Gem.
92 # @return [String] the root path for this gem
94 File
.expand_path('../..',__FILE__
)
97 # Sets the show_title instance variable so it requests the title