X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli/blobdiff_plain/cadf28c5831b225abf9da650127659c0b0bf6e39..691c09f872dfd69d6e3df12ce0e1d2f0807b3937:/Sources/lyricli.swift?ds=inline diff --git a/Sources/lyricli.swift b/Sources/lyricli.swift index d55b500..5931ca1 100644 --- a/Sources/lyricli.swift +++ b/Sources/lyricli.swift @@ -2,21 +2,29 @@ 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) - } - else { - print("Current track not found") - } - } - public static func printTitle() { - print("Getting Song Title: Not yet implemented") + let engine = LyricsEngine(withTrack: currentTrack) + + if let lyrics = engine.lyrics { + if showTitle { + printTitle(currentTrack) + } + + print(lyrics) + } else { + print("Lyrics not found :(") + } + + } else { + print("No Artist/Song could be found :(") + } } public static func printSources() { @@ -34,4 +42,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)") + } }