Skip to content

Commit

Permalink
Print slightly more useful recent tracks list
Browse files Browse the repository at this point in the history
  • Loading branch information
ruuda committed Nov 11, 2023
1 parent a438bd0 commit 8460449
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/playcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,10 @@ pub fn main(index: &MemoryMetaIndex, db_path: &Path) -> crate::Result<()> {
}

for timescale in 0..5 {
let (top_artists, top_albums, top_tracks) = counter.get_top(timescale, 50);
println!("\nTOP ARTISTS (timescale {})\n", timescale);
let n_days = ExpCounter::HALF_LIFE_EPOCHS[timescale] * 0.1896;

let (top_artists, top_albums, top_tracks) = counter.get_top(timescale, 200);
println!("\nTOP ARTISTS (timescale {}, {:.0} days)\n", timescale, n_days);

for (i, (count, artist_id)) in top_artists.iter().enumerate() {
let artist = index.get_artist(*artist_id).unwrap();
Expand All @@ -487,7 +489,7 @@ pub fn main(index: &MemoryMetaIndex, db_path: &Path) -> crate::Result<()> {
println!(" {:2} {:7.3} {} {}", i + 1, count.0, artist_id, artist_name);
}

println!("\nTOP ALBUMS (timescale {})\n", timescale);
println!("\nTOP ALBUMS (timescale {}, {:.0} days)\n", timescale, n_days);

for (i, (count, album_id)) in top_albums.iter().enumerate() {
let album = index.get_album(*album_id).unwrap();
Expand All @@ -497,7 +499,7 @@ pub fn main(index: &MemoryMetaIndex, db_path: &Path) -> crate::Result<()> {
println!(" {:2} {:7.3} {} {:25} {}", i + 1, count.0, album_id, album_title, album_artist);
}

println!("\nTOP TRACKS (timescale {})\n", timescale);
println!("\nTOP TRACKS (timescale {}, {:.0} days)\n", timescale, n_days);

for (i, (count, track_id)) in top_tracks.iter().enumerate() {
let track = index.get_track(*track_id).unwrap();
Expand Down

0 comments on commit 8460449

Please sign in to comment.