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: add more tests
tsiry-sandratraina.com
7 months ago
534e5bd8
ac67fd06
+81
1 changed file
expand all
collapse all
unified
split
crates
webscrobbler
src
types.rs
+81
crates/webscrobbler/src/types.rs
···
791
791
let result = serde_json::from_str::<ScrobbleRequest>(json);
792
792
assert!(result.is_ok(), "Failed to parse JSON: {:?}", result.err());
793
793
}
794
794
+
795
795
+
#[test]
796
796
+
fn test_deezer_scrobble_request() {
797
797
+
let json = r#"
798
798
+
{
799
799
+
"eventName": "nowplaying",
800
800
+
"time": 1747899797294,
801
801
+
"data": {
802
802
+
"song": {
803
803
+
"parsed": {
804
804
+
"track": "Exile Is A Habit",
805
805
+
"artist": "Fox Stevenson",
806
806
+
"albumArtist": null,
807
807
+
"album": "Sunk Cost Fallacy",
808
808
+
"duration": 261,
809
809
+
"uniqueID": "3382194151",
810
810
+
"currentTime": null,
811
811
+
"isPlaying": true,
812
812
+
"trackArt": "https://cdn-images.dzcdn.net/images/cover/f8f25df28395fcc1b036982ad1475737/500x500.jpg",
813
813
+
"isPodcast": false,
814
814
+
"originUrl": "https://www.deezer.com/en/album/761728451",
815
815
+
"scrobblingDisallowedReason": null
816
816
+
},
817
817
+
"processed": {
818
818
+
"track": "Exile Is A Habit",
819
819
+
"artist": "Fox Stevenson",
820
820
+
"albumArtist": null,
821
821
+
"album": "Sunk Cost Fallacy",
822
822
+
"duration": 258
823
823
+
},
824
824
+
"noRegex": {
825
825
+
"track": "Exile Is A Habit",
826
826
+
"artist": "Fox Stevenson",
827
827
+
"albumArtist": null,
828
828
+
"album": "Sunk Cost Fallacy",
829
829
+
"duration": null
830
830
+
},
831
831
+
"flags": {
832
832
+
"isScrobbled": false,
833
833
+
"isCorrectedByUser": false,
834
834
+
"isRegexEditedByUser": {
835
835
+
"track": false,
836
836
+
"artist": false,
837
837
+
"album": false,
838
838
+
"albumArtist": false
839
839
+
},
840
840
+
"isAlbumFetched": false,
841
841
+
"isValid": true,
842
842
+
"isMarkedAsPlaying": false,
843
843
+
"isSkipped": false,
844
844
+
"isReplaying": false,
845
845
+
"hasBlockedTag": false,
846
846
+
"isLovedInService": null,
847
847
+
"finishedProcessing": true
848
848
+
},
849
849
+
"metadata": {
850
850
+
"startTimestamp": 1754673593,
851
851
+
"label": "Deezer",
852
852
+
"trackArtUrl": "https://lastfm.freetls.fastly.net/i/u/300x300/b3eee782a80469085b2105fc63f0e534.png",
853
853
+
"artistUrl": "https://www.last.fm/music/Fox+Stevenson",
854
854
+
"trackUrl": "https://www.last.fm/music/Fox+Stevenson/_/Exile+Is+A+Habit",
855
855
+
"albumUrl": "https://www.last.fm/music/Fox+Stevenson/Exile+Is+A+Habit",
856
856
+
"userPlayCount": 0
857
857
+
},
858
858
+
"connector": {
859
859
+
"label": "Deezer",
860
860
+
"matches": [
861
861
+
"*://www.deezer.com/*"
862
862
+
],
863
863
+
"js": "deezer.js",
864
864
+
"id": "deezer"
865
865
+
},
866
866
+
"controllerTabId": 2105807456
867
867
+
}
868
868
+
}
869
869
+
}
870
870
+
"#;
871
871
+
872
872
+
let result = serde_json::from_str::<ScrobbleRequest>(json);
873
873
+
assert!(result.is_ok(), "Failed to parse JSON: {:?}", result.err());
874
874
+
}
794
875
}