Beispiel #1
0
void Application::torrentFinished(BitTorrent::TorrentHandle *const torrent)
{
    Preferences *const pref = Preferences::instance();

    // AutoRun program
    if (pref->isAutoRunEnabled()) {
        QString program = pref->getAutoRunProgram();
        int file_count = torrent->filesCount();

        program.replace("%N", torrent->name());
        program.replace("%F", (file_count > 1) ? "" : torrent->fileName(0));
        program.replace("%L", torrent->label());
        program.replace("%D", Utils::Fs::toNativePath(torrent->rootPath()));
        program.replace("%K", (file_count > 1) ? "multi" : "single");
        program.replace("%C", QString::number(torrent->filesCount()));
        program.replace("%Z", QString::number(torrent->totalSize()));
        program.replace("%T", torrent->currentTracker());
        program.replace("%I", torrent->hash());

        QProcess::startDetached(program);
    }

    // Mail notification
    if (pref->isMailNotificationEnabled())
        sendNotificationEmail(torrent);
}
void Application::torrentFinished(BitTorrent::TorrentHandle *const torrent)
{
    Preferences *const pref = Preferences::instance();

    // AutoRun program
    if (pref->isAutoRunEnabled())
        runExternalProgram(torrent);

    // Mail notification
    if (pref->isMailNotificationEnabled()) {
        Logger::instance()->addMessage(tr("Torrent: %1, sending mail notification").arg(torrent->name()));
        sendNotificationEmail(torrent);
    }
}
Beispiel #3
0
void Application::torrentFinished(BitTorrent::TorrentHandle *const torrent)
{
    Preferences *const pref = Preferences::instance();

    // AutoRun program
    if (pref->isAutoRunEnabled()) {
        QString program = pref->getAutoRunProgram().trimmed();
        // Replace %f by torrent path
        program.replace("%f", torrent->savePathParsed());
        // Replace %n by torrent name
        program.replace("%n", torrent->name());
        QProcess::startDetached(program);
    }

    // Mail notification
    if (pref->isMailNotificationEnabled())
        sendNotificationEmail(torrent);
}