Trying to run a .bat file when torrent completes

Specific support for Deluge on Microsoft Windows OS
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

Enabled debug logging

[DEBUG ] 07:36:17 gtkui:136 on_get_commands: [[u'c3355dc186388de27016fd1d3af5ea19a44474e3', u'complete', u'd:\\7zip_unpack_deluge_test.bat']]
[DEBUG ] 07:36:17 gtkui:98 Adding command `c3355dc186388de27016fd1d3af5ea19a44474e3`

[DEBUG ] 07:36:20 preferences:861 on_button_ok_clicked
[WARNING ] 07:36:20 common:574 ipv6 check unavailable on windows
[DEBUG ] 07:36:20 pluginmanager:112 run_on_apply_prefs
[DEBUG ] 07:36:20 config:423 Saving new config file C:\Users\Andreas\AppData\Roaming\deluge\execute.conf.new
[DEBUG ] 07:36:20 config:436 Backing up old config file to C:\Users\Andreas\AppData\Roaming\deluge\execute.conf~
[DEBUG ] 07:36:20 config:444 Moving new config file C:\Users\Andreas\AppData\Roaming\deluge\execute.conf.new to C:\Users\Andreas\AppData\Roaming\deluge\execute.conf..
[DEBUG ] 07:36:20 config:216 Setting 'listen_ports' to [45157, 45257] of <type 'list'>
[DEBUG ] 07:36:20 config:216 Setting 'outgoing_ports' to [0, 0] of <type 'list'>
[DEBUG ] 07:36:20 preferencesmanager:253 listen port range set to 45157-45257
[DEBUG ] 07:36:20 rpcserver:466 intevents: {}
[DEBUG ] 07:36:20 rpcserver:466 intevents: {}

