diff cagou/plugins/plugin_transfer_voice.py @ 491:203755bbe0fe

massive refactoring from camelCase -> snake_case. See backend commit log for more details
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:44:32 +0200
parents 3c9ba4a694ef
children
line wrap: on
line diff
--- a/cagou/plugins/plugin_transfer_voice.py	Sat Apr 08 13:34:55 2023 +0200
+++ b/cagou/plugins/plugin_transfer_voice.py	Sat Apr 08 13:44:32 2023 +0200
@@ -56,12 +56,12 @@
         self.audio = audio
         self.audio.file_path = "/sdcard/cagou_record.3gp"
 
-    def _updateTimer(self, dt):
+    def _update_timer(self, dt):
         self.time = int(time.time() - self._started_at)
 
-    def switchRecording(self):
+    def switch_recording(self):
         if self.playing:
-            self._stopPlaying()
+            self._stop_playing()
         if self.recording:
             try:
                 audio.stop()
@@ -75,13 +75,13 @@
             audio.start()
             self._started_at = time.time()
             self.time = 0
-            self._counter_timer = Clock.schedule_interval(self._updateTimer, 1)
+            self._counter_timer = Clock.schedule_interval(self._update_timer, 1)
 
         self.recording = not self.recording
 
-    def _stopPlaying(self, __=None):
+    def _stop_playing(self, __=None):
         if self.record_time is None:
-            log.error("_stopPlaying should no be called when record_time is None")
+            log.error("_stop_playing should no be called when record_time is None")
             return
         audio.stop()
         self.playing = False
@@ -89,11 +89,11 @@
         if self._counter_timer is not None:
             self._counter_timer.cancel()
 
-    def playRecord(self):
+    def play_record(self):
         if self.recording:
             return
         if self.playing:
-            self._stopPlaying()
+            self._stop_playing()
         else:
             try:
                 audio.play()
@@ -106,7 +106,7 @@
 
             self.playing = True
             self.record_time = self.time
-            Clock.schedule_once(self._stopPlaying, self.time + 1)
+            Clock.schedule_once(self._stop_playing, self.time + 1)
             self._started_at = time.time()
             self.time = 0
-            self._counter_timer =  Clock.schedule_interval(self._updateTimer, 0.5)
+            self._counter_timer =  Clock.schedule_interval(self._update_timer, 0.5)