|
|
|
@ -97,6 +97,14 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
@@ -97,6 +97,14 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
|
|
|
|
return (ratio > BitTorrent::Torrent::MAX_RATIO) ? -1 : ratio; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const auto getLastActivityTime = [&torrent]() -> qlonglong |
|
|
|
|
{ |
|
|
|
|
const qlonglong timeSinceActivity = torrent.timeSinceActivity(); |
|
|
|
|
return (timeSinceActivity < 0) |
|
|
|
|
? torrent.addedTime().toSecsSinceEpoch() |
|
|
|
|
: (QDateTime::currentDateTime().toSecsSinceEpoch() - timeSinceActivity); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
{KEY_TORRENT_ID, torrent.id().toString()}, |
|
|
|
|
{KEY_TORRENT_INFOHASHV1, torrent.infoHash().v1().toString()}, |
|
|
|
@ -145,7 +153,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
@@ -145,7 +153,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, (QDateTime::currentDateTime().toSecsSinceEpoch() - torrent.timeSinceActivity())}, |
|
|
|
|
{KEY_TORRENT_LAST_ACTIVITY_TIME, getLastActivityTime()}, |
|
|
|
|
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()}, |
|
|
|
|
|
|
|
|
|
{KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()} |
|
|
|
|