|
|
@ -37,6 +37,7 @@ |
|
|
|
#include <libtorrent/create_torrent.hpp> |
|
|
|
#include <libtorrent/create_torrent.hpp> |
|
|
|
#include <libtorrent/storage.hpp> |
|
|
|
#include <libtorrent/storage.hpp> |
|
|
|
#include <libtorrent/torrent_info.hpp> |
|
|
|
#include <libtorrent/torrent_info.hpp> |
|
|
|
|
|
|
|
#include <libtorrent/version.hpp> |
|
|
|
|
|
|
|
|
|
|
|
#include <QDirIterator> |
|
|
|
#include <QDirIterator> |
|
|
|
#include <QFile> |
|
|
|
#include <QFile> |
|
|
@ -133,8 +134,13 @@ void TorrentCreatorThread::run() |
|
|
|
|
|
|
|
|
|
|
|
if (isInterruptionRequested()) return; |
|
|
|
if (isInterruptionRequested()) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100 |
|
|
|
|
|
|
|
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1 |
|
|
|
|
|
|
|
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize : 0)); |
|
|
|
|
|
|
|
#else |
|
|
|
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1 |
|
|
|
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1 |
|
|
|
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0)); |
|
|
|
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0)); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Add url seeds
|
|
|
|
// Add url seeds
|
|
|
|
foreach (QString seed, m_params.urlSeeds) { |
|
|
|
foreach (QString seed, m_params.urlSeeds) { |
|
|
@ -204,6 +210,12 @@ int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const i |
|
|
|
|
|
|
|
|
|
|
|
libt::file_storage fs; |
|
|
|
libt::file_storage fs; |
|
|
|
libt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter); |
|
|
|
libt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100 |
|
|
|
|
|
|
|
return libt::create_torrent(fs, pieceSize, -1 |
|
|
|
|
|
|
|
, (isAlignmentOptimized ? libt::create_torrent::optimize : 0)).num_pieces(); |
|
|
|
|
|
|
|
#else |
|
|
|
return libt::create_torrent(fs, pieceSize, -1 |
|
|
|
return libt::create_torrent(fs, pieceSize, -1 |
|
|
|
, (isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0)).num_pieces(); |
|
|
|
, (isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0)).num_pieces(); |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|