From 045be4a502ee47af2fd900d7443eef48ce8dd446 Mon Sep 17 00:00:00 2001 From: moritsbw-cpu Date: Tue, 17 Nov 2026 13:07:12 +0000 Subject: [PATCH] Spotify collector: slow down for the development-mode quota Co-Authored-By: Claude Opus 5.5 --- src/main.rs | 5 +++-- src/spotify_api.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6bdef14..e826d07 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,8 +135,9 @@ fn collect(db: &db::Db, args: &[String], db_path: &str) -> Result<()> { } if wants("spotify-api") { // Spotify Web API: artists' release dates (needs /root/.spotify-credentials). - let lim = arg(args, "--limit").and_then(|l| l.parse().ok()).unwrap_or(if backfill { usize::MAX } else { 500 }); - let r = spotify_api::collect(db, lim, if backfill { 0 } else { 1200 }, &mut log); + // Development-mode apps get a small daily quota (a 24-hour block after ~150 quick requests): go slow. + let lim = arg(args, "--limit").and_then(|l| l.parse().ok()).unwrap_or(if backfill { usize::MAX } else { 60 }); + let r = spotify_api::collect(db, lim, if backfill { 0 } else { 60 }, &mut log); step("spotify releases (web api)", r.map(|n| format!("{n} artists looked up")), &mut log); } if wants("playlists") { diff --git a/src/spotify_api.rs b/src/spotify_api.rs index 2585b5a..e339d38 100644 --- a/src/spotify_api.rs +++ b/src/spotify_api.rs @@ -108,7 +108,7 @@ fn urlencode(s: &str) -> String { /// Map DR artists to Spotify artists, then read each one's releases. Returns artists done. pub fn collect(db: &Db, limit: usize, refresh: usize, log: &mut Vec) -> Result { create_tables(db)?; - let mut api = Api::new(120)?; + let mut api = Api::new(1000)?; // Today's pool first (with the DR page's Spotify link where there is one), then archive-only artists. let todo: Vec<(String, String, Option)> = db.conn.prepare( "SELECT a.artist_id, a.name, l.spotify_artist_id, 0 FROM dr_artists a LEFT JOIN nmf_artist_lookups l ON l.dr_artist_id = a.artist_id