aboutsummaryrefslogtreecommitdiff
path: root/Sources/lyricli.swift
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2017-05-20 09:40:30 -0500
committerBen Beltran <ben@nsovocal.com>2017-05-20 09:40:30 -0500
commit29a566fada656091bf92456f6fb0f1bea5b6dca3 (patch)
treeca3abc17d3b5077db6b6a1e6d70e4702613eb427 /Sources/lyricli.swift
parent85d0536f2e9a3d4596c01b263d76b2b8d9ba70ae (diff)
parentd852b84edc24f1f1bbf4c34aa359447970e732b0 (diff)
Merge branch 'feature/rbdr-document-and-cleanup' into develop
Diffstat (limited to 'Sources/lyricli.swift')
-rw-r--r--Sources/lyricli.swift37
1 files changed, 23 insertions, 14 deletions
diff --git a/Sources/lyricli.swift b/Sources/lyricli.swift
index c44a7f4..e7d14b9 100644
--- a/Sources/lyricli.swift
+++ b/Sources/lyricli.swift
@@ -1,15 +1,20 @@
-/// The main Lyricli interface
-public class Lyricli {
- public static var version = "0.0.0-feature/option-parsing"
+// The main class, handles all the actions that the executable will call
+class Lyricli {
- public static var showTitle = false
+ // Version of the application
+ static var version = "0.0.0"
- public static func printLyrics() {
+ // 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 {
@@ -18,33 +23,37 @@ public class Lyricli {
}
print(lyrics)
- }
- else {
+ } else {
print("Lyrics not found :(")
}
- }
- else {
+ } else {
print("No Artist/Song could be found :(")
}
}
- public static func printSources() {
+ // Print the currently available sources
+ static func printSources() {
print("Listing Sources: Not yet implemented")
}
- public static func enableSource(_ sourceName: String) {
+ // 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")
}
- public static func disableSource(_ sourceName: String) {
+ // Remove a source from the enabled sources configuration
+ static func disableSource(_ sourceName: String) {
print("Disable source \(sourceName): Not yet implemented")
}
- public static func resetSource(_ sourceName: String) {
+ // 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)")
}