|
|
@ -2215,18 +2215,25 @@ lt::torrent_handle TorrentImpl::nativeHandle() const |
|
|
|
return m_nativeHandle; |
|
|
|
return m_nativeHandle; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool TorrentImpl::setMetadata(const TorrentInfo &torrentInfo) |
|
|
|
void TorrentImpl::setMetadata(const TorrentInfo &torrentInfo) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (hasMetadata()) |
|
|
|
if (hasMetadata()) |
|
|
|
return false; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_session->invokeAsync([nativeHandle = m_nativeHandle, torrentInfo] |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
#ifdef QBT_USES_LIBTORRENT2 |
|
|
|
#ifdef QBT_USES_LIBTORRENT2 |
|
|
|
return m_nativeHandle.set_metadata(torrentInfo.nativeInfo()->info_section()); |
|
|
|
nativeHandle.set_metadata(torrentInfo.nativeInfo()->info_section()); |
|
|
|
#else |
|
|
|
#else |
|
|
|
const std::shared_ptr<lt::torrent_info> nativeInfo = torrentInfo.nativeInfo(); |
|
|
|
const std::shared_ptr<lt::torrent_info> nativeInfo = torrentInfo.nativeInfo(); |
|
|
|
return m_nativeHandle.set_metadata(lt::span<const char>(nativeInfo->metadata().get(), nativeInfo->metadata_size())); |
|
|
|
nativeHandle.set_metadata(lt::span<const char>(nativeInfo->metadata().get(), nativeInfo->metadata_size())); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (const std::exception &) {} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Torrent::StopCondition TorrentImpl::stopCondition() const |
|
|
|
Torrent::StopCondition TorrentImpl::stopCondition() const |
|
|
|
{ |
|
|
|
{ |
|
|
|