aboutsummaryrefslogtreecommitdiff
path: root/Sources/source_manager.swift
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2017-05-17 23:06:25 -0500
committerBen Beltran <ben@nsovocal.com>2017-05-17 23:06:25 -0500
commit4425e9001e20e891dab7711644f83a1628788b47 (patch)
treefba94182eba1aeca5a1e9addbfd09966a06bb9a7 /Sources/source_manager.swift
parent1f7088f6391dfbffcd8f243f8d1509be8a209604 (diff)
Add the arguments source
Diffstat (limited to 'Sources/source_manager.swift')
-rw-r--r--Sources/source_manager.swift52
1 files changed, 52 insertions, 0 deletions
diff --git a/Sources/source_manager.swift b/Sources/source_manager.swift
new file mode 100644
index 0000000..d0af817
--- /dev/null
+++ b/Sources/source_manager.swift
@@ -0,0 +1,52 @@
+/// Manages the different sources. Keeps track of them, lists and toggles
+public class SourceManager {
+
+ private var availableSources: [String: Source] = [
+ "arguments": ArgumentsSource()
+ ]
+
+ var currentTrack: Track? {
+ get {
+
+ for source in enabledSources {
+ if let currentTrack = source.currentTrack {
+ return currentTrack
+ }
+ }
+
+ return nil
+ }
+ }
+
+ var enabledSources: [Source] {
+
+ // Checks the config and returns an array of sources based on the
+ // enabled and available ones
+
+ get {
+ var sources = [Source]()
+
+ if let sourceNames = Configuration.sharedInstance["enabled_sources"] as? [String]{
+ for sourceName in sourceNames {
+ if let source = availableSources[sourceName] {
+ sources.append(source)
+ }
+ }
+ }
+
+ return sources
+ }
+ }
+
+ func enable(sourceName: String) {
+ }
+
+ func disable(sourceName: String) {
+ }
+
+ func reset(sourceName: String) {
+ }
+
+ func getSources(sourceName: String) {
+ }
+}