Ejemplo n.º 1
0
//! translate handle status to P2Pstatus
P2P::FileStatus TorrentWrapper::getP2PStatusFromHandle( const libtorrent::torrent_handle& handle ) const
{
	if ( !handle.is_valid() )
		return P2P::not_stored;
	if ( handle.is_seed() )
		return P2P::complete;
	if ( handle.is_paused() )
		return P2P::paused;
	if ( handle.queue_position() > m_torr->settings().active_downloads )
		return P2P::queued;
	return P2P::leeching;
}
Ejemplo n.º 2
0
void SeedManager::addTorrent(QString torrent) {
    QSettings s(settingsPath + torrent, QSettings::IniFormat);
    QByteArray data = s.value("data").toByteArray();
    libtorrent::entry e = libtorrent::bdecode(data.begin(), data.end());
    libtorrent::torrent_info *inf = new libtorrent::torrent_info(e);
    const libtorrent::torrent_handle h =
            session->add_torrent(inf, s.value("path").toString().toStdString(), e);

    h.set_upload_mode(true);
    h.auto_managed(false);
    if (h.is_paused())
        h.resume();

    torrentNames[h.name()] = torrent;
}