1 // The main class, handles all the actions that the executable will call
4 // Version of the application
5 static var version = "0.4.0"
7 // Flag that controls whether we should show the track artist and name before
9 static var showTitle = false
11 // Obtains the name of the current track from a source, fetches the lyrics
12 // from an engine and prints them
13 static func printLyrics() {
15 let sourceManager = SourceManager()
17 if let currentTrack = sourceManager.currentTrack {
18 printLyrics(currentTrack)
20 print("No Artist/Song could be found :(")
24 // fetches the lyrics from an engine and prints them
25 static func printLyrics(_ currentTrack: Track) {
26 let engine = LyricsEngine(withTrack: currentTrack)
28 if let lyrics = engine.lyrics {
30 printTitle(currentTrack)
35 print("Lyrics not found :(")
39 // Print the currently available sources
40 static func printSources() {
41 print("Listing Sources: Not yet implemented")
44 // Runs the enable method of a source and writes the configuration to set it
46 static func enableSource(_ sourceName: String) {
47 print("Enable source \(sourceName): Not yet implemented")
50 // Remove a source from the enabled sources configuration
51 static func disableSource(_ sourceName: String) {
52 print("Disable source \(sourceName): Not yet implemented")
55 // Removes any configuration for a source, and disables it
56 static func resetSource(_ sourceName: String) {
57 print("Reset source \(sourceName): Not yet implemented")
60 // Prints the track artist and name
61 private static func printTitle(_ track: Track) {
62 print("\(track.artist) - \(track.name)")