From 06db5776ae4420f87d8b88a3531471fd8bd961c1 Mon Sep 17 00:00:00 2001 From: Micdu70 Date: Thu, 5 Nov 2015 18:41:27 +0100 Subject: [PATCH] Save downloaded stat of each torrent --- src/core/download_factory.cc | 3 +++ src/core/download_store.cc | 1 + 2 files changed, 4 insertions(+) diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 6105a27d..f19a4812 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -418,6 +418,9 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre if (rtorrent->has_key_value("total_uploaded")) download->info()->mutable_up_rate()->set_total(rtorrent->get_key_value("total_uploaded")); + if (rtorrent->has_key_value("total_downloaded")) + download->info()->mutable_dl_rate()->set_total(rtorrent->get_key_value("total_downloaded")); + if (rtorrent->has_key_value("chunks_done") && rtorrent->has_key_value("chunks_wanted")) download->download()->set_chunks_done(rtorrent->get_key_value("chunks_done"), rtorrent->get_key_value("chunks_wanted")); diff --git a/src/core/download_store.cc b/src/core/download_store.cc index 4364c1d4..a85dca96 100644 --- a/src/core/download_store.cc +++ b/src/core/download_store.cc @@ -140,6 +140,7 @@ DownloadStore::save(Download* d, int flags) { rtorrent_base->insert_key("chunks_done", d->download()->file_list()->completed_chunks()); rtorrent_base->insert_key("chunks_wanted", d->download()->data()->wanted_chunks()); rtorrent_base->insert_key("total_uploaded", d->info()->up_rate()->total()); + rtorrent_base->insert_key("total_downloaded", d->info()->dl_rate()->total()); // Don't save for completed torrents when we've cleared the uncertain_pieces. torrent::resume_save_progress(*d->download(), *resume_base);