@@ -382,14 +382,20 @@ def _write_to_text(self):
382
382
templatehandler = self .txttemplatehandler ,
383
383
metadata = self .currentmeta )
384
384
385
- def _strip_blobs_metadata (self , metadata : TrackMetadata ) -> TrackMetadata :
385
+ @staticmethod
386
+ def _strip_blobs_metadata (metadata : TrackMetadata ) -> TrackMetadata :
386
387
''' Strip binary blob data for remote transmission '''
387
388
remote_data = metadata .copy ()
388
389
389
390
# Remove all blob fields
390
391
for key in nowplaying .db .METADATABLOBLIST :
391
392
remote_data .pop (key , None )
392
393
394
+ for key , value in remote_data .items ():
395
+ if isinstance (value , bytes ):
396
+ logging .error ("%s was dropped from remote_data (bytes)" , key )
397
+ remote_data .pop (key , None )
398
+
393
399
# Remove dbid if present
394
400
if remote_data .get ('dbid' ):
395
401
del remote_data ['dbid' ]
@@ -411,10 +417,10 @@ async def _write_to_remote(self) -> None:
411
417
# Debug: write JSON to file to inspect
412
418
try :
413
419
debug_file = '/tmp/remote_debug.json'
414
- with open (debug_file , 'w' , encoding = 'utf-8' ) as f :
415
- json .dump (remote_data , f , indent = 2 )
420
+ with open (debug_file , 'w' , encoding = 'utf-8' ) as fnout :
421
+ json .dump (remote_data , fnout , indent = 2 )
416
422
logging .info ('Debug: wrote remote data to %s' , debug_file )
417
- except Exception as exc : # pylint: disable=broad-except
423
+ except Exception : # pylint: disable=broad-except
418
424
logging .exception ('Failed to write debug JSON: %s' )
419
425
420
426
async with aiohttp .ClientSession () as session :
0 commit comments