@@ -69,13 +69,15 @@ pub enum TorrentListFilter {
6969 Ongoing ,
7070 Stuck ,
7171 Unmanaged ,
72+ Ok ,
7273}
7374
7475impl TorrentListFilter {
7576 pub fn filter_torrent_list ( & self , list : TorrentList ) -> Vec < Torrent > {
7677 let mut list: Vec < Torrent > = match self {
7778 Self :: Everything => list. into_iter ( ) . collect ( ) ,
7879 Self :: Ongoing => list. into_iter ( ) . filter ( is_torrent_ongoing) . collect ( ) ,
80+ Self :: Ok => list. into_iter ( ) . filter ( is_torrent_ok) . collect ( ) ,
7981 Self :: Stuck => list. into_iter ( ) . filter ( is_torrent_stuck) . collect ( ) ,
8082 Self :: Unmanaged => list. into_iter ( ) . filter ( is_torrent_unmanaged) . collect ( ) ,
8183 } ;
@@ -98,6 +100,8 @@ pub struct TorrentListCounter {
98100 /// Torrents not known to TorrentManager.
99101 // TODO: this is actually not implemented yet
100102 pub unmanaged : u32 ,
103+ /// Torrent successfully downloaded
104+ pub ok : u32 ,
101105}
102106
103107impl TorrentListCounter {
@@ -122,6 +126,11 @@ impl TorrentListCounter {
122126 continue ;
123127 }
124128
129+ if is_torrent_ok ( torrent) {
130+ counter. ok += 1 ;
131+ continue ;
132+ }
133+
125134 // Otherwise, the torrent is simply seeding,
126135 // and we simply don't care.
127136 }
@@ -136,6 +145,12 @@ pub fn is_torrent_unmanaged(_t: &Torrent) -> bool {
136145 false
137146}
138147
148+ /// Check if torrent hasn't finished (progress < 100%)
149+ /// and is less than 24h hours.
150+ pub fn is_torrent_ok ( t : & Torrent ) -> bool {
151+ t. progress == 100
152+ }
153+
139154/// Check if torrent hasn't finished (progress < 100%)
140155/// and is less than 24h hours.
141156pub fn is_torrent_ongoing ( t : & Torrent ) -> bool {
0 commit comments