]>
git.r.bdr.sh - rbdr/lyricli.rb/blob - lib/lyricli.rb
8 # This shit causes a lot of warnings. Quick Hack.
9 original_verbosity
= $VERBOSE
12 $VERBOSE = original_verbosity
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"
21 require "lyricli/sources/arguments"
22 require "lyricli/sources/rdio"
23 require "lyricli/sources/itunes"
24 require "lyricli/exceptions"
25 require "lyricli/exceptions/disable_source_error"
26 require "lyricli/exceptions/enable_source_error"
27 require "lyricli/exceptions/invalid_lyrics_error"
28 require "lyricli/exceptions/lyrics_not_found_error"
29 require "lyricli/exceptions/reset_source_error"
30 require "lyricli/exceptions/source_configuration_error"
31 require "lyricli/exceptions/start_source_error"
32 require "lyricli/exceptions/unknown_source_error"
34 # The Lyricli module allows you to easily search for lyrics by looking for
35 # song and artist data from diverse sources.
37 # Creates a new Lyricli instance and returns lyrics by going through the
39 # @return [String] the fetched lyrics
41 @lyricli = Lyricli
.new
45 # Returns the version of the library
46 # @return [String] the version
48 Gem
.loaded_specs
["lyricli"].version
51 # Returns a list of the available sources to enable or disable
52 # @return [String] the list of available sources. Enabled sources have
55 source_manager
= SourceManager
.new
56 source_manager
.available_sources(true).join(", ")
59 # Enables a source via the Source Manager
60 def self.enable(source_name
)
61 source_manager
= SourceManager
.new
63 source_manager
.enable(source_name
)
64 rescue Exceptions
::UnknownSourceError
65 "There is no such Source"
69 # Disables a source via the Source Manager
70 def self.disable(source_name
)
71 source_manager
= SourceManager
.new
73 source_manager
.disable(source_name
)
74 rescue Exceptions
::UnknownSourceError
75 "There is no such Source"
79 # Resets all configuration for a source via the Source Manager
80 def self.reset(source_name
)
81 source_manager
= SourceManager
.new
83 source_manager
.reset(source_name
)
84 rescue Exceptions
::UnknownSourceError
85 "There is no such Source"