Parcourir la source

fix scsi drive choosing + fix print statements

Noah Vogt il y a 1 an
Parent
commit
0f7cc8c229
4 fichiers modifiés avec 5 ajouts et 10 suppressions
  1. 4 5
      os_agnostic/cd.py
  2. 1 1
      recording/cd.py
  3. 0 1
      recording/sermon.py
  4. 0 3
      set_cd_marker.py

+ 4 - 5
os_agnostic/cd.py

@@ -53,7 +53,7 @@ def choose_right_scsi_drive(drives: list) -> str:
         # pylint: disable=possibly-used-before-assignment
         dialog = RadioButtonDialog(drives, "Choose a SCSI Drive")
         if dialog.exec_() == QDialog.Accepted:
-            print(f"Dialog accepted: {dialog.chosen}")
+            log(f"Dialog accepted: {dialog.chosen}")
             return dialog.chosen
         log("Warning: Choosing first SCSI drive...", color="yellow")
 
@@ -73,6 +73,9 @@ def bytes_line_ends_with(line: bytes, target: str) -> bool:
     if byte_len < len(target):
         return False
 
+    if len(target) == 1 and ord(target[0]) != line[-1]:
+        return False
+
     for index in range(-1, -1 * len(target), -1):
         if ord(target[index]) != line[index]:
             return False
@@ -89,10 +92,6 @@ def get_scsi_drives() -> list[str]:
         if result.returncode != 0:
             raise CustomException("Command 'cdrecord -scanbus' failed.")
         for line in output.split(b"\n"):
-            print(line)
-            print(match(rb"\s*[0-9](,[0-9])+\s*[0-9]+", line))
-            print(not bytes_line_ends_with(line, "*"))
-            print(not bytes_line_ends_with(line, "HOST ADAPTOR"))
             # pylint: disable=possibly-used-before-assignment
             if (
                 match(rb"\s*[0-9](,[0-9])+\s*[0-9]+", line)

+ 1 - 1
recording/cd.py

@@ -112,7 +112,7 @@ def choose_right_cd_drive(drives: list) -> str:
 
         dialog = RadioButtonDialog(drives, "Choose a CD to Burn")
         if dialog.exec_() == QDialog.Accepted:
-            print(f"Dialog accepted: {dialog.chosen_sheets}")
+            log(f"Dialog accepted: {dialog.chosen_sheets}")
             return dialog.chosen_sheets
         log("Warning: Choosing first cd drive...", color="yellow")
 

+ 0 - 1
recording/sermon.py

@@ -247,7 +247,6 @@ def upload_sermon_audiofile(audiofile: str) -> None:
             sys.exit(1)
 
         mp3_final_path = path.join(path.split(audiofile)[0], wanted_filename)
-        print(mp3_final_path)
         make_sermon_mp3(audiofile, mp3_final_path)
 
         with open(mp3_final_path, "rb") as file:

+ 0 - 3
set_cd_marker.py

@@ -44,14 +44,11 @@ from recording import is_valid_cd_record_checkfile, mark_end_of_recording
 def get_reset_marker(yyyy_mm_dd: str) -> int:
     max_reset = 0
     for file in listdir(path.join(const.CD_RECORD_OUTPUT_BASEDIR, yyyy_mm_dd)):
-        print(file)
         if (
             match(r"[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]+\.wav$", file)
             and len(file) == 22
         ):
-            print(f"file {file} reached")
             max_reset = max(int(file[11:18]), max_reset)
-            print(max_reset)
     return max_reset + 1