Module: Lyricli

Defined in:
lib/lyricli.rb,
lib/lyricli/util.rb,
lib/lyricli/sources.rb,
lib/lyricli/lyricli.rb,
lib/lyricli/exceptions.rb,
lib/lyricli/sources/rdio.rb,
lib/lyricli/configuration.rb,
lib/lyricli/lyrics_engine.rb,
lib/lyricli/sources/itunes.rb,
lib/lyricli/source_manager.rb,
lib/lyricli/sources/arguments.rb,
lib/lyricli/exceptions/reset_source_error.rb,
lib/lyricli/exceptions/start_source_error.rb,
lib/lyricli/exceptions/enable_source_error.rb,
lib/lyricli/exceptions/unknown_source_error.rb,
lib/lyricli/exceptions/invalid_lyrics_error.rb,
lib/lyricli/exceptions/disable_source_error.rb,
lib/lyricli/exceptions/lyrics_not_found_error.rb,
lib/lyricli/exceptions/source_configuration_error.rb

Overview

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

Defined Under Namespace

Modules: Exceptions, Sources, Util Classes: Configuration, Lyricli, LyricsEngine, SourceManager

Class Method Summary (collapse)

Class Method Details

+ (Object) disable(source_name)

Disables a source via the Source Manager



70
71
72
73
74
75
76
77
# File 'lib/lyricli.rb', line 70

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

+ (Object) enable(source_name)

Enables a source via the Source Manager



60
61
62
63
64
65
66
67
# File 'lib/lyricli.rb', line 60

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

+ (String) lyrics

Creates a new Lyricli instance and returns lyrics by going through the sources.

Returns:

  • (String)

    the fetched lyrics



40
41
42
43
# File 'lib/lyricli.rb', line 40

def self.lyrics
  @lyricli = Lyricli.new
  @lyricli.get_lyrics
end

+ (Object) reset(source_name)

Resets all configuration for a source via the Source Manager



80
81
82
83
84
85
86
87
# File 'lib/lyricli.rb', line 80

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

+ (String) sources

Returns a list of the available sources to enable or disable

Returns:

  • (String)

    the list of available sources. Enabled sources have a star appended.



54
55
56
57
# File 'lib/lyricli.rb', line 54

def self.sources
  source_manager = SourceManager.new
  source_manager.available_sources(true).join(", ")
end

+ (String) version

Returns the version of the library

Returns:

  • (String)

    the version



47
48
49
# File 'lib/lyricli.rb', line 47

def self.version
  Gem.loaded_specs["lyricli"].version
end