Page 1 of 1

Queue finish actions on a Mac

Posted: January 8th, 2009, 4:52 pm
by Joccoli
Hi,

Can someone tell me why queue finish actions on my Mac are limited to just shutting down SABNZBD? I saw a screenshot tonight (http://sabnzbd.wikidot.com/gui-queue) where shutdown PC and hibernate PC are also options. I like these as well, aspecially shutdown PC. (PPC G5, OSX 10.4.11, Safari 3.2.1)

Thanks, Stephan 

Re: Queue finish actions on a Mac

Posted: January 8th, 2009, 5:48 pm
by rAf
Hi,
I've never use this function, but yes you're right, actions availalbe on queue finish are Shutdown SABnzbd and execute script (if  defined).
I can try to see if we can add sleep, hibernate and shutdown PC if you're interested...

Re: Queue finish actions on a Mac

Posted: January 8th, 2009, 7:35 pm
by rAf
I've found a simple way to shutdown or sleep on queue finish :

I've made 2 scripts one for shutdown and and to sleep.

Mac-Sleep

Code: Select all

#!/usr/bin/python
import subprocess
subprocess.call(['osascript', '-e','tell app "System Events" to sleep'])
Mac-Shutdown

Code: Select all

#!/usr/bin/python
import subprocess
subprocess.call(['osascript', '-e','tell app "System Events" to shut down'])
Scripts are attached to this post (rename to zip).
Copy these scripts in a folder for exemple Scripts (in your home folder)
Go to SABnzbd Folders config page and write "Scripts" in the "User Folders / Folder Containing the User Scripts" field and save config.

Now you should be able to select actions.

If you edit files by yourself don't forget to make these 2 files executables :

Code: Select all

chmod +x ~/Scripts/Mac-Sleep
chmod +x ~/Scripts/Mac-Shutdown
Hope it helps.

PS : I've not tested theses scripts on 10.4 but it should work.

Re: Queue finish actions on a Mac

Posted: January 10th, 2009, 6:43 pm
by the_janes
(first of all, im sorry for my very bad english...it's not my native language)

hey rAf,

thanks so far. But i've gt some problems doin this:

I've downloaded the scripts (by the way, what part do i have to rename to zip?) - a folder with the name "script" was created including two files (Mac-Sleep & Mac-Shutdown)...without renaming anything?!
I entered the folder name in the config page and i was able to select the two files in my "on qeue finish" dropdown menue.
So far so good :)

But, it doesn't work...the queue was empty, all the post-processing was done, but the Mac didn't shutdown. Don't know why?!

What about the part, making the files executable? How and where do i have to do this?


Thanks in advance :)

janes


btw: using Mac OSX 10.5 an SAB 0.4.6...

Re: Queue finish actions on a Mac

Posted: January 11th, 2009, 6:32 am
by shypike
rAf, cannot you just implement it in SABnzbd itself?
Else, tell me which system calls to use and I'll implement it.

Re: Queue finish actions on a Mac

Posted: January 11th, 2009, 6:40 pm
by rAf
shypike,

To implement sleep the system call is :

Code: Select all

subprocess.call(['osascript', '-e','tell app "System Events" to sleep'])
to shutdown :

Code: Select all

subprocess.call(['osascript', '-e','tell app "System Events" to shut down'])
I've look at interfaces, there are some tweaks to do in interfaces also.
It seems that systems call are in __init__.py.

Sorry no time to test further, if you implement it, I can test.

Re: Queue finish actions on a Mac

Posted: January 16th, 2009, 5:56 pm
by Joccoli
I appreciate the effort, but like other people who tried the scripts don't work on my Mac. I'm very much in favour if this can be included in a future release. Thanks!

Re: Queue finish actions on a Mac

Posted: January 17th, 2009, 9:39 am
by shypike
It will be in the coming 0.4.7 release.

Re: Queue finish actions on a Mac

Posted: February 23rd, 2009, 4:34 pm
by Joccoli
Just check 0.4.7 release. Works great, thanks!

Re: Queue finish actions on a Mac

Posted: February 26th, 2009, 4:14 pm
by b1scu1t
Shypike,

Can you also give an option for putting SABnzbd to sleep after the current download is done?

Thanks,
b1scu1t

Re: Queue finish actions on a Mac

Posted: February 26th, 2009, 5:02 pm
by shypike
We support shutdown and standby.
I'm not aware of a "sleep" on OSX.

Re: Queue finish actions on a Mac

Posted: February 27th, 2009, 10:39 am
by b1scu1t
I stand corrected, I want my SABnzbd to go standby/pause once it is done with its existing queue of downloads.

Re: Queue finish actions on a Mac

Posted: January 14th, 2010, 2:41 am
by Jaffar
Hello rAf! I tried your script, but there was no effect after the queue finished. (I made them available in the script folder and changed the rights to executable).
Since the post is a long time ago, are there any new developments in this direction?

shypike stressed the efford in this thred, that it will be available in the 0.4.x release, but obviously there were no changes implemented for the mac.
I am now using the beta 0.5.0b6 version and osx 10.6.2.

Please help - Jaffar