···11use actix_web::{post, web, HttpResponse, Responder};
22use serde_json::json;
33use std::collections::BTreeMap;
44+use crate::musicbrainz::client::MusicbrainzClient;
45use crate::signature::generate_signature;
56use crate::models::Scrobble;
77+use crate::spotify::client::SpotifyClient;
6879fn parse_batch(form: &BTreeMap<String, String>) -> Vec<Scrobble> {
810 let mut result = vec![];
···7779 }
78807981 // You can now save these scrobbles to your database here.
8282+ let client = MusicbrainzClient::new();
8383+ // let result = client.get_recording("47fb34da-5d07-4772-8cdb-af352699ee67").await;
8484+ let result = client.search(r#"
8585+ recording:"Don't stay" AND artist:"Linkin Park"
8686+ "#).await;
8787+ println!("Musicbrainz result: {:#?}", result);
8888+8989+ /*
9090+ let client = SpotifyClient::new("BQDhXOoiiSNCmmOKFvtvpuT3gwXJGOdXvjpkfb4JTc8GPLhNOhLrgy_tAVA7i8c3VipA4mbQfwvc9rAGDaNyzpVw26SXtQXFMNw_na2VRAeBXMcHMqrJ-Cfg4XQoLzAvQwX8RkuRAKtaBpMSFtwiHYHeYj2GybiqinRZ8ZDNRzIn3GvoYQjcYqfEKR39iNHtlToDPkdPxO1caZh8DDc2VltMLxOUyNs8po_OLpp6-7WgED3_CmHEbOfdc_DD4-btRcsmvri8O58lOioxBgCgrKx0Ww-xq7oNk0-mdDJcUat805Fuh2PHRIoWK2rOLtbVAtU8PnpfLzUbbiejxBfXubl5J3EST7tB9N_OkVz8ZQs92tp-QQk");
9191+ let results = match client.search("track:one more time artist:daft punk").await {
9292+ Ok(res) => res,
9393+ Err(e) => {
9494+ return HttpResponse::InternalServerError().json(json!({
9595+ "error": 9,
9696+ "message": format!("Internal server error: {}", e)
9797+ }));
9898+ }
9999+ };
100100+101101+ println!("Search results: {:?}", results);
102102+ */
8010381104 let response = json!({
82105 "scrobbles": {
+4
crates/scrobbler/src/main.rs
···11pub mod handlers;
22pub mod models;
33pub mod signature;
44+pub mod musicbrainz;
55+pub mod spotify;
66+pub mod xata;
77+pub mod cache;
4859use std::env;
610