mrmena

Run Program not triggering on state change

Recommended Posts

I have a python script running on torrent state change.  Not all state changes will trigger the script.

Windows 10 Home

uTorrent Version: 3.5.5 (build 46020) [32-bit]

Helper 2.0.18.1499

Options -> Preferences -> Advanced -> Run Program -> Run this program when a torrent changes state:

pythonw c:\users\mrmena\scripts\torrent_state_change.py "%N" "%F" "%S" "%K"

Steps to reproduce:

1 - Add torrent using magnet link

2 - Allow torrent to download to completion (seeding)

3 - Observe only 3 state changes detected by the python script (below): Checked, Queued, Connecting To Peers

I am unable to get any further state changes.  I would ideally like to trigger a transcoding operation when the torrent reaches the seeding state but the state change is not triggered.

My python script is as follows:

import sys
from win32ui import MessageBox
name=sys.argv[1]
filename=sys.argv[2]
state=int(sys.argv[3])
kind=sys.argv[4]

states={
	1: "Error",
	2: "Checked",
	3: "Paused",
	4: "Super seeding",
	5: "Seeding",
	6: "Downloading",
	7: "Super seed [F]",
	8: "Seeding [F]",
	9: "Downloading [F]",
	10: "Queued seed",
	11: "Finished",
	12: "Queued",
	13: "Stopped",
	17: "Preallocating",
	18: "Downloading Metadata",
	19: "Connecting to Peers",
	20: "Moving",
	21: "Flushing",
	22: "Need DHT",
	23: "Finding Peers",
	24: "Resolving",
	25: "Writing"
}
if state in states:
	state_name = states[state]
else:
	state_name = f"Unknown state: {int(state)}"

MessageBox(f"Name: {name}\nFilename: {filename}\nState: {state_name}\nKind: {kind}", "Torrent Status Change")

I've had a look online for a solution but haven't found anything specific or recent.

Is there something I'm missing or are there any suggestions on what I might try next?

Thanks for your help

 

Share this post


Link to post
Share on other sites

I know one thing - "run on download completion" - works, and this is exactly when seeding starts. Use this, it's simplest...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.