module Lyricli

The Lyricli module allows you to easily search for lyrics by looking for song and artist data from diverse sources.

Public Class Methods

disable(source_name) click to toggle source

Disables a source via the Source Manager

# File lib/lyricli.rb, line 71
def self.disable(source_name)
  source_manager = SourceManager.new
  begin
    source_manager.disable(source_name)
  rescue Exceptions::UnknownSourceError
    "There is no such Source"
  end
end
enable(source_name) click to toggle source

Enables a source via the Source Manager

# File lib/lyricli.rb, line 61
def self.enable(source_name)
  source_manager = SourceManager.new
  begin
    source_manager.enable(source_name)
  rescue Exceptions::UnknownSourceError
    "There is no such Source"
  end
end
lyrics() click to toggle source

Creates a new Lyricli instance and returns lyrics by going through the sources. @return [String] the fetched lyrics

# File lib/lyricli.rb, line 41
def self.lyrics
  @lyricli = Lyricli.new
  @lyricli.get_lyrics(@show_title)
end
reset(source_name) click to toggle source

Resets all configuration for a source via the Source Manager

# File lib/lyricli.rb, line 81
def self.reset(source_name)
  source_manager = SourceManager.new
  begin
    source_manager.reset(source_name)
  rescue Exceptions::UnknownSourceError
    "There is no such Source"
  end
end
root() click to toggle source

Returns the root of the Gem.

@return [String] the root path for this gem

# File lib/lyricli.rb, line 93
def self.root
  File.expand_path('../..',__FILE__)
end
show_title() click to toggle source

Sets the show_title instance variable so it requests the title

# File lib/lyricli.rb, line 98
def self.show_title
  @show_title = true
end
sources() click to toggle source

Returns a list of the available sources to enable or disable @return [String] the list of available sources. Enabled sources have

a star appended.
# File lib/lyricli.rb, line 55
def self.sources
  source_manager = SourceManager.new
  source_manager.available_sources(true).join(", ")
end
version() click to toggle source

Returns the version of the library @return [String] the version

# File lib/lyricli.rb, line 48
def self.version
  Gem.loaded_specs["lyricli"].version
end