Provide an option to stop the computer when all downloads are completed

Bug #435422 reported by Julien Cornuwel
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
LottaNZB
Triaged
Wishlist
Unassigned

Bug Description

Not a bug but a feature request. Title is pretty self-explanatory I think.

Revision history for this message
Marcel de Vries (carresmd-deactivatedaccount) wrote :

Hi Julien,

Thanks for you feature request! I'll try to implement this, but I can't promise it will be included in a future release, because I need approval from Severin. When I know more, I'll let you know (which should be tomorrow).

Changed in lottanzb:
assignee: nobody → Marcel de Vries (carresmd)
importance: Undecided → Wishlist
milestone: none → 0.5.2
status: New → Confirmed
tags: removed: feature
Revision history for this message
Severin H (severinh) wrote :

Hi Marcel and Julien,

SABnzbd already provides this feature, which means that we won't need to do anything except designing and implementing an UI for it. And this can be done easily.

It's probably a good idea to implement it as a plug-in.

Revision history for this message
Julien Cornuwel (julien-cornuwel) wrote :

Thanks guys, it would be nice. I would have proposed a patch but I'm python-phobic ;-)

Revision history for this message
Sander Tuit (avirulence) wrote : Re: [Bug 435422] Re: Provide an option to stop the computer when all downloads are completed

What's not to like about python? No strange brackets at all! ;-)

On 2009 9 23 22:05, "Julien Cornuwel" <email address hidden> wrote:

Thanks guys, it would be nice. I would have proposed a patch but I'm
python-phobic ;-)

-- Provide an option to stop the computer when all downloads are completed
https://bugs.launchpad....
Status in LottaNZB • Automated Usenet Client: Confirmed

Bug description: Not a bug but a feature request. Title is pretty
self-explanatory I think.

Revision history for this message
Eran C (shush6) wrote :

we may want to provide an option to either shutdown the pc or just shutdown lottanzb and sadnzbd. looking at the sabnzbd api, the shutdown option shut down sabnzbd and not the computer, right?

Revision history for this message
Julien Cornuwel (julien-cornuwel) wrote :

@ Sander : Sorry for hurting your pythonist feelings. Was just trolling to hide the fact that I never took the time to learn it, which I often regret.

Revision history for this message
Severin H (severinh) wrote :

I should have spend more time investigating the issue.

SABnzbd actually provides a feature that allows one to execute a certain action when SABnzd finishes downloading the whole queue. One of the predefined actions is "shutdown_pc". This action can even be specified through the API (have a look at 'ChangeCompleteActionQuery' in LottaNZB's code).

The problem is that it won't work on Linux as the system_* functions in sabnzbd/__init__.py have not been implemented for Linux, but only Windows ans Mac OS X (Darwin?). I guess one would need to get in touch with the SABnzbd devs so that the Linux-specific code can be written before 0.5 is released.

Revision history for this message
Severin H (severinh) wrote :

I don't see why we should provide SABnzbd's feature that shuts it down as soon as the queue has been downloaded completely.

Marcel just pointed out that it's not possible to shut down the system without root privileges. This might be the reason why the SABnzbd devs didn't implement it for Linux machines. Is there really no way of shutting down a Linux machine without root privileges? What happens if I shut down my machine from the GNOME panel?

Revision history for this message
Eran C (shush6) wrote :

Marcel is right that you can't shut down the system using the shutdown command without root privileges. GNOME panel shut down the system by contacting a daemon with root privileges via DBUS.

So in Gnome (and I think it will also work in KDE) you can shutdown the system by calling the shutdown method on this DBUS Service: org.freedesktop.PowerManagement

code should look something like these:

objectPath = '/org/freedesktop/PowerManagement'
busName = 'org.freedesktop.PowerManagement'
bus = dbus.SessionBus()
pm = bus.get_object(busName, objectPath)
pm.Shutdown()

other methods available are:Hibernate() ,Suspend(), Reboot()

haven't tested it yet because then I couldn't complete this message :) but it should work... problem is that it might not work on other Desktop envierments.

Revision history for this message
Eran C (shush6) wrote :

for some reason the code I wrote isn't working, but don't know much about DBUS so with little modifications it should work

Revision history for this message
Severin H (severinh) wrote :

I also supposed that it's possible to achieve it using DBus. A problem is that the power management Dbus API changed alot lately, probably because of the HAL deprecation. We actually had a plug-in ready for 0.5.2 which used the power management API (prevent system hibernation) but I removed it again when I noticed that it just wouldn't work on Ubuntu 9.10.

Revision history for this message
Marcel de Vries (carresmd-deactivatedaccount) wrote :

There are several ways to shutdown the system using DBus, via ConsoleKit,
PowerManager and probably DeviceKit. Last night I only researched the
ConsoleKit way and managed to shutdown my system. I will write a patch for
SABnzbd later today. Probably using all methods to shutdown the system, that
way it should work on most systems. I believe PowerManager is going to be
depricated as it depends on hal, IIRC.

On 2009 9 24 08:20, "Severin Heiniger" <email address hidden> wrote:

I also supposed that it's possible to achieve it using DBus. A problem
is that the power management Dbus API changed alot lately, probably
because of the HAL deprecation. We actually had a plug-in ready for
0.5.2 which used the power management API (prevent system hibernation)
but I removed it again when I noticed that it just wouldn't work on
Ubuntu 9.10.

-- Provide an option to stop the computer when all downloads are completed
https://bugs.launchpad....
You received this bug notification because you are a bug assignee.

Status in LottaNZB • Automated Usenet Client: Confirmed

Bug description: Not a bug but a feature request. Title is pretty
self-explanatory I think.

Severin H (severinh)
Changed in lottanzb:
milestone: 0.5.2 → 0.6
status: Confirmed → Triaged
Revision history for this message
Marcel de Vries (carresmd-deactivatedaccount) wrote :

I have submitted my patch to the SABnzbd developers. It is likely it will be included in the 0.5 release of SABnzbd :-). If you want to you can see the forum post here: http://forums.sabnzbd.org/index.php?topic=2635.0

Revision history for this message
Marcel de Vries (carresmd-deactivatedaccount) wrote :

The patch has been implemented by the SABnzbd developers. :-)

Revision history for this message
Severin H (severinh) wrote :

Just merged a new plug-in into the 0.5 series branch that prevents the computer from being suspended while LottaNZB is still downloading. Depending on what time has been chosen in the GNOME preferences after which the computer is treated to be idle, the computer will then be suspended automatically.

Severin H (severinh)
Changed in lottanzb:
milestone: 0.6 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.