import gstconf
+ENTRYFIELD_TEXT = 'Please fill both entry\nfield to stop streaming.'
formatted_date = strftime('%Y_%m_%d', localtime())
metadata = {'speaker_name':'NC',
'session_title':'NC',
self.win.set_title("Libre-Streamer")
self.win.connect("delete_event",
lambda w,e: Gtk.main_quit())
+## self.win.fullscreen()
vbox = Gtk.VBox(False, 0)
vbox_labels = Gtk.VBox(False, 0)
vbox_entries = Gtk.VBox(False, 0)
vbox_streaminfo = Gtk.VBox(False, 0)
vbox_cpuinfo = Gtk.VBox(False, 0)
- hbox = Gtk.HBox(False, 0)
+ hbox = Gtk.HBox(False, 30)
hbox_videoaudio = Gtk.HBox(False, 0)
hbox_time = Gtk.HBox(False, 0)
self.videowidget = Gtk.DrawingArea()
self.videowidget.set_size_request(600, 400)
+
# True stereo feed has to be implemented:
self.vumeter_l = Gtk.ProgressBar()
self.vumeter_l.set_orientation(Gtk.Orientation.VERTICAL)
self.stream_button.connect("clicked", self.on_stream_clicked)
self.streamtime_label = Gtk.Label('Time elapsed ')
self.streamtime_value = Gtk.Label('00:00:00')
+
+ self.cpuload_label = Gtk.Label('CPU load: ')
+ self.cpuload_value = Gtk.Label('NC')
+
+ self.entryfield_info = Gtk.MessageDialog(buttons=Gtk.ButtonsType.CLOSE,
+ text=ENTRYFIELD_TEXT,)
+ ##messagetype=Gtk.MessageType.WARNING,
+ ##Gtk.MessageType.INFO,)
hbox_videoaudio.pack_start(self.videowidget, True, True, 0)
hbox_videoaudio.pack_start(self.vumeter_l, False, False, 3)
hbox.pack_start(vbox_labels, False, False, 0)
hbox.pack_start(vbox_entries, False, False, 0)
hbox.pack_start(vbox_streaminfo, False, False, 0)
+ hbox.pack_start(self.cpuload_label, False, False, 0)
+ hbox.pack_start(self.cpuload_value, False, False, 0)
vbox.pack_start(hbox_videoaudio, True, True, 0)
vbox.pack_start(hbox, False, True, 0)
if t == Gst.MessageType.ERROR:
err, debug = message.parse_error()
if '(651)' not in debug:
+ # The error is not a socket error.
self.pipel.stream_stop()
self.create_backup_pipeline()
self.stream_button.set_label('ON AIR')
start_time = time()
elif labelname == 'ON AIR':
- self.pipel.stream_stop()
- self.stream_button.set_label('Stream')
-## self.build_filename()
-
-## In this state, this function freeze the streaming if the fields are NOT completed
+ if self.build_filename():
+ self.pipel.stream_stop()
+ self.stream_button.set_label('Stream')
+
def build_filename(self):
"""Get text in entries, check if empty and apply formatting if needed."""
sep = '_'
session = sep.join(session.split())
raw_filename = base + sep + speaker + sep + session
maxlen = 70
- has_all_fields = False
- while not has_all_fields:
- if speaker and session:
- if len(raw_filename) <= maxlen:
- has_all_fields = True
- else:
- offset = len(raw_filename) - maxlen
- raw_filename = raw_filename[:-offset]
- has_all_fields = True
- else:
- pass
- # One of the field is empty, open a dialogbox to ask for filling the field
- self.pipel.set_filenames(raw_filename)
+ if speaker and session:
+ if len(raw_filename) >= maxlen:
+ offset = len(raw_filename) - maxlen
+ raw_filename = raw_filename[:-offset]
+ self.pipel.set_filenames(raw_filename)
+ return True
+ else:
+ self.entryfield_info.run()
+ self.entryfield_info.hide()
+ return False
def clean_entry_fields(self):
self.speakerinfo_entry.set_text('')