Standby
Standby
On queue finish
Shutdown PC
Hibernate PC
Shutdown SABnzbd
Why not Standby PC? Personally I never use Hibernate and I never shutdown SAB as its always handy to just be able to dump any NZB into the "hole" and have it download without having to worry that SAB is active but I do use Standby a helluva lot!
How about it?
Shutdown PC
Hibernate PC
Shutdown SABnzbd
Why not Standby PC? Personally I never use Hibernate and I never shutdown SAB as its always handy to just be able to dump any NZB into the "hole" and have it download without having to worry that SAB is active but I do use Standby a helluva lot!
How about it?
Re: Standby
I'll have a look at this.
Funny thing, people also complain that the system goes into standby while SABnzbd is still busy.
So I'm also looking at letting SABnzbd tell the OS, not to standby...
Funny thing, people also complain that the system goes into standby while SABnzbd is still busy.
So I'm also looking at letting SABnzbd tell the OS, not to standby...
Re: Standby
I use this script to put my Windows PC in to standby after the queue empties:
rundll32 powrprof.dll,SetSuspendState
rundll32 powrprof.dll,SetSuspendState
Re: Standby
Standby will be a feature in the next release.
Re: Standby
When I do that, I get hibernate every time. Even if you throw the 0,0,0 at the end to supposedly force it to sleep and not hibernate, it hibernates.neilt0 wrote: I use this script to put my Windows PC in to standby after the queue empties:
rundll32 powrprof.dll,SetSuspendState
Re: Standby
You use either
rundll32 powrprof.dll,SetSuspendState Hibernate
or
rundll32 powrprof.dll,SetSuspendState Standby
Without the extra parameter you get the default action (often hibernate).
rundll32 powrprof.dll,SetSuspendState Hibernate
or
rundll32 powrprof.dll,SetSuspendState Standby
Without the extra parameter you get the default action (often hibernate).
Re: Standby
http://msdn.microsoft.com/en-us/library/aa373208.aspx
can you do that in python?
hope it helps else i will look more as i need it
can you do that in python?
hope it helps else i will look more as i need it
Re: Standby
It's on the to-do list as Ticket #4, with no plan yet.
I have looked at this before, but did not implement it.
The problem isn't in the calls itself (which are easy to do in Python)
but in finding out when exactly to call them.
I have looked at this before, but did not implement it.
The problem isn't in the calls itself (which are easy to do in Python)
but in finding out when exactly to call them.
Re: Standby
"Calling SetThreadExecutionState without ES_CONTINUOUS simply resets the idle timer; to keep the display or system in the working state, the thread must call SetThreadExecutionState periodically.
To run properly on a power-managed computer, applications such as fax servers, answering machines, backup agents, and network management applications must use both ES_SYSTEM_REQUIRED and ES_CONTINUOUS when they process events. Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED when they display video for long periods of time without user input. Applications such as word processors, spreadsheets, browsers, and games do not need to call "
Create Thread -
while [true]
if (downloading or extracting) SetThreadExecutionState(ES_SYSTEM_REQUIRED)
sleep(1000)
greetings
daniel
To run properly on a power-managed computer, applications such as fax servers, answering machines, backup agents, and network management applications must use both ES_SYSTEM_REQUIRED and ES_CONTINUOUS when they process events. Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED when they display video for long periods of time without user input. Applications such as word processors, spreadsheets, browsers, and games do not need to call "
Create Thread -
while [true]
if (downloading or extracting) SetThreadExecutionState(ES_SYSTEM_REQUIRED)
sleep(1000)
greetings
daniel
Re: Standby
*bump*
if you can give me small hints where to start looking i might wanna check that myself
waking my machine up and queue something just to see it going down again 5 mins later is not cool
i have no idea how to do the call itself you have a howto on that?
if you can give me small hints where to start looking i might wanna check that myself
waking my machine up and queue something just to see it going down again 5 mins later is not cool
i have no idea how to do the call itself you have a howto on that?
Re: Standby
oki did look into it - you are rights its a 3 mins find
question now is where to put it in sabnzb - i did a quick peek in downloader.py and didnt understand it 100% right away in a minute
the queue emtpy case is not clear for me without looking more - maybe you can help me with it - but reading msdn correctly its not even needed
so maybe this already is the solution (as a diff) - i *didnt* run it yet only checked if it compiles
will report again once i had time to run it
Cya
Daniel
Code: Select all
from ctypes import *
import os
ES_SYSTEM_REQUIRED = 0x00000001
ES_DISPLAY_REQUIRED = 0x00000002
ES_CONTINUOUS = 0x80000000
def master_main():
kernel32 = windll.LoadLibrary("Kernel32.dll")
kernel32.SetThreadExecutionState(c_int(ES_SYSTEM_REQUIRED))
if (__name__ == "__main__"):
master_main()
question now is where to put it in sabnzb - i did a quick peek in downloader.py and didnt understand it 100% right away in a minute
the queue emtpy case is not clear for me without looking more - maybe you can help me with it - but reading msdn correctly its not even needed
so maybe this already is the solution (as a diff) - i *didnt* run it yet only checked if it compiles
will report again once i had time to run it
Code: Select all
--- old\downloader.py 2008-11-03 21:36:58.000000000 +0100
+++ downloader.py 2008-11-20 00:58:32.031125000 +0100
@@ -34,8 +34,14 @@
from sabnzbd.misc import Notify, decodePassword
from sabnzbd.constants import *
+from ctypes import *
+
#------------------------------------------------------------------------------
+ES_SYSTEM_REQUIRED = 0x00000001
+ES_DISPLAY_REQUIRED = 0x00000002
+ES_CONTINUOUS = 0x80000000
+
def GetParm(server, keyword):
""" Get named server parameter in a safe way """
try:
@@ -131,6 +137,12 @@
def __init__(self, servers, paused = False):
Thread.__init__(self)
+ try:
+ self.kernel32 = windll.LoadLibrary("Kernel32.dll")
+ except:
+ kernel32 = False
+ pass
+
# Used for scheduled pausing
self.paused = paused
@@ -470,6 +482,12 @@
__NAME__, nw.thrdnum, nw.server.host,
nw.server.port, nw.article.article)
+ if kernel32:
+ try:
+ kernel32.SetThreadExecutionState(c_int(ES_SYSTEM_REQUIRED))
+ except:
+ pass
+
fileno = nw.nntp.sock.fileno()
nw.body()
Daniel
Re: Standby
It's an accepted ticket waiting to be implemented.
When it has enough priority and someone of team wants to do it.
When it has enough priority and someone of team wants to do it.
Re: Standby
i cant make it run with the exe version of sabnzb (or compile a new one using py2exe) as im not a python expert and its missing the _ctypes but its running now with a full blown python
apart from that, i made some minor changes made to improve compatibility
do i read your post right, that you are not really an open community and dont care to much about input like this? doesnt have to be bad! I would then simply dont nag you anymore, but just simply fix it for myself or ask one of my employees who are python geeks then.
BTW: do you by any chance have a full dev env for sabnzbd which also contains the py2exe build files etc? Ahh yeah and your py2exe link in the install.txt is broken.
apart from that, i made some minor changes made to improve compatibility
Code: Select all
--- old\downloader.py 2008-11-03 21:36:58.000000000 +0100
+++ SABnzbd\downloader.py 2008-11-20 13:49:59.890500000 +0100
@@ -26,6 +26,9 @@
import logging
import sabnzbd
import datetime
+import os
+if os.name=='nt':
+ import ctypes
from threading import Thread
@@ -34,8 +37,15 @@
from sabnzbd.misc import Notify, decodePassword
from sabnzbd.constants import *
+if os.name=='nt':
+ from ctypes import *
+
#------------------------------------------------------------------------------
+ES_SYSTEM_REQUIRED = 0x00000001
+ES_DISPLAY_REQUIRED = 0x00000002
+ES_CONTINUOUS = 0x80000000
+
def GetParm(server, keyword):
""" Get named server parameter in a safe way """
try:
@@ -131,6 +141,13 @@
def __init__(self, servers, paused = False):
Thread.__init__(self)
+ self.kernel32 = False
+ if os.name == "nt":
+ try:
+ self.kernel32 = windll.LoadLibrary("Kernel32.dll")
+ except:
+ pass
+
# Used for scheduled pausing
self.paused = paused
@@ -470,6 +487,12 @@
__NAME__, nw.thrdnum, nw.server.host,
nw.server.port, nw.article.article)
+ if self.kernel32:
+ try:
+ self.kernel32.SetThreadExecutionState(c_int(ES_SYSTEM_REQUIRED))
+ except:
+ pass
+
fileno = nw.nntp.sock.fileno()
nw.body()
BTW: do you by any chance have a full dev env for sabnzbd which also contains the py2exe build files etc? Ahh yeah and your py2exe link in the install.txt is broken.
Re: Standby
We have limited time to work on SABnzbd and have to make choices.
We welcome patches for fixes and new features, it would certainly speed up implementation.
We still need to review and test (and sometimes cleanup/redesign) such patches as
SABnzbd is quite complex.
The Wiki should give you enough information on how to install Python and
the required modules.
Creating a binary distribution is tricky, but not needed if you have a working
Python environment (which you need anyway).
Compiling will not give you any speed or memory usage gains.
We'd rather not see other people distribute binary releases as this would be
confusing the to the users (and we would end up with the support questions).
Should you have time to spend on SABnzbd, have a look at the long wishlist here:
http://trac2.assembla.com/SABnzbd/report/3
We welcome patches for fixes and new features, it would certainly speed up implementation.
We still need to review and test (and sometimes cleanup/redesign) such patches as
SABnzbd is quite complex.
The Wiki should give you enough information on how to install Python and
the required modules.
Creating a binary distribution is tricky, but not needed if you have a working
Python environment (which you need anyway).
Compiling will not give you any speed or memory usage gains.
We'd rather not see other people distribute binary releases as this would be
confusing the to the users (and we would end up with the support questions).
Should you have time to spend on SABnzbd, have a look at the long wishlist here:
http://trac2.assembla.com/SABnzbd/report/3
Re: Standby
oki - as said in a Python environment the patch is running for me(tm).
Not sure if i can be helpfull in general as im not an expert in python. But will look at the list - http://trac2.assembla.com/SABnzbd/report/3.
I still admit the patch was fully selfish.
>Creating a binary distribution is tricky
I got quite far py2exe it was just missing modules. Stuff like elementtree - it didnt really accept the elementtree.pyd. Do you have dev mailing list or section in the forum for questions like that, to not spam the normal forum?
> but not needed
well more easy to run it as windows service then - but i will look into it thx.
Not sure if i can be helpfull in general as im not an expert in python. But will look at the list - http://trac2.assembla.com/SABnzbd/report/3.
I still admit the patch was fully selfish.
>Creating a binary distribution is tricky
I got quite far py2exe it was just missing modules. Stuff like elementtree - it didnt really accept the elementtree.pyd. Do you have dev mailing list or section in the forum for questions like that, to not spam the normal forum?
> but not needed
well more easy to run it as windows service then - but i will look into it thx.