Browse Source

Provide torrent paths to external program.

adaptive-webui-19844
Vladimir Golovnev (Glassez) 9 years ago
parent
commit
c38987fc03
  1. 5
      src/app/application.cpp
  2. 4
      src/gui/options_imp.cpp

5
src/app/application.cpp

@ -142,13 +142,12 @@ void Application::torrentFinished(BitTorrent::TorrentHandle *const torrent)
// AutoRun program // AutoRun program
if (pref->isAutoRunEnabled()) { if (pref->isAutoRunEnabled()) {
QString program = pref->getAutoRunProgram(); QString program = pref->getAutoRunProgram();
int fileCount = torrent->filesCount();
program.replace("%N", torrent->name()); program.replace("%N", torrent->name());
program.replace("%F", (fileCount > 1) ? "" : torrent->fileName(0));
program.replace("%L", torrent->label()); program.replace("%L", torrent->label());
program.replace("%F", Utils::Fs::toNativePath(torrent->contentPath()));
program.replace("%R", Utils::Fs::toNativePath(torrent->rootPath()));
program.replace("%D", Utils::Fs::toNativePath(torrent->savePath())); program.replace("%D", Utils::Fs::toNativePath(torrent->savePath()));
program.replace("%K", (fileCount > 1) ? "multi" : "single");
program.replace("%C", QString::number(torrent->filesCount())); program.replace("%C", QString::number(torrent->filesCount()));
program.replace("%Z", QString::number(torrent->totalSize())); program.replace("%Z", QString::number(torrent->totalSize()));
program.replace("%T", torrent->currentTracker()); program.replace("%T", torrent->currentTracker());

4
src/gui/options_imp.cpp

@ -184,10 +184,10 @@ options_imp::options_imp(QWidget *parent)
autoRun_param->setText(QString::fromUtf8("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10") autoRun_param->setText(QString::fromUtf8("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10")
.arg(tr("Supported parameters (case sensitive):")) .arg(tr("Supported parameters (case sensitive):"))
.arg(tr("%N: Torrent name")) .arg(tr("%N: Torrent name"))
.arg(tr("%F: Downloaded file name (single-file torrent only)"))
.arg(tr("%L: Label")) .arg(tr("%L: Label"))
.arg(tr("%F: Content path (same as root path for multifile torrent)"))
.arg(tr("%R: Root path (first torrent subdirectory path)"))
.arg(tr("%D: Save path")) .arg(tr("%D: Save path"))
.arg(tr("%K: \"single\"|\"multi\" file(s)"))
.arg(tr("%C: Number of files")) .arg(tr("%C: Number of files"))
.arg(tr("%Z: Torrent size (bytes)")) .arg(tr("%Z: Torrent size (bytes)"))
.arg(tr("%T: Current tracker")) .arg(tr("%T: Current tracker"))

Loading…
Cancel
Save