diff options
| author | Ben Beltran <ben@nsovocal.com> | 2017-05-18 19:38:15 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2017-05-18 19:38:15 -0500 |
| commit | b3320a26c57711ae7167f4549338bd0792dbe570 (patch) | |
| tree | bca17656820ba12db12a63f7d94764a857a5a8c7 /Sources/source_manager.swift | |
| parent | 1f7088f6391dfbffcd8f243f8d1509be8a209604 (diff) | |
| parent | a968bff7e21c9372deca5fce5921999b45d5d348 (diff) | |
Merge branch 'feature/read-song-from-command-line' into develop
Diffstat (limited to 'Sources/source_manager.swift')
| -rw-r--r-- | Sources/source_manager.swift | 52 |
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..dd956ad --- /dev/null +++ b/Sources/source_manager.swift @@ -0,0 +1,52 @@ +/// Manages the different sources. Keeps track of them, lists and toggles +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) { + } +} |