implement files counter

This commit is contained in:
yggverse 2025-08-05 19:49:58 +03:00
parent 5c167f4852
commit 11a398e90c
2 changed files with 9 additions and 3 deletions

View file

@ -43,6 +43,7 @@ fn index(
indexed: String,
magnet: String,
size: String,
files: String,
torrent: Torrent,
}
let (total, torrents) = storage
@ -68,6 +69,10 @@ fn index(
indexed: torrent.time.format(&meta.format_time).to_string(),
magnet: format::magnet(&torrent.info_hash, meta.trackers.as_ref()),
size: format::bytes(torrent.size),
files: torrent.files.as_ref().map_or("1 file".into(), |f| {
let l = f.len();
format!("{l} {}", l.plurify(&["file", "files", "files"]))
}),
torrent,
})
.collect::<Vec<Row>>(),