|
|
|
@ -95,13 +95,6 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
@@ -95,13 +95,6 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
|
|
|
|
return (ratio > BitTorrent::Torrent::MAX_RATIO) ? -1 : ratio; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const auto adjustLastActivity = [&torrent](const qlonglong value) -> qlonglong |
|
|
|
|
{ |
|
|
|
|
return (torrent.isPaused() || torrent.isChecking()) |
|
|
|
|
? 0 |
|
|
|
|
: (QDateTime::currentDateTime().toSecsSinceEpoch() - value); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
// TODO: Add fields for real SHA1 and SHA256 hashes
|
|
|
|
|
{KEY_TORRENT_ID, QString(torrent.id().toString())}, |
|
|
|
@ -149,7 +142,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
@@ -149,7 +142,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
|
|
|
|
{KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()}, |
|
|
|
|
{KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()}, |
|
|
|
|
{KEY_TORRENT_SEEDING_TIME, torrent.seedingTime()}, |
|
|
|
|
{KEY_TORRENT_LAST_ACTIVITY_TIME, adjustLastActivity(torrent.timeSinceActivity())}, |
|
|
|
|
{KEY_TORRENT_LAST_ACTIVITY_TIME, (QDateTime::currentDateTime().toSecsSinceEpoch() - torrent.timeSinceActivity())}, |
|
|
|
|
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()}, |
|
|
|
|
|
|
|
|
|
{KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()} |
|
|
|
|