tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
[webscrobbler] make duration optional
tsiry-sandratraina.com
9 months ago
c344142d
9e11c0d8
+83
-1
1 changed file
expand all
collapse all
unified
split
crates
webscrobbler
src
types.rs
+83
-1
crates/webscrobbler/src/types.rs
···
64
64
pub album_artist: Option<String>,
65
65
pub artist: String,
66
66
pub current_time: Option<u32>,
67
67
-
pub duration: u32,
67
67
+
pub duration: Option<u32>,
68
68
pub is_playing: bool,
69
69
pub is_podcast: bool,
70
70
pub origin_url: Option<String>,
···
708
708
query,
709
709
r#"track:"Let It Talk To Me" artist:"Sean Paul" artist:"INNA""#
710
710
);
711
711
+
}
712
712
+
713
713
+
#[test]
714
714
+
fn test_kexp_scrobble_request() {
715
715
+
let json = r#"
716
716
+
{
717
717
+
"eventName": "nowplaying",
718
718
+
"time": 1749848844651,
719
719
+
"data": {
720
720
+
"song": {
721
721
+
"parsed": {
722
722
+
"track": "ENERGY",
723
723
+
"artist": "Disclosure",
724
724
+
"albumArtist": null,
725
725
+
"album": "ENERGY",
726
726
+
"duration": null,
727
727
+
"uniqueID": null,
728
728
+
"currentTime": null,
729
729
+
"isPlaying": true,
730
730
+
"trackArt": "https://ia803209.us.archive.org/7/items/mbid-6f1db1e3-71b3-4524-b0fe-c1e29f361dfe/mbid-6f1db1e3-71b3-4524-b0fe-c1e29f361dfe-26365923265_thumb250.jpg",
731
731
+
"isPodcast": false,
732
732
+
"originUrl": "https://www.kexp.org/",
733
733
+
"scrobblingDisallowedReason": null
734
734
+
},
735
735
+
"processed": {
736
736
+
"track": "ENERGY",
737
737
+
"artist": "Disclosure",
738
738
+
"albumArtist": null,
739
739
+
"album": "ENERGY",
740
740
+
"duration": null
741
741
+
},
742
742
+
"noRegex": {
743
743
+
"track": "ENERGY",
744
744
+
"artist": "Disclosure",
745
745
+
"albumArtist": null,
746
746
+
"album": "ENERGY",
747
747
+
"duration": null
748
748
+
},
749
749
+
"flags": {
750
750
+
"isScrobbled": false,
751
751
+
"isCorrectedByUser": false,
752
752
+
"isRegexEditedByUser": {
753
753
+
"track": false,
754
754
+
"artist": false,
755
755
+
"album": false,
756
756
+
"albumArtist": false
757
757
+
},
758
758
+
"isAlbumFetched": false,
759
759
+
"isValid": true,
760
760
+
"isMarkedAsPlaying": true,
761
761
+
"isSkipped": false,
762
762
+
"isReplaying": true,
763
763
+
"hasBlockedTag": false,
764
764
+
"isLovedInService": null,
765
765
+
"finishedProcessing": true
766
766
+
},
767
767
+
"metadata": {
768
768
+
"userloved": false,
769
769
+
"startTimestamp": 1749848842,
770
770
+
"label": "KEXP",
771
771
+
"trackArtUrl": "https://lastfm.freetls.fastly.net/i/u/300x300/a18f5dadcc38ad3d264e74ce51d9cf08.png",
772
772
+
"artistUrl": "https://www.last.fm/music/Disclosure",
773
773
+
"trackUrl": "https://www.last.fm/music/Disclosure/_/ENERGY",
774
774
+
"albumUrl": "https://www.last.fm/music/Various+Artists/Festival+Dance",
775
775
+
"userPlayCount": 0
776
776
+
},
777
777
+
"connector": {
778
778
+
"label": "KEXP",
779
779
+
"matches": [
780
780
+
"*://*.kexp.org/*"
781
781
+
],
782
782
+
"js": "kexp.js",
783
783
+
"id": "kexp"
784
784
+
},
785
785
+
"controllerTabId": 943739308
786
786
+
}
787
787
+
}
788
788
+
}
789
789
+
"#;
790
790
+
791
791
+
let result = serde_json::from_str::<ScrobbleRequest>(json);
792
792
+
assert!(result.is_ok(), "Failed to parse JSON: {:?}", result.err());
711
793
}
712
794
}