diff options
| author | Ben Beltran <ben@nsovocal.com> | 2017-05-17 23:23:18 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2017-05-17 23:23:18 -0500 |
| commit | a968bff7e21c9372deca5fce5921999b45d5d348 (patch) | |
| tree | bca17656820ba12db12a63f7d94764a857a5a8c7 /Sources/lyricli.swift | |
| parent | cadf28c5831b225abf9da650127659c0b0bf6e39 (diff) | |
Simulate lyrics engine
Diffstat (limited to 'Sources/lyricli.swift')
| -rw-r--r-- | Sources/lyricli.swift | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Sources/lyricli.swift b/Sources/lyricli.swift index d55b500..c44a7f4 100644 --- a/Sources/lyricli.swift +++ b/Sources/lyricli.swift @@ -2,23 +2,33 @@ public class Lyricli { public static var version = "0.0.0-feature/option-parsing" + public static var showTitle = false + public static func printLyrics() { let sourceManager = SourceManager() if let currentTrack = sourceManager.currentTrack { - print(currentTrack.artist) - print(currentTrack.name) + + let engine = LyricsEngine(withTrack: currentTrack) + + if let lyrics = engine.lyrics { + if showTitle { + printTitle(currentTrack) + } + + print(lyrics) + } + else { + print("Lyrics not found :(") + } + } else { - print("Current track not found") + print("No Artist/Song could be found :(") } } - public static func printTitle() { - print("Getting Song Title: Not yet implemented") - } - public static func printSources() { print("Listing Sources: Not yet implemented") } @@ -34,4 +44,8 @@ public class Lyricli { public static func resetSource(_ sourceName: String) { print("Reset source \(sourceName): Not yet implemented") } + + private static func printTitle(_ track: Track) { + print("\(track.artist) - \(track.name)") + } } |