From df47a93ba02273fef615f6fd2ad1610e8a4f2774 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 3 Jun 2019 00:05:47 +0200 Subject: [PATCH] Allow multiple station in yaml conf, add example (fix #79) --- deefuzzer/core.py | 3 +- deefuzzer/tools/utils.py | 4 +- example/deefuzzer_multiple.yaml | 112 ++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 example/deefuzzer_multiple.yaml diff --git a/deefuzzer/core.py b/deefuzzer/core.py index 1067485..a43617e 100644 --- a/deefuzzer/core.py +++ b/deefuzzer/core.py @@ -78,7 +78,8 @@ class DeeFuzzer(Thread): os.makedirs(self.log_dir) self.logger = QueueLogger(log_file, self.log_queue) self.logger.start() - #print(self.conf['deefuzzer']) + #print(self.conf) + for key in self.conf['deefuzzer'].keys(): if key == 'm3u': self.m3u = str(self.conf['deefuzzer'][key]) diff --git a/deefuzzer/tools/utils.py b/deefuzzer/tools/utils.py index 2dc81f3..fb70538 100644 --- a/deefuzzer/tools/utils.py +++ b/deefuzzer/tools/utils.py @@ -102,7 +102,9 @@ def get_conf_dict(file): confile = open(file, 'r') data = confile.read() confile.close() - return yaml.load(data) + for c in yaml.load_all(data): + conf = c + return conf elif 'json' in mime_type: import json diff --git a/example/deefuzzer_multiple.yaml b/example/deefuzzer_multiple.yaml new file mode 100644 index 0000000..febf0f6 --- /dev/null +++ b/example/deefuzzer_multiple.yaml @@ -0,0 +1,112 @@ +deefuzzer: + log: "/tmp/station.log" + m3u: "/tmp/station.m3u" + stationdefaults: + control: + mode: 0 + port: 16001 + jingles: + dir: "/path/to/jingles" + mode: 0 + shuffle: 1 + station: + - + control: + mode: 0 + port: 16001 + infos: + description: "My personal best funky playlist ever !" + genre: "Various Funk Groove" + name: "My best funky station" + short_name: My_station + url: "http://parisson.com" + jingles: + dir: "/path/to/jingles" + mode: 0 + shuffle: 1 + media: + bitrate: 96 + source: "/home/yomguy/Musique/MP3" + format: mp3 + ogg_quality: 4 + samplerate: 48000 + shuffle: 0 + voices: 2 + record: + dir: "/path/to/archives" + mode: 0 + relay: + author: Unknown + mode: 0 + url: "http://127.0.0.1:8000/telecaster_live.mp3" + feeds: + mode: 0 + rss: 1 + json: 0 + playlist: 1 + dir: "/path/to/rss/" + enclosure: 1 + media_url: "http://localhost/media/" + server: + host: "127.0.0.1" + mountpoint: monitor0 + port: 8000 + public: 0 + sourcepassword: hackme + type: icecast + appendtype: 1 + twitter: + key: "your access token key" + mode: 0 + secret: "your access token secret key" + tags: "parisson deefuzzer" + - + control: + mode: 0 + port: 16001 + infos: + description: "My personal best funky playlist ever !" + genre: "Various Funk Groove" + name: "My best funky station" + short_name: My_station + url: "http://parisson.com" + jingles: + dir: "/path/to/jingles" + mode: 0 + shuffle: 1 + media: + bitrate: 96 + source: "/home/yomguy/Musique/MP3" + format: mp3 + ogg_quality: 4 + samplerate: 48000 + shuffle: 0 + voices: 2 + record: + dir: "/path/to/archives" + mode: 0 + relay: + author: Unknown + mode: 0 + url: "http://127.0.0.1:8000/telecaster_live.mp3" + feeds: + mode: 0 + rss: 1 + json: 0 + playlist: 1 + dir: "/path/to/rss/" + enclosure: 1 + media_url: "http://localhost/media/" + server: + host: "127.0.0.1" + mountpoint: monitor1 + port: 8000 + public: 0 + sourcepassword: hackme + type: icecast + appendtype: 1 + twitter: + key: "your access token key" + mode: 0 + secret: "your access token secret key" + tags: "parisson deefuzzer" -- 2.47.3