A decentralized music tracking and discovery platform built on AT Protocol 🎵 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
98
fork

Configure Feed

Select the types of activity you want to include in your feed.

[scrobbler] make listened_at optional

+6 -3
+1 -1
crates/scrobbler/src/listenbrainz/submit.rs
··· 14 14 pool: &Arc<sqlx::Pool<sqlx::Postgres>>, 15 15 token: &str 16 16 ) -> Result<HttpResponse, Error> { 17 - if payload.listen_type != "single" { 17 + if payload.listen_type != "playing_now" { 18 18 println!("skipping listen type: {}", payload.listen_type.cyan()); 19 19 return Ok(HttpResponse::Ok().json( 20 20 json!({
+1 -1
crates/scrobbler/src/listenbrainz/types.rs
··· 24 24 #[derive(Deserialize, Debug, Clone)] 25 25 pub struct ListenPayload { 26 26 pub track_metadata: TrackMetadata, 27 - pub listened_at: u64, 27 + pub listened_at: Option<u64>, 28 28 } 29 29 30 30 #[derive(Deserialize, Debug, Clone)]
+4 -1
crates/scrobbler/src/scrobbler.rs
··· 382 382 383 383 let artist = req.payload[0].track_metadata.artist_name.clone(); 384 384 let track = req.payload[0].track_metadata.track_name.clone(); 385 - let timestamp = req.payload[0].listened_at.to_string(); 385 + let timestamp = match req.payload[0].listened_at { 386 + Some(timestamp) => timestamp.to_string(), 387 + None => chrono::Utc::now().timestamp().to_string(), 388 + }; 386 389 387 390 let claims = decode_token(token)?; 388 391 let did = claims.did.clone();