Spotify playlists: New Music Friday Denmark and Top 50 Denmark snapshots (embed page), New Music Friday history since 2022 per ISRC (SuperFridayChart)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-2
@@ -1,6 +1,6 @@
|
||||
//! airplay: collects what Danish radio stations play, for modelling when artists get played again.
|
||||
//!
|
||||
//! airplay collect [--db data/airplay.db] [--days 7] [--all-bauer] [--only dr|bauer|hitlisten|deezer|musicbrainz|spotify] [--backfill]
|
||||
//! airplay collect [--db data/airplay.db] [--days 7] [--all-bauer] [--only dr|bauer|hitlisten|deezer|musicbrainz|spotify|playlists|nmf] [--backfill]
|
||||
//! airplay stats [--db data/airplay.db]
|
||||
//! airplay check [--db data/airplay.db] gaps, duplicates, DR cross-check, chart completeness
|
||||
//!
|
||||
@@ -15,6 +15,7 @@ mod dr;
|
||||
mod hitlisten;
|
||||
mod http;
|
||||
mod musicbrainz;
|
||||
mod playlists;
|
||||
mod spotify;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -37,7 +38,7 @@ fn main() -> Result<()> {
|
||||
Some("stats") => stats(&db),
|
||||
Some("check") => check::run(&db),
|
||||
_ => {
|
||||
eprintln!("usage: airplay collect [--db FILE] [--days 7] [--all-bauer] [--only dr|bauer|hitlisten|deezer|musicbrainz|spotify] [--backfill]\n airplay stats [--db FILE]\n airplay check [--db FILE]");
|
||||
eprintln!("usage: airplay collect [--db FILE] [--days 7] [--all-bauer] [--only dr|bauer|hitlisten|deezer|musicbrainz|spotify|playlists|nmf] [--backfill]\n airplay stats [--db FILE]\n airplay check [--db FILE]");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
@@ -99,6 +100,15 @@ fn collect(db: &db::Db, args: &[String], db_path: &str) -> Result<()> {
|
||||
let r = spotify::collect(db, &kworb_http, arg(args, "--limit").and_then(|l| l.parse().ok()).unwrap_or(if backfill { usize::MAX } else { 400 }), &mut log);
|
||||
step("spotify chart history (kworb)", r.map(|(l, p)| format!("{l} songs listed, {p} histories read")), &mut log);
|
||||
}
|
||||
if wants("playlists") {
|
||||
let r = playlists::snapshot(db, &http, &mut log);
|
||||
step("spotify playlists (New Music Friday DK, Top 50 DK)", r.map(|n| format!("{n} changed and saved")), &mut log);
|
||||
}
|
||||
if wants("nmf") {
|
||||
let sfc_http = http::Http::new(1000)?;
|
||||
let r = playlists::nmf_history(db, &sfc_http, arg(args, "--limit").and_then(|l| l.parse().ok()).unwrap_or(if backfill { usize::MAX } else { 1500 }), &mut log);
|
||||
step("new music friday history (superfridaychart)", r.map(|n| format!("{n} ISRCs looked up")), &mut log);
|
||||
}
|
||||
if wants("hitlisten") {
|
||||
let r = hitlisten::collect(db, &http, if backfill { usize::MAX } else { 60 }, &mut log);
|
||||
step("hitlisten airplay chart", r.map(|n| format!("{n} weeks fetched")), &mut log);
|
||||
@@ -145,6 +155,12 @@ fn stats(db: &db::Db) -> Result<()> {
|
||||
(SELECT min(date) FROM spotify_chart_history WHERE country = 'DK' AND chart = 'daily')", [],
|
||||
|r| Ok((r.get(0)?, r.get(1)?, r.get(2)?, r.get(3)?)))?;
|
||||
println!("Spotify Denmark: {sp_tracks} songs that charted, {sp_read} histories read, {sp_rows} DK chart rows (daily from {})", sp_from.unwrap_or_default());
|
||||
playlists::create_tables(db)?;
|
||||
let (snaps, nmf_isrcs, nmf_dk, nmf_from): (i64, i64, i64, Option<String>) = db.conn.query_row(
|
||||
"SELECT (SELECT count(DISTINCT playlist_id || taken_at) FROM playlist_snapshots), (SELECT count(*) FROM nmf_lookups),
|
||||
(SELECT count(*) FROM nmf_additions WHERE country = 'Denmark'), (SELECT min(friday) FROM nmf_additions)", [],
|
||||
|r| Ok((r.get(0)?, r.get(1)?, r.get(2)?, r.get(3)?)))?;
|
||||
println!("Playlists: {snaps} snapshots; New Music Friday history: {nmf_isrcs} songs looked up, {nmf_dk} Denmark additions (since {})", nmf_from.unwrap_or_default());
|
||||
musicbrainz::create_tables(db)?;
|
||||
let (mb, mb_known): (i64, i64) = db.conn.query_row(
|
||||
"SELECT count(*), count(*) FILTER (WHERE recordings > 0) FROM mb_isrc", [], |r| Ok((r.get(0)?, r.get(1)?)))?;
|
||||
|
||||
Reference in New Issue
Block a user