]> git.r.bdr.sh - rbdr/lyricli/blobdiff - Sources/lyricli.swift
Add doc generation to linter
[rbdr/lyricli] / Sources / lyricli.swift
index d55b500af960bb8b39c5c571ea78fbe91bec4aff..10d9270f541d038314b732b26b92ee0b6fae1120 100644 (file)
@@ -1,22 +1,30 @@
 /// The main Lyricli interface
 public class Lyricli {
 /// The main Lyricli interface
 public class Lyricli {
-    public static var version = "0.0.0-feature/option-parsing"
+    public static var version = "0.0.0"
+
+    public static var showTitle = false
 
     public static func printLyrics() {
 
         let sourceManager = SourceManager()
 
         if let currentTrack = sourceManager.currentTrack {
 
     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() {
     }
 
     public static func printSources() {
@@ -34,4 +42,8 @@ public class Lyricli {
     public static func resetSource(_ sourceName: String) {
         print("Reset source \(sourceName): Not yet implemented")
     }
     public static func resetSource(_ sourceName: String) {
         print("Reset source \(sourceName): Not yet implemented")
     }
+
+    private static func printTitle(_ track: Track) {
+        print("\(track.artist) - \(track.name)")
+    }
 }
 }