From 2dcf228b73cf605e9ada3e7b7a162d836baa3182 Mon Sep 17 00:00:00 2001 From: Pecusx Date: Sun, 18 Jun 2017 14:13:22 +0200 Subject: [PATCH] New option in radiod.conf Added option for force streaming in 1 core raspberies (force_streaming=yes). --- config_class.py | 12 ++++++++++++ radio_class.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config_class.py b/config_class.py index e56783d..025963d 100755 --- a/config_class.py +++ b/config_class.py @@ -69,6 +69,7 @@ class Configuration: bright = True # LCD high brightness (Pecus) media_update = False # always update media library (Pecus) pandora_available = False # is Pandora accout available ? (Pecus) + force_streaming = False # If True, streaming is possible even on weak raspberries (1 core) # Colours for Adafruit LCD color = { 'OFF': 0x0, 'RED' : 0x1, 'GREEN' : 0x2, 'YELLOW' : 0x3, @@ -280,6 +281,12 @@ class Configuration: else: # (Pecus) self.pandora_available = False # (Pecus) + elif option == 'force_streaming': # option for streaming availablity on 1 core raspberries (Pecus) + if parameter == 'yes': # (Pecus) + self.force_streaming = True # (Pecus) + else: # (Pecus) + self.force_streaming = False # (Pecus) + else: msg = "Invalid option " + option + ' in section ' \ @@ -459,6 +466,10 @@ class Configuration: def getPandoraAvailable(self): # (Pecus) return self.pandora_available # (Pecus) + # Get streaming flag (Pecus) + def getForceStreaming(self): # (Pecus) + return self.force_streaming # (Pecus) + # Get speech volume % of normal volume level def getSpeechVolume(self): return self.speech_volume @@ -529,6 +540,7 @@ if __name__ == '__main__': print "LCD high brightness:", config.getBright() # (Pecus) print "Always update media library:", config.getAlwaysUpdate() # (Pecus) print "Pandora account available:", config.getPandoraAvailable() # (Pecus) + print "Streaming on 1 core raspberries:",config.getForceStreaming() # (Pecus) if config.getStationNamesSource() is 1: sSource = "STREAM" else: diff --git a/radio_class.py b/radio_class.py index 45762a4..cbb895f 100755 --- a/radio_class.py +++ b/radio_class.py @@ -1485,7 +1485,7 @@ class Radio: # Check if icecast streaming installed and pocessor has more than 1 core def streamingAvailable(self): fpath = "/usr/bin/icecast2" - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) and (self.cores>1) + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) and ((self.cores>1) or config.getForceStreaming()) # Store stram on or off in streaming file def storeStreaming(self,onoff):