diff options
| -rw-r--r-- | linhes/linhes-system/69-hdparm.rules | 1 | ||||
| -rwxr-xr-x | linhes/linhes-system/PKGBUILD | 8 | ||||
| -rwxr-xr-x | linhes/linhes-system/idle.py | 20 |
3 files changed, 20 insertions, 9 deletions
diff --git a/linhes/linhes-system/69-hdparm.rules b/linhes/linhes-system/69-hdparm.rules new file mode 100644 index 0000000..414698e --- /dev/null +++ b/linhes/linhes-system/69-hdparm.rules @@ -0,0 +1 @@ +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="sd*", ATTRS{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 254 -S 0 $env{DEVNAME}" diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD index 6a61b2c..91abbd9 100755 --- a/linhes/linhes-system/PKGBUILD +++ b/linhes/linhes-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=linhes-system pkgver=9.0.0 -pkgrel=99 +pkgrel=100 arch=('x86_64') #install=$pkgname.install pkgdesc="Everything that makes LinHES a system" @@ -24,7 +24,7 @@ source=($binfiles 'lh_mtc.cron' 'paccache.cron' 'flatpak_update.cron' 'xfs_defrag.cron' 'pacman_orphans.cron' 'readme_is_xml' 'add_storage.readme' 'LinHES-release' 'lh_log_care.cron' '79-cronie.hook' 'fstrim.hook' 'openssh.hook' 'plex_lib.conf' 'rsyslog.hook' - '10-monitor.conf' '81-wol.rules' 'x11vnc.override.conf' 'lh_lighttpd.conf' 'lh_php.ini' + '10-monitor.conf' '81-wol.rules' '69-hdparm.rules' 'x11vnc.override.conf' 'lh_lighttpd.conf' 'lh_php.ini' 'system-sudo.rules' 'linhes-profile.sh' 'lh_sqlserver.cnf' 'lh_restart_needed.hook' 'lh_system_start.sh.desktop' 'rc6_mce.toml' 'recordings.cron' 'rsyslog.mythtv.conf') sha256sums=('1fb11c7f472df9e3066866301962c2678b80c2fbd988dc34db022d51e1101a42' @@ -33,7 +33,7 @@ sha256sums=('1fb11c7f472df9e3066866301962c2678b80c2fbd988dc34db022d51e1101a42' 'ff261f41efec8a9963f9f59100cbe75f015028a2ed3a863ce0cb473f2ebb7b76' '8b54c31b8efde3917f603c5307bebb0a2a00239ad9a983c2f5d8120003256449' 'ae34515e144830f424d3bd3f6b1b446892d62beed20bca6f0fb19b0bbb779f27' - '9e52a21e9d0f3f993b819587256a1cd57dca04451d5f2d0fd76667b1d3f860f1' + 'a79edfeb88b90a8f5538a159b39ba235caba8c6d6b2a39a20faa3ae0301b770b' '050d7d44b1636a298ae020807e64637b40d39b4c52eb2f9661fe30090e66cee3' '1c36e4fdf41c1063e0a127ce4a90fbdef19879c381a87f622d7399ca931560cc' '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787' @@ -77,6 +77,7 @@ sha256sums=('1fb11c7f472df9e3066866301962c2678b80c2fbd988dc34db022d51e1101a42' '6c42b2920c6a37bf3dd05755b9e3fdd80137708cc55a7d1bef2234c17dff0349' '09b9c1b2ee6a5bbe48c5f3755ad64628487b60a4eb6734efb292cefdb74fb657' 'efc2a04b67ea76661157e154228d4b58ae2e1b652f8ce41bc001a5a863d13573' + '7571e230ab4cf2a1285fdb9762d87d350ea350ce820e5806143b402aa1ea37e0' '67d0cb111d47609de4c60b84dc617fc817fdf092763fbd0cef270b5ee650d702' '023cba18580819018413608ec055d5ff8166b69525c32aa728ad1ecd7cf00aca' 'dae799f09a076e0f573ea516bc357f56f2fd3aa8e35ec0cf54b6b62282960ee0' @@ -157,6 +158,7 @@ package() { chmod 750 ${pkgdir}/etc/sudoers.d/ #udev rules + install -Dm0644 "${srcdir}/69-hdparm.rules" "${pkgdir}/etc/udev/rules.d/69-hdparm.rules" install -Dm0644 "${srcdir}/81-wol.rules" "${pkgdir}/etc/udev/rules.d/81-wol.rules" #disable dpms diff --git a/linhes/linhes-system/idle.py b/linhes/linhes-system/idle.py index 3f4b3bc..4b2db1e 100755 --- a/linhes/linhes-system/idle.py +++ b/linhes/linhes-system/idle.py @@ -1,7 +1,8 @@ #!/usr/bin/python -import argparse, os, re, subprocess, sys, time +import argparse, os, re, requests, subprocess, sys, time from datetime import datetime, date, timedelta +import xml.etree.ElementTree as ET def msg(cmdargs,msg): if cmdargs.silent is False: @@ -237,24 +238,31 @@ def mythfe_check(cmdargs,cursor,mythDB): for i in frontends: try: + URL = f"http://{i[0]}:6547/Frontend/GetStatus" msg(cmdargs," Checking %s's mythfrontend status..." %i) - frontend = mythDB.getFrontend(''.join(i)) + response = requests.get(URL, timeout=3) + root = ET.fromstring(response.text) + # Find the current location and state in the State element + state_element = root.find('State') + if state_element is not None: + location = state_element.find(".//String[Key='currentlocation']/Value") + state = state_element.find(".//String[Key='state']/Value") + if ( cmdargs.runningfe ): msg(cmdargs," %s's mythfrontend is RUNNING." %i) return False - location = frontend.sendQuery('Location') - if location == "standbymode": + if location is not None and location.text == "standbymode": msg(cmdargs," %s's mythfrontend is in Standby Mode." %i) continue - if ( location.startswith('Playback ') ): + if state is not None and state.text.startswith('Watching'): msg(cmdargs," %s's mythfrontend is PLAYING." %i) return False else: msg(cmdargs," %s's mythfrontend is NOT playing." %i) - if '.xml' in location or 'mainmenu' in location: + if location is not None and '.xml' in location.text or 'mainmenu' in location.text: msg(cmdargs," %s's mythfrontend is in MENUS." %i) else: #FE is not in menus, so it must be active in a plugin |
