mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 23:37:59 +00:00
Fix wrong "added on" date
This only happens for magnet links when its metadata has yet to be retrieved. Closes #11124.
This commit is contained in:
parent
5c7f9530ee
commit
3a11c23efd
@ -2028,6 +2028,11 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
|
|||||||
p.upload_limit = params.uploadLimit;
|
p.upload_limit = params.uploadLimit;
|
||||||
p.download_limit = params.downloadLimit;
|
p.download_limit = params.downloadLimit;
|
||||||
|
|
||||||
|
#if (LIBTORRENT_VERSION_NUM >= 10200)
|
||||||
|
if (params.addedTime.isValid())
|
||||||
|
p.added_time = params.addedTime.toSecsSinceEpoch();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Preallocation mode
|
// Preallocation mode
|
||||||
p.storage_mode = isPreallocationEnabled()
|
p.storage_mode = isPreallocationEnabled()
|
||||||
? lt::storage_mode_allocate : lt::storage_mode_sparse;
|
? lt::storage_mode_allocate : lt::storage_mode_sparse;
|
||||||
@ -4464,6 +4469,10 @@ namespace
|
|||||||
torrentParams.firstLastPiecePriority = fast.dict_find_int_value("qBt-firstLastPiecePriority");
|
torrentParams.firstLastPiecePriority = fast.dict_find_int_value("qBt-firstLastPiecePriority");
|
||||||
torrentParams.sequential = fast.dict_find_int_value("qBt-sequential");
|
torrentParams.sequential = fast.dict_find_int_value("qBt-sequential");
|
||||||
|
|
||||||
|
const lt::bdecode_node addedTimeNode = fast.dict_find("qBt-addedTime");
|
||||||
|
if (addedTimeNode.type() == lt::bdecode_node::int_t)
|
||||||
|
torrentParams.addedTime = QDateTime::fromSecsSinceEpoch(addedTimeNode.int_value());
|
||||||
|
|
||||||
queuePos = fast.dict_find_int_value("qBt-queuePosition");
|
queuePos = fast.dict_find_int_value("qBt-queuePosition");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QBitArray>
|
#include <QBitArray>
|
||||||
#include <QDateTime>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -1775,6 +1774,8 @@ void TorrentHandle::handleSaveResumeDataAlert(const lt::save_resume_data_alert *
|
|||||||
// restored if qBittorrent quits before the metadata are retrieved:
|
// restored if qBittorrent quits before the metadata are retrieved:
|
||||||
resumeData["qBt-firstLastPiecePriority"] = hasFirstLastPiecePriority();
|
resumeData["qBt-firstLastPiecePriority"] = hasFirstLastPiecePriority();
|
||||||
resumeData["qBt-sequential"] = isSequentialDownload();
|
resumeData["qBt-sequential"] = isSequentialDownload();
|
||||||
|
|
||||||
|
resumeData["qBt-addedTime"] = addedTime().toSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const auto savePath = resumeData.find_key("save_path")->string();
|
const auto savePath = resumeData.find_key("save_path")->string();
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <libtorrent/torrent_handle.hpp>
|
#include <libtorrent/torrent_handle.hpp>
|
||||||
#include <libtorrent/torrent_status.hpp>
|
#include <libtorrent/torrent_status.hpp>
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQueue>
|
#include <QQueue>
|
||||||
@ -83,6 +84,7 @@ namespace BitTorrent
|
|||||||
int downloadLimit;
|
int downloadLimit;
|
||||||
// for new torrents
|
// for new torrents
|
||||||
QVector<DownloadPriority> filePriorities;
|
QVector<DownloadPriority> filePriorities;
|
||||||
|
QDateTime addedTime;
|
||||||
// for restored torrents
|
// for restored torrents
|
||||||
qreal ratioLimit;
|
qreal ratioLimit;
|
||||||
int seedingTimeLimit;
|
int seedingTimeLimit;
|
||||||
|
Loading…
Reference in New Issue
Block a user