mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
Fixed sleep inhibition error
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# 1.1.7 (ğre-release)
|
||||
- Added MPS GPU acceleration support for Silicon Mac, mentioned in https://github.com/denizsafak/abogen/issues/32#issuecomment-3155902040 by @jefro108
|
||||
- Added word-by-word karaoke highlighting feature by @robmckinnon in PR #65
|
||||
- Fixed sleep inhibition error occurring on some Linux systems that do not use systemd, mentioned in #67 by @hendrack
|
||||
- Improvements in code and documentation.
|
||||
|
||||
# 1.1.6
|
||||
- Improved EPUB chapter detection: Now reliably detects chapters from NAV HTML (TOC) files, even in non-standard EPUBs, fixes the issue mentioned by @jefro108 in #33
|
||||
|
||||
+19
-11
@@ -3,6 +3,7 @@ import sys
|
||||
import json
|
||||
import warnings
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import re
|
||||
from threading import Thread
|
||||
@@ -286,17 +287,24 @@ def prevent_sleep_start():
|
||||
# Add program name and reason for inhibition
|
||||
program_name = PROGRAM_NAME
|
||||
reason = "Prevent sleep during abogen process"
|
||||
_sleep_procs["Linux"] = create_process(
|
||||
[
|
||||
"systemd-inhibit",
|
||||
f"--who={program_name}",
|
||||
f"--why={reason}",
|
||||
"--what=sleep",
|
||||
"--mode=block",
|
||||
"sleep",
|
||||
"infinity",
|
||||
]
|
||||
)
|
||||
# Only attempt to use systemd-inhibit if it's available on the system.
|
||||
if shutil.which("systemd-inhibit"):
|
||||
_sleep_procs["Linux"] = create_process(
|
||||
[
|
||||
"systemd-inhibit",
|
||||
f"--who={program_name}",
|
||||
f"--why={reason}",
|
||||
"--what=sleep",
|
||||
"--mode=block",
|
||||
"sleep",
|
||||
"infinity",
|
||||
]
|
||||
)
|
||||
else:
|
||||
# Non-systemd distro or systemd tools not installed: skip inhibition rather than crash
|
||||
print(
|
||||
"systemd-inhibit not found: skipping sleep inhibition on this Linux system."
|
||||
)
|
||||
|
||||
|
||||
def prevent_sleep_end():
|
||||
|
||||
Reference in New Issue
Block a user