diff options
| author | Britney Fransen <brfransen@gmail.com> | 2025-11-15 00:19:36 (GMT) |
|---|---|---|
| committer | Britney Fransen <brfransen@gmail.com> | 2025-11-15 00:19:36 (GMT) |
| commit | 0db2a94d54e6262121794c75106616156eb579b0 (patch) | |
| tree | 93b1d043a23cd39441928237bc5d72d5b614012d /linhes/linhes-system/idle.py | |
| parent | a85000ca3f0cbfb4e291363cbb35fb9b7b32bae2 (diff) | |
| download | linhes_pkgbuild-0db2a94d54e6262121794c75106616156eb579b0.zip linhes_pkgbuild-0db2a94d54e6262121794c75106616156eb579b0.tar.gz linhes_pkgbuild-0db2a94d54e6262121794c75106616156eb579b0.tar.bz2 | |
linhes-system: idle.py: change method for checking mythfrontend statustesting
69-hdparm.rules: add for hd spindown
Diffstat (limited to 'linhes/linhes-system/idle.py')
| -rwxr-xr-x | linhes/linhes-system/idle.py | 20 |
1 files changed, 14 insertions, 6 deletions
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 |
