From 4fc18e8bc31dfcb1076b406586e9d707f263cda3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20Test=C3=A9?= Date: Tue, 8 Mar 2016 23:19:07 +0100 Subject: [PATCH] Modifying building filename calls. --- stream_2016/libre-streamer.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/stream_2016/libre-streamer.py b/stream_2016/libre-streamer.py index e31efd7..1eb5c4a 100755 --- a/stream_2016/libre-streamer.py +++ b/stream_2016/libre-streamer.py @@ -21,14 +21,17 @@ # TODO list: # ---------- # - Implement a method to switch to webcam feed if Elphel cam feed is lost -# - Display the Gst element 'videotestsrc', in case of failure of the whole pipeline +# --> Use ping by opening Telnet connexion every 2 seconds (if it fails, then switch to webcam) +# --> Has to be threaded # - Add a checkbox to enable/disable options (storing/streaming - storing only - stream only - etc...) # - Add a function to get the ip address of the camera automatically (see github.com/paulmilliken) # - Create a module for the network configuration (fan/cpu, ifconfig, stream server,etc) +# --> Taken care in FAI building # - Generate a log file during runtime. (e.g. this will let you know if the network configuration # and the pipeline construction went well (or not)) # - Add an input source choice for the user (camera on IP or webcam) -# - Add a time counter +# - Add a time counter +# --> Has to be threaded # - Add a 'CPU load' widget # - Add the FSF logo (need to do some pixel art) as an application icon # - Add the FSF logo inside the streamer use the 'textoverlay' method in ElementFactory.make() @@ -195,10 +198,10 @@ class Streamgui(object): if '(651)' not in debug: # The error is not a socket error. self.pipel.stream_stop() + self.build_filename(streamfailed=True) self.create_backup_pipeline() def on_stream_clicked(self, widget): - labelname = self.stream_button.get_label() if labelname == 'Stream': if self.pipel.feed == 'backup': @@ -213,7 +216,7 @@ class Streamgui(object): self.pipel.stream_stop() self.stream_button.set_label('Stream') - def build_filename(self): + def build_filename(self, streamfailed=False): """Get text in entries, check if empty and apply formatting if needed.""" sep = '_' base = self.baseinfo_entry_label.get_text() @@ -227,13 +230,20 @@ class Streamgui(object): if len(raw_filename) >= maxlen: offset = len(raw_filename) - maxlen raw_filename = raw_filename[:-offset] - self.pipel.set_filenames(raw_filename) + if streamfailed: + self.pipel.set_filenames(raw_filename, streamfailed=True) + else: + self.pipel.set_filenames(raw_filename,) + print('RAWFILENAM: ', raw_filename, ' <--') + elif streamfailed: + self.pipel.set_filenames(raw_filename, streamfailed=True) return True - else: + elif not streamfailed: self.entryfield_info.run() self.entryfield_info.hide() return False - + + def clean_entry_fields(self): self.speakerinfo_entry.set_text('') self.sessioninfo_entry.set_text('') -- 2.25.1