Opened 6 years ago

Last modified 6 years ago

#5770 new Enhancement

Add Magnetlink to available environment variables

Reported by: basecase Owned by:
Priority: Normal Milestone: None Set
Component: Transmission Version: 2.84
Severity: Normal Keywords: scripts
Cc:

Description

This should be an easy one. Add the magnetlink of a completed torrent to the available variables for post-completion scripts. The option is already there in the context menu. Ideally, I would modify the context menu entry to simple copy a text file into the torrent directory with the magnetlink. Say the magnet link in a flat [NameofTorrent?].magnetlink file. This would allow for better reseeding. In an automated fashion

Attachments (4)

transmission.h (69.5 KB) - added by basecase 6 years ago.
Modified Transmission.h
torrent-magnet.h (979 bytes) - added by basecase 6 years ago.
Modifed torrent-magnet.h
torrent-magnet.c (12.2 KB) - added by basecase 6 years ago.
Modified torrent-magnet.c
magnet-Environment-Variable.patch (593 bytes) - added by basecase 6 years ago.
Patch to add magnetLINK to post download environment variables

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by basecase

Modified Transmission.h

Changed 6 years ago by basecase

Modifed torrent-magnet.h

Changed 6 years ago by basecase

Modified torrent-magnet.c

comment:1 Changed 6 years ago by basecase

Last edited 6 years ago by basecase (previous) (diff)

Changed 6 years ago by basecase

Patch to add magnetLINK to post download environment variables

comment:2 Changed 6 years ago by basecase

So I did this the easy way and just made the magnetLINK an environment variable. Patch attached.

## To add the Magnetlink to environment variables

add this line

## tr_strdup_printf ("TR_TORRENT_MAGNETLINK=%s", tr_tr_torrentGetMagnetLink(tor)),

to the torrent.c file in libtransmission line 2117

comment:3 Changed 6 years ago by basecase

Well, if the patch is not accepted then one can get the same functionality from this line:

magnetLINK=$(transmission-remote -t $TR_TORRENT_ID -i | grep "Magnet:" | sed -r 's/^.{10}//')
Note: See TracTickets for help on using tickets.