@@ -13,6 +13,7 @@ use lofty::ItemValue;
1313use lofty:: TaggedFileExt ;
1414use tracing:: debug;
1515use tracing:: error;
16+ use tracing:: info;
1617use tracing:: trace;
1718use url_encoded_data:: UrlEncodedData ;
1819use windows:: core:: PCSTR ;
@@ -54,7 +55,7 @@ unsafe fn songfilestream_hook(
5455 let tagged_file = match lofty:: read_from_path ( file_path) {
5556 Ok ( res) => res,
5657 Err ( e) => {
57- debug ! ( "lofty::read_from_path failed {:?}" , e) ;
58+ error ! ( "lofty::read_from_path failed {:?}" , e) ;
5859 return call_original ! ( mem, file, offset, length, flags) ;
5960 }
6061 } ;
@@ -67,14 +68,30 @@ unsafe fn songfilestream_hook(
6768 ItemValue :: Text ( mbid) => {
6869 let mut global_data = state:: GLOBAL_DATA . lock ( ) . unwrap ( ) ;
6970 global_data. current_mbid = Some ( mbid. to_string ( ) ) ;
70- debug ! ( "Recording MBID tag found: {:?}" , mbid) ;
71+ info ! ( "Recording MBID tag found: {:?}" , mbid) ;
7172 }
7273 _ => {
7374 error ! ( "Recording MBID tag is an invalid data type...?" ) ;
7475 }
7576 } ,
7677 _ => {
77- debug ! ( "File has no MBID tag" ) ;
78+ debug ! ( "File has no recording MBID" ) ;
79+ }
80+ } ;
81+
82+ match tag. get ( & ItemKey :: MusicBrainzReleaseId ) {
83+ Some ( item) => match item. value ( ) {
84+ ItemValue :: Text ( mbid) => {
85+ let mut global_data = state:: GLOBAL_DATA . lock ( ) . unwrap ( ) ;
86+ global_data. current_release_mbid = Some ( mbid. to_string ( ) ) ;
87+ info ! ( "Release MBID tag found: {:?}" , mbid) ;
88+ }
89+ _ => {
90+ error ! ( "Release MBID tag is an invalid data type...?" ) ;
91+ }
92+ } ,
93+ _ => {
94+ debug ! ( "File has no release MBID" ) ;
7895 }
7996 } ;
8097 }
@@ -137,7 +154,9 @@ unsafe fn send_hook(
137154 debug ! ( "Ticket found in data: {:?}" , ticket) ;
138155 }
139156
140- if url. ends_with ( "/as_steamlogin/game_AttemptLoginSteamVerified.php" ) {
157+ if url. ends_with ( "/as_steamlogin/game_AttemptLoginSteamVerified.php" )
158+ || url. ends_with ( "//as_steamlogin/game_CustomNews.php" )
159+ {
141160 data. set_one ( "wvbrclientversion" , env ! ( "CARGO_PKG_VERSION" ) ) ;
142161 let new_data_string = data. to_string_of_original_order ( ) ;
143162
@@ -172,6 +191,12 @@ unsafe fn send_hook(
172191 && global_data. current_mbid . is_some ( )
173192 {
174193 data. set_one ( "mbid" , global_data. current_mbid . as_ref ( ) . unwrap ( ) ) ;
194+ if global_data. current_release_mbid . is_some ( ) {
195+ data. set_one (
196+ "releasembid" ,
197+ global_data. current_release_mbid . as_ref ( ) . unwrap ( ) ,
198+ ) ;
199+ }
175200 let new_data_string = data. to_string_of_original_order ( ) ;
176201 debug ! ( "New score submission form data: {:?}" , new_data_string) ;
177202
@@ -255,13 +280,14 @@ unsafe fn openrequest_hook(
255280 }
256281 debug ! ( "new OpenRequest flags: {:?}" , flags) ;
257282
258- // reset current_mbid when a new song is loaded
283+ // reset MBIDs when a new song is loaded
259284 // a bit hacky, but we have to do this so we don't submit an old ID when someone starts playing a Radio song
260285 // Radio mode songs are loaded via memory so trying to see what file it loads the song from won't work
261286 // We could just look at the song it loaded into memory, but the MBID doesn't matter for Radio songs anyway
262287 if object_name. to_string ( ) . unwrap ( ) == "/as_steamlogin/game_fetchsongid_unicode.php" {
263288 let mut global_data = state:: GLOBAL_DATA . lock ( ) . unwrap ( ) ;
264289 global_data. current_mbid = None ;
290+ global_data. current_release_mbid = None ;
265291 }
266292
267293 call_original ! (
0 commit comments