[DEBUG ] 07:36:25 config:423 Saving new config file C:\Users\Andreas\AppData\Roaming\deluge\core.conf.new
[DEBUG ] 07:36:25 config:436 Backing up old config file to C:\Users\Andreas\AppData\Roaming\deluge\core.conf~
[DEBUG ] 07:36:25 config:444 Moving new config file C:\Users\Andreas\AppData\Roaming\deluge\core.conf.new to C:\Users\Andreas\AppData\Roaming\deluge\core.conf..
[DEBUG ] 07:36:25 addtorrentdialog:584 _on_button_file_clicked
[DEBUG ] 07:36:25 configmanager:111 Getting config 'gtkui.conf'
[DEBUG ] 07:36:28 addtorrentdialog:210 Adding torrent from file: xxxx (<type 'str'>)
[DEBUG ] 07:36:28 common:68 Attempting to open D:\torrents\xxxx.torrent.
[DEBUG ] 07:36:36 addtorrentdialog:776 _on_button_add_clicked
[DEBUG ] 07:36:36 torrentmanager:334 torrentmanager.add
[DEBUG ] 07:36:36 configmanager:111 Getting config 'core.conf'
[DEBUG ] 07:36:36 torrentmanager:448 options: {'max_download_speed': -1.0, 'auto_managed': True, 'move_completed_path': 'C:\\Users\\Andreas\\Downloads', 'stop_at_ratio': False, 'prioritize_first_last_pieces': False, 'max_upload_slots': -1, 'file_priorities': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'move_completed': False, 'max_connections': -1, 'add_paused': False, 'download_location': 'D:\\_tv', 'mapped_files': {}, 'compact_allocation': True, 'max_upload_speed': -1.0, 'remove_at_ratio': False, 'stop_ratio': 2.0}
[DEBUG ] 07:36:36 torrentmanager:482 handle id: 0e6f1516fdc26f4e3d05e0568bef695395723e9e
[DEBUG ] 07:36:36 torrent:105 Creating torrent object 0e6f1516fdc26f4e3d05e0568bef695395723e9e
[DEBUG ] 07:36:36 configmanager:111 Getting config 'core.conf'
[DEBUG ] 07:36:36 configmanager:111 Getting config 'core.conf'
[DEBUG ] 07:36:36 torrent:301 setting file priority with compact allocation does not work!
[DEBUG ] 07:36:36 torrent:381 set_state_based_on_ltstate: Queued
[DEBUG ] 07:36:36 torrent:382 session.is_paused: False
[DEBUG ] 07:36:36 torrent:212 Torrent object created.
[DEBUG ] 07:36:36 alertmanager:123 torrent_added_alert: xxxx added
[DEBUG ] 07:36:36 alertmanager:123 state_changed_alert: xxxx: state changed to: checking (q)
[DEBUG ] 07:36:36 torrentmanager:707 Saving torrent state file.
[DEBUG ] 07:36:36 rpcserver:466 intevents: {}
[INFO ] 07:36:36 torrentmanager:531 Torrent xxxx added by user:
[DEBUG ] 07:36:36 torrentmanager:1060 on_alert_state_changed
[DEBUG ] 07:36:36 torrent:381 set_state_based_on_ltstate: Checking
[DEBUG ] 07:36:36 torrent:382 session.is_paused: False
[DEBUG ] 07:36:36 rpcserver:466 intevents: {}
[DEBUG ] 07:36:36 alertmanager:123 state_changed_alert: xxxx: state changed to: checking
[DEBUG ] 07:36:36 alertmanager:123 torrent_resumed_alert: xxxx resumed
[DEBUG ] 07:36:36 torrentmanager:1060 on_alert_state_changed
[DEBUG ] 07:36:36 torrent:381 set_state_based_on_ltstate: Checking
[DEBUG ] 07:36:36 torrent:382 session.is_paused: False
[DEBUG ] 07:36:36 torrentmanager:1046 on_alert_torrent_resumed
[DEBUG ] 07:36:36 torrent:381 set_state_based_on_ltstate: Checking
[DEBUG ] 07:36:36 torrent:382 session.is_paused: False
[DEBUG ] 07:36:36 rpcserver:466 intevents: {}
[DEBUG ] 07:36:51 alertmanager:123 state_changed_alert: xxxx: state changed to: downloading
[DEBUG ] 07:36:51 alertmanager:123 torrent_checked_alert: xxxx checked
[DEBUG ] 07:36:51 alertmanager:123 torrent_finished_alert: xxxx torrent finished downloading
[DEBUG ] 07:36:51 alertmanager:123 state_changed_alert: xxxx: state changed to: finished
[DEBUG ] 07:36:51 alertmanager:123 state_changed_alert: xxxx: state changed to: seeding
[DEBUG ] 07:36:51 alertmanager:123 tracker_announce_alert: xxxx (http://tracker.xxxx/announce) sending announce (started)
[DEBUG ] 07:36:51 alertmanager:123 tracker_reply_alert: xxxx (http://tracker.xxxx/announce) received peers: 21
[DEBUG ] 07:36:51 torrentmanager:1060 on_alert_state_changed
[DEBUG ] 07:36:51 torrent:381 set_state_based_on_ltstate: Seeding
[DEBUG ] 07:36:51 torrent:382 session.is_paused: False
[DEBUG ] 07:36:51 rpcserver:466 intevents: {}
[DEBUG ] 07:36:51 torrentmanager:954 on_alert_torrent_checked
[DEBUG ] 07:36:51 torrent:381 set_state_based_on_ltstate: Seeding
[DEBUG ] 07:36:51 torrent:382 session.is_paused: False
[DEBUG ] 07:36:51 torrentmanager:891 on_alert_torrent_finished
[DEBUG ] 07:36:51 torrentmanager:897 0e6f1516fdc26f4e3d05e0568bef695395723e9e is finished..
[DEBUG ] 07:36:51 torrent:381 set_state_based_on_ltstate: Seeding
[DEBUG ] 07:36:51 torrent:382 session.is_paused: False
[DEBUG ] 07:36:51 torrentmanager:1060 on_alert_state_changed
[DEBUG ] 07:36:51 torrent:381 set_state_based_on_ltstate: Seeding
[DEBUG ] 07:36:51 torrent:382 session.is_paused: False
[DEBUG ] 07:36:51 torrentmanager:1060 on_alert_state_changed
[DEBUG ] 07:36:51 torrent:381 set_state_based_on_ltstate: Seeding
[DEBUG ] 07:36:51 torrent:382 session.is_paused: False
[DEBUG ] 07:36:51 torrentmanager:988 on_alert_tracker_announce
[DEBUG ] 07:36:51 torrentmanager:971 on_alert_tracker_reply: xxxx (http://tracker.xxxx/announce) received peers: 21
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

Not sure if this helps any?

[DEBUG ] 07:53:12 pluginmanager:104 run_on_show_prefs
[DEBUG ] 07:53:12 rpcserver:395 Registering method: execute.add_command
[DEBUG ] 07:53:12 rpcserver:395 Registering method: execute.get_commands
[DEBUG ] 07:53:12 rpcserver:395 Registering method: execute.remove_command
[DEBUG ] 07:53:12 rpcserver:395 Registering method: execute.save_command
[DEBUG ] 07:53:12 pluginbase:57 CorePlugin initialized..
[DEBUG ] 07:53:12 configmanager:111 Getting config 'execute.conf'
[DEBUG ] 07:53:12 config:197 Setting 'commands' to [] of <type 'list'>
[DEBUG ] 07:53:12 config:391 Config C:\Users\Andreas\AppData\Roaming\deluge\execute.conf version: 1.1 loaded: {'commands': [[u'c3355dc186388de27016fd1d3af5ea19a44474e3', u'complete', u'd:\\7zip_unpack_deluge_test.bat']]}
[DEBUG ] 07:53:12 core:105 Execute core plugin enabled!
[INFO ] 07:53:12 pluginmanagerbase:158 Plugin Execute enabled..
[DEBUG ] 07:53:12 rpcserver:466 intevents: {}
[DEBUG ] 07:53:12 pluginbase:62 GtkPlugin initialized..
[DEBUG ] 07:53:12 gtkui:63 Adding Execute Preferences page
[DEBUG ] 07:53:12 gtkui:136 on_get_commands: [[u'c3355dc186388de27016fd1d3af5ea19a44474e3', u'complete', u'd:\\7zip_unpack_deluge_test.bat']]
[DEBUG ] 07:53:12 gtkui:98 Adding command `c3355dc186388de27016fd1d3af5ea19a44474e3`
[DEBUG ] 07:53:12 pluginmanagerbase:156 Adding Execute to enabled_plugins list in config
[INFO ] 07:53:12 pluginmanagerbase:158 Plugin Execute enabled..
[DEBUG ] 07:53:12 pluginmanager:104 run_on_show_prefs
[DEBUG ] 07:53:12 gtkui:136 on_get_commands: [[u'c3355dc186388de27016fd1d3af5ea19a44474e3', u'complete', u'd:\\7zip_unpack_deluge_test.bat']]
[DEBUG ] 07:53:12 gtkui:98 Adding command `c3355dc186388de27016fd1d3af5ea19a44474e3`
[DEBUG ] 07:53:12 configmanager:111 Getting config 'core.conf'
[DEBUG ] 07:53:12 torrentmanager:634 Opening torrent state file for load.
[WARNING ] 07:53:12 torrentmanager:650 Unable to update state file to a compatible version: list index out of range
[DEBUG ] 07:53:12 torrentmanager:747 Opening torrents fastresume file for load.
[DEBUG ] 07:53:12 rpcserver:466 intevents: {}
[DEBUG ] 07:53:12 alertmanager:123 listen_succeeded_alert: successfully listening on 0.0.0.0:45157
[DEBUG ] 07:53:12 alertmanager:123 listen_succeeded_alert: successfully listening on 0.0.0.0:4433
[DEBUG ] 07:53:12 alertmanager:123 listen_succeeded_alert: successfully listening on [::]:45157
[DEBUG ] 07:53:12 alertmanager:123 listen_succeeded_alert: successfully listening on [::]:4433
[DEBUG ] 07:53:12 alertmanager:123 external_ip_alert: external IP received: 109.228.175.18
[DEBUG ] 07:53:12 pluginmanager:88 Core has these plugins enabled: [u'Execute', u'YaRSS2']
[WARNING ] 07:53:12 pluginmanagerbase:134 Cannot enable already enabled plugin Execute
[WARNING ] 07:53:12 pluginmanagerbase:134 Cannot enable already enabled plugin YaRSS2

Is this normal?

[DEBUG ] 07:53:12 torrentmanager:634 Opening torrent state file for load.
[WARNING ] 07:53:12 torrentmanager:650 Unable to update state file to a compatible version: list index out of range
Cas
Top Bloke
Top Bloke
Posts: 3681
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Trying to run a .bat file when torrent completes

Post by Cas »

From the logs it shows you are not adding a new torrent but a torrent with existing data so the Finished event would never fire for that. To test the script please use the Added execute event.
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

Cas wrote:From the logs it shows you are not adding a new torrent but a torrent with existing data so the Finished event would never fire for that. To test the script please use the Added execute event.
Great, now we're getting somewhere :) I should have mentioned that ofc before... cheers.
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

[DEBUG ] 11:12:40 gtkui:164 Adding command added: d:\7zip_unpack_deluge_test.bat
[DEBUG ] 11:12:40 gtkui:98 Adding command `31d1d6d35ae84a381e329c760570b84585e202ea`
[DEBUG ] 11:12:42 preferences:866 on_button_apply_clicked
[WARNING ] 11:12:42 common:574 ipv6 check unavailable on windows
[DEBUG ] 11:12:42 pluginmanager:112 run_on_apply_prefs
[DEBUG ] 11:12:42 config:423 Saving new config file C:\Users\Andreas\AppData\Roaming\deluge\execute.conf.new
[DEBUG ] 11:12:42 config:436 Backing up old config file to C:\Users\Andreas\AppData\Roaming\deluge\execute.conf~
[DEBUG ] 11:12:42 config:444 Moving new config file C:\Users\Andreas\AppData\Roaming\deluge\execute.conf.new to C:\Users\Andreas\AppData\Roaming\deluge\execute.conf..
[DEBUG ] 11:12:42 config:423 Saving new config file C:\Users\Andreas\AppData\Roaming\deluge\execute.conf.new
[DEBUG ] 11:12:42 config:436 Backing up old config file to C:\Users\Andreas\AppData\Roaming\deluge\execute.conf~
[DEBUG ] 11:12:42 config:444 Moving new config file C:\Users\Andreas\AppData\Roaming\deluge\execute.conf.new to C:\Users\Andreas\AppData\Roaming\deluge\execute.conf..
[DEBUG ] 11:12:42 config:216 Setting 'listen_ports' to [45157, 45257] of <type 'list'>
[DEBUG ] 11:12:42 config:216 Setting 'outgoing_ports' to [0, 0] of <type 'list'>
[DEBUG ] 11:12:42 pluginmanager:104 run_on_show_prefs
[DEBUG ] 11:12:42 gtkui:136 on_get_commands: [('c3355dc186388de27016fd1d3af5ea19a44474e3', 'complete', 'd:\\7zip_unpack_deluge_test.bat'), ('31d1d6d35ae84a381e329c760570b84585e202ea', 'added', 'd:\\7zip_unpack_deluge_test.bat')]
[DEBUG ] 11:12:42 gtkui:98 Adding command `c3355dc186388de27016fd1d3af5ea19a44474e3`
[DEBUG ] 11:12:42 gtkui:98 Adding command `31d1d6d35ae84a381e329c760570b84585e202ea`

And after that no mentions of the bat file or the command "ID" 31d1d6d35ae84a381e329c760570b84585e202ea
I can see in the log where I added the torrent but after it's been added etc, finished and all that, there's no mention of the bat or the command "ID".

Any more ideas? Cheers.
naturaldisasta

Re: Trying to run a .bat file when torrent completes

Post by naturaldisasta »

Hi - to make the batch file work, copy it to the program folder where you installed Deluge. In my example, you just need to copy the .bat file to C:\Program Files (x86)\Deluge.

To run the batch file, you just type the name, as in "batch.bat" but without the quotes.

Hope this helps.. I was playing with it tonight myself after it wouldn't work. Figured from the .conf file that everything is relative to the location of the installation folder and went from there. I haven't bothered trying to make it change paths or subfolders - I figured its working fine where it is :)
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

naturaldisasta wrote:Hi - to make the batch file work, copy it to the program folder where you installed Deluge. In my example, you just need to copy the .bat file to C:\Program Files (x86)\Deluge.

To run the batch file, you just type the name, as in "batch.bat" but without the quotes.

Hope this helps.. I was playing with it tonight myself after it wouldn't work. Figured from the .conf file that everything is relative to the location of the installation folder and went from there. I haven't bothered trying to make it change paths or subfolders - I figured its working fine where it is :)
Hi there!

Thanks, but already tried that also, doesn't work sadly.
Nothing runs.

Cheers for trying!
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

Dude, I tried it again, now I'm getting output! You're a lifesaver! :))))
ambreswe
Member
Member
Posts: 21
Joined: Wed Aug 13, 2014 10:50 pm

Re: Trying to run a .bat file when torrent completes

Post by ambreswe »

So the script HAS to be in the Program files folder apparently, at least for win8.1.
Thanks guys :)
Post Reply