]> git.r.bdr.sh - rbdr/lyricli/blob - Sources/source_manager.swift
Add code license
[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 get {
10
11 for source in enabledSources {
12 if let currentTrack = source.currentTrack {
13 return currentTrack
14 }
15 }
16
17 return nil
18 }
19 }
20
21 var enabledSources: [Source] {
22
23 // Checks the config and returns an array of sources based on the
24 // enabled and available ones
25
26 get {
27 var sources = [Source]()
28
29 if let sourceNames = Configuration.sharedInstance["enabled_sources"] as? [String]{
30 for sourceName in sourceNames {
31 if let source = availableSources[sourceName] {
32 sources.append(source)
33 }
34 }
35 }
36
37 return sources
38 }
39 }
40
41 func enable(sourceName: String) {
42 }
43
44 func disable(sourceName: String) {
45 }
46
47 func reset(sourceName: String) {
48 }
49
50 func getSources(sourceName: String) {
51 }
52 }