mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +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.download_limit = params.downloadLimit;
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 10200)
|
||||
if (params.addedTime.isValid())
|
||||
p.added_time = params.addedTime.toSecsSinceEpoch();
|
||||
#endif
|
||||
|
||||
// Preallocation mode
|
||||
p.storage_mode = isPreallocationEnabled()
|
||||
? lt::storage_mode_allocate : lt::storage_mode_sparse;
|
||||
@ -4464,6 +4469,10 @@ namespace
|
||||
torrentParams.firstLastPiecePriority = fast.dict_find_int_value("qBt-firstLastPiecePriority");
|
||||
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");
|
||||
|
||||
return true;
|
||||
|
@ -50,7 +50,6 @@
|
||||
#endif
|
||||
|
||||
#include <QBitArray>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@ -1775,6 +1774,8 @@ void TorrentHandle::handleSaveResumeDataAlert(const lt::save_resume_data_alert *
|
||||
// restored if qBittorrent quits before the metadata are retrieved:
|
||||
resumeData["qBt-firstLastPiecePriority"] = hasFirstLastPiecePriority();
|
||||
resumeData["qBt-sequential"] = isSequentialDownload();
|
||||
|
||||
resumeData["qBt-addedTime"] = addedTime().toSecsSinceEpoch();
|
||||
}
|
||||
else {
|
||||
const auto savePath = resumeData.find_key("save_path")->string();
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <libtorrent/torrent_status.hpp>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
@ -83,6 +84,7 @@ namespace BitTorrent
|
||||
int downloadLimit;
|
||||
// for new torrents
|
||||
QVector<DownloadPriority> filePriorities;
|
||||
QDateTime addedTime;
|
||||
// for restored torrents
|
||||
qreal ratioLimit;
|
||||
int seedingTimeLimit;
|
||||
|
Loading…
Reference in New Issue
Block a user