I spent a week trying to figure out a way to launch it on mac properly thinking it was plexconnect, pms, osx gatekeeper, ended up just being a simple way to start it, as my 2nd link in my signature. Maybe you can turn plexconnect into a program like we do using osx applescript to make an app. I would look there and search for a way just to get it in there running as a autostarting program or a service in windows. If you find a way to get it running during “away mode” please share so it will be easier to autostart for someone else. Till then I would shut it off until you can figure it out, at least you can make pms usuable.
i agree. turning off "away mode" would resolve my issue for now. I think this was more a heads up / feature request for baa or the plex developers to see if there's anyway to get plexconnect to work *with* plex in Away Mode. eg if plex could launch the plexconnect process, since plex already runs with the ES_AWAYMODE_REQUIRED thread etc. or whether baa could somehow get one of the python threads to work in that mode. like i said i'm just information-farming really.. i dont know how these systems run. i tried what i thought might work, but it didnt.
thanks for the help anyway
j
ps baa what you've done here with plexconnect is great! i received an apple tv as a gift, and plex and airplay is all i really use it for :)
i think i may have resolved this.
i modified the end of PlexConnect.py as per the code below.
what happens now is when the PC goes into sleep mode (i can also force "sleep" as usual from the start->shut down menu), then the display cuts off and the audio cuts off on my pc. but PlexConnect continues to function. Presumably this therefore relates to what is listed here for Away Mode functionality http://blogs.msdn.com/b/david_fleischman/archive/2005/10/21/483637.aspx . I can't verify all of it is happening as is stated there, but since the first 2 state
- Shuts down the video signal at the port
- Mutes all system audio
then this appears to be correct. my mouse/keyboard wakes it up, but presumably that's because they're USB Wireless devices not PS/2 as per
- Blocks HID and PS/2 input devices (so your cat does not walk across the “delete” key and delete your library)
I can probably go into Device Manager and stop the USB devices "waking up" the PC if i want
note, it's "Sleep" mode, not "Standby"/"Hibernate" or anything like that... a lot is still running and the power saving is probably very little, but as mentioned it's just meant to be a "User is away from machine" mode, plus a couple of other power savings
One thing I notice different between the normal PlexConnect.py and my PlexConnect-away.py modification, is that when it enters "Sleep" mode my PC's power light now stays on, whereas with the original version the power light goes off (the PC is not actually off in either situation since nudging the mouse will wake it up within 2 seconds, but the fact the light shows a different state with my version, probably demonstrates the difference between actual "Sleep" mode and "Away" mode... plus like i said, PlexConnect is still functioning completely)
I've only done short tests on this, I need to check it still works as expected when leaving the pc to "sleep" for half an hour or so whilst i watch a video.
anyway here's the code:
def sighandler_shutdown(signum, frame): signal.signal(signal.SIGINT, signal.SIG_IGN) # we heard you! cmdShutdown()AMENDED VERSION HERE
import ctypes
ES_AWAYMODE_REQUIRED = 0x00000040
ES_CONTINUOUS = 0x80000000
ES_DISPLAY_REQUIRED = 0x2 #Forces the display to be on by resetting the display idle timer.
ES_SYSTEM_REQUIRED = 0x1 #Forces the system to be in the working state by resetting the system idle timer.def not_null(result, func, arguments):
if result == 0:
raise WinError()def plexconnect_main():
SetThreadExecutionState = ctypes.windll.kernel32.SetThreadExecutionState
SetThreadExecutionState.restype = int
SetThreadExecutionState.argtypes = (ctypes.c_uint, )
SetThreadExecutionState.errcheck = not_null
SetThreadExecutionState(ES_AWAYMODE_REQUIRED | ES_CONTINUOUS)signal.signal(signal.SIGINT, sighandler_shutdown)
signal.signal(signal.SIGTERM, sighandler_shutdown)
dprint(‘PlexConnect’, 0, “***”)
dprint(‘PlexConnect’, 0, “PlexConnect”)
dprint(‘PlexConnect’, 0, “Press CTRL-C to shut down.”)
dprint(‘PlexConnect’, 0, “***”)
success = startup()
if success:
run()
shutdown()if name==“main”:
plexconnect_main()
note the restype, argtype, errcheck, not_null etc don't seem to be necessary, i just got it from that original code i borrowed for this, so left them in. in fact i think you can just modify the original PlexConnect.py just like this
if __name__=="__main__": signal.signal(signal.SIGINT, sighandler_shutdown) signal.signal(signal.SIGTERM, sighandler_shutdown) # -- ALLOW AWAY MODE -- import ctypes ES_AWAYMODE_REQUIRED = 0x00000040 ES_CONTINUOUS = 0x80000000 SetThreadExecutionState = ctypes.windll.kernel32.SetThreadExecutionState SetThreadExecutionState(ES_AWAYMODE_REQUIRED | ES_CONTINUOUS) # ---------------------dprint(‘PlexConnect’, 0, “***”)
dprint(‘PlexConnect’, 0, “PlexConnect”)
dprint(‘PlexConnect’, 0, “Press CTRL-C to shut down.”)
dprint(‘PlexConnect’, 0, “***”)
success = startup()if success:
run()
shutdown()
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.