summaryrefslogtreecommitdiff
path: root/Sources/lyricli.swift
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2017-05-20 09:52:30 -0500
committerBen Beltran <ben@nsovocal.com>2017-05-20 09:52:30 -0500
commitee966aa755acd8eea53c982e43e13aef4f193984 (patch)
tree5df111da5948ea198c5db1ca8f62e6c6ebe51178 /Sources/lyricli.swift
parentbcd37f402a2586d051ac10a6a4982c8c226b2cce (diff)
parent0d4485a445dd387235c141afca7764481eac0311 (diff)
Merge branch 'release/0.1.0'0.1.0
Diffstat (limited to 'Sources/lyricli.swift')
-rw-r--r--Sources/lyricli.swift60
1 files changed, 60 insertions, 0 deletions
diff --git a/Sources/lyricli.swift b/Sources/lyricli.swift
new file mode 100644
index 0000000..7d77a51
--- /dev/null
+++ b/Sources/lyricli.swift
@@ -0,0 +1,60 @@
+// The main class, handles all the actions that the executable will call
+class Lyricli {
+
+ // Version of the application
+ static var version = "0.1.0"
+
+ // Flag that controls whether we should show the track artist and name before
+ // the lyrics
+ static var showTitle = false
+
+ // Obtains the name of the current track from a source, fetches the lyrics
+ // from an engine and prints them
+ static func printLyrics() {
+
+ let sourceManager = SourceManager()
+
+ if let currentTrack = sourceManager.currentTrack {
+ 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 :(")
+ }
+ }
+
+ // Print the currently available sources
+ static func printSources() {
+ print("Listing Sources: Not yet implemented")
+ }
+
+ // Runs the enable method of a source and writes the configuration to set it
+ // as enabled
+ static func enableSource(_ sourceName: String) {
+ print("Enable source \(sourceName): Not yet implemented")
+ }
+
+ // Remove a source from the enabled sources configuration
+ static func disableSource(_ sourceName: String) {
+ print("Disable source \(sourceName): Not yet implemented")
+ }
+
+ // Removes any configuration for a source, and disables it
+ static func resetSource(_ sourceName: String) {
+ print("Reset source \(sourceName): Not yet implemented")
+ }
+
+ // Prints the track artist and name
+ private static func printTitle(_ track: Track) {
+ print("\(track.artist) - \(track.name)")
+ }
+}