]> git.parisson.com Git - telecaster-server.git/commitdiff
add debug and streaming_only modes, add GST_DEBUG debug env
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Thu, 23 Oct 2025 06:05:27 +0000 (08:05 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Thu, 23 Oct 2025 06:05:27 +0000 (08:05 +0200)
bin/streaming/telecaster.py

index f6a902437167f77a8b87682cc491d60b6096eec6..0c56a89110c462d3a49ba73f6d14bd9be55c712f 100755 (executable)
@@ -137,25 +137,35 @@ class TeleCaster(Thread):
         self.tools = args["tools"]
         self.engine = args["engine"]
         self.no_video = args["no_video"]
+        self.streaming_only = args["streaming_only"]
+        self.debug = args["debug"]
+
+        if self.debug:
+            os.environ["GST_DEBUG"] = "3"
+
         self.conf = yaml.safe_load(conf_file)["telecaster"]
         self.stream_types = ["audio", "video"]
+
         self.deefuzzer_video_conf_file = "/tmp/telecaster_deefuzzer_webm_monitor.yml"
         self.deefuzzer_audio_conf_file = "/tmp/telecaster_deefuzzer_mp3_monitor.yml"
-        # print(self.conf)
+
         engine = self.conf["audio"]["engine"]["name"]
         if "autostart" in self.conf["audio"]["engine"]:
             if self.conf["audio"]["engine"]["autostart"]:
                 self.engine = True
-                print("OK")
+                print("engine started")
+
         self.params = PARAMS[engine]
         self.params["options"] = self.params["options"].format(**self.conf["audio"][engine])
         self.params["gst_audio_options"] = self.params["gst_audio_options"].format(**self.conf["audio"][engine])
+
         if "boot_time_delay" in self.conf:
             self.time_delay = self.conf["boot_time_delay"]
         else:
             self.time_delay = 1
 
         if self.verbose:
+            print(self.conf)
             print(self.params)
 
     def write_conf(self, conf_dict, path):
@@ -252,7 +262,7 @@ class TeleCaster(Thread):
         deefuzzer_global_conf["deefuzzer"]["station"].append(deefuzzer_local_conf)
 
         time.sleep(self.time_delay)
-        if not self.dry_run:
+        if not self.dry_run or not self.streaming_only:
             self.deefuzzer_start(deefuzzer_global_conf, self.deefuzzer_video_conf_file)
 
     def audio_start(self):
@@ -284,7 +294,7 @@ class TeleCaster(Thread):
         deefuzzer_global_conf["deefuzzer"]["station"].append(deefuzzer_local_conf)
 
         time.sleep(self.time_delay)
-        if not self.dry_run:
+        if not self.dry_run or not self.streaming_only:
             self.deefuzzer_start(deefuzzer_global_conf, self.deefuzzer_audio_conf_file)
 
     def connect(self):
@@ -315,6 +325,8 @@ def main():
     parser.add_argument("-t", "--tools", help="start tools", action="store_true")
     parser.add_argument("-e", "--engine", help="start engine", action="store_true")
     parser.add_argument("-nv", "--no-video", help="no video", action="store_true")
+    parser.add_argument("-so", "--streaming-only", help="streaming only, no monitor recording", action="store_true")
+    parser.add_argument("-db", "--debug", help="debug mode", action="store_true")
     args = vars(parser.parse_args())
     if os.path.exists(DEFAULT_CONFIG_FILE) and not args["config"]:
         args['config'] = DEFAULT_CONFIG_FILE