]> git.r.bdr.sh - rbdr/lyricli/blob - Sources/source_manager.swift
Add script to install sourcekitten
[rbdr/lyricli] / Sources / source_manager.swift
1 /// Manages the different sources. Keeps track of them, lists and toggles
2 class SourceManager {
3
4 private var availableSources: [String: Source] = [
5 "arguments": ArgumentsSource()
6 ]
7
8 var currentTrack: Track? {
9 for source in enabledSources {
10 if let currentTrack = source.currentTrack {
11 return currentTrack
12 }
13 }
14
15 return nil
16 }
17
18 var enabledSources: [Source] {
19
20 // Checks the config and returns an array of sources based on the
21 // enabled and available ones
22
23 var sources = [Source]()
24
25 if let sourceNames = Configuration.sharedInstance["enabled_sources"] as? [String] {
26 for sourceName in sourceNames {
27 if let source = availableSources[sourceName] {
28 sources.append(source)
29 }
30 }
31 }
32
33 return sources
34 }
35
36 func enable(sourceName: String) {
37 }
38
39 func disable(sourceName: String) {
40 }
41
42 func reset(sourceName: String) {
43 }
44
45 func getSources(sourceName: String) {
46 }
47 }