Queue finish actions on a Mac

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
Joccoli
Newbie
Newbie
Posts: 5
Joined: July 9th, 2008, 1:08 pm

Queue finish actions on a Mac

Post 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 
rAf
Moderator
Moderator
Posts: 546
Joined: April 28th, 2008, 2:35 pm
Location: France
Contact:

Re: Queue finish actions on a Mac

Post 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...
rAf
Moderator
Moderator
Posts: 546
Joined: April 28th, 2008, 2:35 pm
Location: France
Contact:

Re: Queue finish actions on a Mac

Post 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.
the_janes
Newbie
Newbie
Posts: 1
Joined: January 10th, 2009, 2:17 pm

Re: Queue finish actions on a Mac

Post 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...
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Queue finish actions on a Mac

Post by shypike »

rAf, cannot you just implement it in SABnzbd itself?
Else, tell me which system calls to use and I'll implement it.
rAf
Moderator
Moderator
Posts: 546
Joined: April 28th, 2008, 2:35 pm
Location: France
Contact:

Re: Queue finish actions on a Mac

Post 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.
Joccoli
Newbie
Newbie
Posts: 5
Joined: July 9th, 2008, 1:08 pm

Re: Queue finish actions on a Mac

Post 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!
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Queue finish actions on a Mac

Post by shypike »

It will be in the coming 0.4.7 release.
Joccoli
Newbie
Newbie
Posts: 5
Joined: July 9th, 2008, 1:08 pm

Re: Queue finish actions on a Mac

Post by Joccoli »

Just check 0.4.7 release. Works great, thanks!
b1scu1t
Release Testers
Release Testers
Posts: 83
Joined: January 29th, 2008, 6:19 pm

Re: Queue finish actions on a Mac

Post by b1scu1t »

Shypike,

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

Thanks,
b1scu1t
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Queue finish actions on a Mac

Post by shypike »

We support shutdown and standby.
I'm not aware of a "sleep" on OSX.
b1scu1t
Release Testers
Release Testers
Posts: 83
Joined: January 29th, 2008, 6:19 pm

Re: Queue finish actions on a Mac

Post by b1scu1t »

I stand corrected, I want my SABnzbd to go standby/pause once it is done with its existing queue of downloads.
Jaffar
Newbie
Newbie
Posts: 1
Joined: January 14th, 2010, 2:31 am

Re: Queue finish actions on a Mac

Post 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
Post Reply