/** * Returns the web seeds for a torrent in JSON format. * * The return value is a JSON-formatted list of dictionaries. * The dictionary keys are: * - "url": Web seed URL */ QByteArray btjson::getWebSeedsForTorrent(const QString& hash) { CACHED_VARIABLE_FOR_HASH(QVariantList, webSeedList, CACHE_DURATION_MS, hash); QTorrentHandle torrent = QBtSession::instance()->getTorrentHandle(hash); if (!torrent.is_valid()) { qWarning() << Q_FUNC_INFO << "Invalid torrent " << qPrintable(hash); return QByteArray(); } foreach (const QString &webseed, torrent.url_seeds()) { QVariantMap webSeedDict; webSeedDict[KEY_WEBSEED_URL] = webseed; webSeedList.append(webSeedDict); } return json::toJson(webSeedList); }