]>
Commit | Line | Data |
---|---|---|
4425e900 | 1 | /// Manages the different sources. Keeps track of them, lists and toggles |
a968bff7 | 2 | class SourceManager { |
4425e900 BB |
3 | |
4 | private var availableSources: [String: Source] = [ | |
5 | "arguments": ArgumentsSource() | |
6 | ] | |
7 | ||
8 | var currentTrack: Track? { | |
1263f62c BB |
9 | for source in enabledSources { |
10 | if let currentTrack = source.currentTrack { | |
11 | return currentTrack | |
4425e900 | 12 | } |
4425e900 | 13 | } |
1263f62c BB |
14 | |
15 | return nil | |
4425e900 BB |
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 | ||
1263f62c | 23 | var sources = [Source]() |
4425e900 | 24 | |
1263f62c BB |
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) | |
4425e900 BB |
29 | } |
30 | } | |
4425e900 | 31 | } |
1263f62c BB |
32 | |
33 | return sources | |
4425e900 BB |
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 | } |