aboutsummaryrefslogtreecommitdiff
path: root/Sources/lyricli.swift
blob: 5931ca10f4e9ee9303311a5e76a70bb9d0f8d2e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/// The main Lyricli interface
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 {

            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() {
        print("Listing Sources: Not yet implemented")
    }

    public static func enableSource(_ sourceName: String) {
        print("Enable source \(sourceName): Not yet implemented")
    }

    public static func disableSource(_ sourceName: String) {
        print("Disable 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)")
    }
}