Batch tracker url change option

Feature requests not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
m0ngk
Posts: 1
Joined: Fri Feb 20, 2015 9:37 pm

Batch tracker url change option

Post by m0ngk » Fri Feb 20, 2015 9:39 pm

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.

fulalas
Posts: 2
Joined: Tue Apr 21, 2015 2:21 am

Re: Batch tracker url change option

Post by fulalas » Tue Apr 21, 2015 2:29 am

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

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."));
    }
}
Please, could someone review and commit this code?

Thanks!

x190
Posts: 5094
Joined: Sun Nov 30, 2008 4:59 am

Re: Batch tracker url change option

Post by x190 » Tue Apr 21, 2015 6:12 pm

multiple number of torrents at once
The stone age didn’t end because we ran out of stones.
---The Great Disruption - by Paul Gilding
https://paulgilding.com/
-------------------------------------------------

x190
Posts: 5094
Joined: Sun Nov 30, 2008 4:59 am

Re: Batch tracker url change option

Post by x190 » Tue Apr 21, 2015 6:13 pm

The stone age didn’t end because we ran out of stones.
---The Great Disruption - by Paul Gilding
https://paulgilding.com/
-------------------------------------------------

killemov
Posts: 413
Joined: Sat Jul 31, 2010 5:04 pm

Re: Batch tracker url change option

Post by killemov » Tue Apr 21, 2015 7:55 pm

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.

captain
Posts: 5
Joined: Sun Dec 27, 2009 8:24 pm

Re: Batch tracker url change option

Post by captain » Wed Dec 05, 2018 6:00 am

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.

Post Reply