[Plugin] Autoshutdown - Shutdown PC once torrents complete

Suggest, post, or discuss plugins for Deluge
ooEagleOneoo
New User
New User
Posts: 2
Joined: Tue Nov 25, 2014 8:39 am

Re: New User needs help please

Post by ooEagleOneoo »

Thanks :D l hope you do get time to have a look and fix it, as l have no idea how to.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by Cas »

I have released a new version (1.2) with the Windows fix added, see first post for link.
GMY0da
New User
New User
Posts: 3
Joined: Fri Dec 05, 2014 11:23 pm

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by GMY0da »

I'm not that great at coding, and I've really only done some java, but couldn't you do a batch file that would execute once a condition is reached?
Something like

Code: Select all

if(!downloadInProgress())
{
  Runtime.getRuntime().exec("cmd /c start shutdown.bat");
}
and then have a batch file that reads

Code: Select all

shutdown /s -t 60 -c "Deluge downloads finished"
, with the 60 seconds there to make sure the downloads finish, and if you have the extractor plugin, it could be useful too.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by Cas »

Sorry what is this related to? The plugin does shutdown when all torrents are finished.
GMY0da
New User
New User
Posts: 3
Joined: Fri Dec 05, 2014 11:23 pm

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by GMY0da »

Cas wrote:Sorry what is this related to? The plugin does shutdown when all torrents are finished.
I was just wondering if something like that is possible, rather than all of the lines that was written instead, I figure this is a more simple way to go about it.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by Cas »

Still don't understand what you are asking. The plugin has to determine if torrents are still downloading, provides more options than just shutdown and is cross-platform...
GMY0da
New User
New User
Posts: 3
Joined: Fri Dec 05, 2014 11:23 pm

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by GMY0da »

Cas wrote:Still don't understand what you are asking. The plugin has to determine if torrents are still downloading, provides more options than just shutdown and is cross-platform...
Ok, sorry. Just treat it as separate. I was just thinking in another way, yours is way better. I'm just trying to learn a bit of code, so I want to know if somehow, you can have it just run cmd/terminal commands, which sounds like it would be easier. Nevermind, and thanks for the cool plugin.
Odyseus

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by Odyseus »

Hello, everybody.

I recently started using Deluge and it has everything I'm looking for in a torrent client. Except for the auto-shutdown option, which I intended to add with this plugin.

Long story short, the plugin doesn't work (at least for me).

This is the console output when I launch Deluge:

Code: Select all

/usr/lib/python2.7/dist-packages/deluge/ui/gtkui/listview.py:250: GtkWarning: gtk_tree_model_sort_set_sort_column_id: assertion 'header != NULL' failed
  self.treeview.get_model().set_sort_column_id(column_state.sort, column_state.sort_order)
This is the console output when a torrent download finishes:

Code: Select all

[ERROR   ] 09:23:55 eventmanager:59 Event handler TorrentFinishedEvent failed in <bound method Core.on_event_torrent_finished of <autoshutdown.core.Core object at 0x7f9dc0165e90>> with exception org.freedesktop.DBus.Error.UnknownMethod: Method "Shutdown" with signature "" on interface "org.freedesktop.UPower" doesn't exist
And this is the console output when I quit Deluge:

Code: Select all

[ERROR   ] 09:24:19 init:57 Unable to disable plugin!
[ERROR   ] 09:24:19 init:58 deregister_event_handler() takes exactly 3 arguments (2 given)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/deluge/plugins/init.py", line 55, in disable
    self.plugin.disable()
  File "/home/MyUserName/.config/deluge/plugins/AutoShutdown-1.2-py2.7.egg/autoshutdown/core.py", line 108, in disable
    component.get("EventManager").deregister_event_handler(self.on_event_torrent_finished)
TypeError: deregister_event_handler() takes exactly 3 arguments (2 given)
My system is Linux Mint 17.1 x64 XFCE edition and I'm using Deluge from the official PPA. Deluge 1.3.11 and libtorrent 0.16.17.

Just for the sake of testing, I also tried it in a virtual machine with Linux Mint 17.1 x64 KDE edition using Deluge 1.3.6 (from Mint repositories) and AutoShutdown plugin doesn't work either. The console output is exactly the same, except for the part when Deluge starts. In the KDE system, there is no GtkWarning.

I have Hibernate and Suspend removed/deactivated in all my systems, so I cannot test that part of the plugin.

I'm using AutoShutdown-1.2-py2.7.egg. Although my system has 4 Python versions installed (2.6, 2.7, 3 and 3.4).

To work around this plugin not working, I "emulated" its functionality by activating the "Execute" plugin and adding a script with the command 'sudo shutdown -h now'. And to make it work without asking for password, I edited the sudoers file by adding this line 'ALL ALL=NOPASSWD: /sbin/shutdown'.

I would really like for the AutoShutdown plugin to work because (from what I can understand of its code) it can deactivate itself before shutting down the system. If I keep using the Execute plugin workaround, I'm 100% sure that I will forget that I have it activated and my system will shutdown in the middle of something important!! LOL

Thanks in advance.
mingle
New User
New User
Posts: 7
Joined: Mon Sep 17, 2012 6:50 am

Re: [Plugin] Autoshutdown - Shutdown PC once torrents comple

Post by mingle »

I have pretty much the same set-up as the previous poster, and also have had no luck in getting this plugin to work.

It simply doesn't shut down when downloads are complete.

Mike.
ekanshdeep_gupta
New User
New User
Posts: 3
Joined: Mon Aug 24, 2015 12:37 pm

Re: [Plugin] Autoshutdown - Plugin not working...

Post by ekanshdeep_gupta »

Code: Select all

/usr/lib/python2.7/dist-packages/deluge/ui/gtkui/gtkui.py:180: Warning: Attempt to add property GnomeProgram::sm-connect after class was initialised
  self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
/usr/lib/python2.7/dist-packages/deluge/ui/gtkui/gtkui.py:180: Warning: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised
  self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
/usr/lib/python2.7/dist-packages/deluge/ui/gtkui/gtkui.py:180: Warning: Attempt to add property GnomeProgram::display after class was initialised
  self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
/usr/lib/python2.7/dist-packages/deluge/ui/gtkui/gtkui.py:180: Warning: Attempt to add property GnomeProgram::default-icon after class was initialised
  self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())


[ERROR   ] 18:00:58 eventmanager:59 Event handler TorrentFinishedEvent failed in <bound method Core.on_event_torrent_finished of <autoshutdown.core.Core object at 0xa6d8576c>> with exception org.freedesktop.DBus.Error.UnknownMethod: Method "Shutdown" with signature "" on interface "org.freedesktop.UPower" doesn't exist


When I launch Deluge in Terminal, this is what I get... Help me make sense of it. The last two lines (following [ERROR]) are what appear when my torrents get completed and the plugin must come into effect. So obviously, this error must be responsible for the computer not turning off. I'm using Linux Mint Cinnamon, Deluge 1.3.6, and libtorrent 0.16.13.0 and python 2.7.6.

The version of the plugin I'm using is "AutoShutdown-1.2-py2.7". It is copied in the correct directory, and shows up in the Application. It's just that the Computer won't shutdown when the torrents all complete. I've copied the terminal output above... I think I've told everything relevant. Ask me if you need any more information to troubleshoot this. But help me. Its devastating as I'm a novice who's just recently moved on from Windows, where I didn't have to deal with any of this... HELP!
Post Reply