Page 2 of 2

Re: Batch change tracker URL for torrents

Posted: Mon Mar 27, 2017 9:53 pm
by marteenzh
Found something that works well in Mac OS.

Code: Select all

perl -pi -w -e 's/THIS/THAT/g;' /path/to/files*.txt

Referenced from ... mand-line/

Re: Batch change tracker URL for torrents

Posted: Sun Oct 04, 2020 8:31 pm
by stogie bear

Sorry for the necrobump but hoping someone might be able to help me get this script to work.

So far as I can tell the reason it wont work is because I dont use the standard 'program files' install location for deluge. My copy of deluge is installed to D:\Deluge_Daemon and D:\Internet\Deluge.

The script works up until i confirm i want to proceed with the operation then I get this error
Traceback (most recent call last):
File "", line 39, in <module>
state = cPickle.load(state_file)
ImportError: No module named deluge.core.torrentmanager

I don't know anything about python or programming and despite my best efforts this has me stumped.

Re: Batch change tracker URL for torrents

Posted: Mon Oct 05, 2020 12:23 pm
by shamael
Hi stogie bear,

Under Linux I published the solution I use many times per year now here
It's mainly a stop of all Deluges's services and file search&replace operation on the file torrents.state located in your profile.

You seems to be under Windows, I propose below generic info/how_to.

The config file are in your user profile, a user profile is accessible with variable.
File to edit: torrents.state
Location of the file: %APPDATA%\deluge\state\

Copy this location in Windows explorer to confirm you see the file, check the date. If this is the right file the date should be recent.

Change proposal
I don't have a Deluge under Windows right now so cannot properly test tracker swap. I'll rely on Notepad++ for this part for this reason
Mainly the script only create a backup copy prior you change it, just in case...P

- stop all Deluge services, confirm with the task manager
- open a Powershell prompt and past blow line to create a backup of your deluge folder located in %APPDATA%

Code: Select all

#Create Deluge profile backup
$SOURCE = "$env:appdata\deluge"
$BACKUP = "$env:appdata\deluge.backup"
New-Item -ItemType "directory" -Path $BACKUP -force | out-null
Copy-Item -R -Path $SOURCE -Destination $BACKUP -force

- open Notepad++ and edit the file %APPDATA%\deluge\state\torrents.state by replacing the URL
- start Deluge and check

If you have anything wrong stop Deluge again and recover the files from the backup.

Re: Batch change tracker URL for torrents

Posted: Tue Oct 06, 2020 9:55 pm
by stogie bear
Thanks shamael! I never realised the state file was in an editable format. Something went wrong the first time I tried but I used the backup and tried again and it works as expected now, no way i was going to manually change 125 torrents :lol:.