Hi, I use the Mac version but this would be great on any version.
It would be nice to be able to change the tracker url of a multiple number of torrents at once, if the need arose. As of now, I have to manually change it for individual ones and that could get very tedious very quickly.
Batch tracker url change option
Re: Batch tracker url change option
If I understand you correctly, you want to add more than one tracker at once, right?
I wrote the code for this for Transmission-Qt. I'm considering the uTorrent pattern (i.e. one URL per line; although we can further improve by considering space as a separator too), like this: https://torrentz.eu/announcelist_95514573
Please, could someone review and commit this code?
Thanks!
I wrote the code for this for Transmission-Qt. I'm considering the uTorrent pattern (i.e. one URL per line; although we can further improve by considering space as a separator too), like this: https://torrentz.eu/announcelist_95514573
Code: Select all
void
Details :: onAddTrackerClicked ()
{
bool ok = false;
const QString url = QInputDialog::getText (this,
tr ("Add URL "),
tr ("Add tracker announce URL:"),
QLineEdit::Normal, QString (), &ok);
if (!ok)
{
// user pressed "cancel" -- noop
return;
}
if(url.trimmed().isEmpty())
{
QMessageBox::information (this, tr ("Empty tracker"), tr ("The tracker can't be empty."));
return;
}
bool invalidTrackerFound = false;
QStringList urlList;
if(url.contains("\n"))
{
while(url.contains("\n\n"))
url.replace("\n\n", "\n");
urlList = url.split("\n", QString::SkipEmptyParts);
urlList.removeDuplicates();
}
else
urlList.append(url);
foreach(QString currentUrl, urlList)
{
if (!QUrl (currentUrl).isValid ())
{
invalidTrackerFound = true;
continue;
}
QSet<int> ids;
foreach (int id, myIds)
if (myTrackerModel->find (id, currentUrl) == -1)
ids.insert (id);
if (ids.empty ()) // all the torrents already have this tracker
{
invalidTrackerFound = true;
continue;
}
QStringList urls;
urls << currentUrl;
mySession.torrentSet (ids, TR_KEY_trackerAdd, urls);
getNewData ();
}
if(invalidTrackerFound)
{
if(urlList.length() == 1 )
QMessageBox::information (this, tr ("Invalid tracker"), tr ("The tracker already exists or is invalid."));
else
QMessageBox::information (this, tr ("Invalid trackers"), tr ("Not all trackers were added because some of them already exist or are invalid."));
}
}
Thanks!
Re: Batch tracker url change option
Shift can add a batch of trackers to all torrents. Go to Session/Shift. Paste a bunch of urls in the textarea and click "Add to all torrents." Note that this process is JavaScript-driven so the Shift page needs to stay loaded during this process.
Re: Batch tracker url change option
I once had a script to do exactly this, but it's long gone, and I can't recall all the details of Transmission's workings to recreate it. It is possible though! I thought that by now Transmission would have implemented Bulk Tracker Name Changing.