Closed twio142 closed 1 year ago
Would it be possible to get the name of the app playing the media currently? Can you please help me?
I tried decoding the string directly inside nowplaying.mm
but it prints out (null)
for some reason -- can you please take a look?
...
else if([key isEqualToString:@"kMRMediaRemoteNowPlayingInfoArtworkData"] || [key isEqualToString:@"kMRMediaRemoteNowPlayingInfoClientPropertiesData"]) {
NSData *data = (NSData *) rawValue;
NSString *decodeString = [data base64EncodedStringWithOptions:0];
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:decodeString options:0];
NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
printf("%s\n", [decodeString UTF8String]);
printf("%s\n", [decodedString UTF8String]);
}
...
output:
CJ4REhFjb20uYnJhdmUuQnJvd3NlciD1AzoNQnJhdmUgQnJvd3Nlcg==
(null)
With an online decoder I seem to be able to decode it to give me:
com.brave.Browser :
Brave Browser
However when using terminal I get the following:
$ base64 -d <<< $(./nowplaying-cli get clientPropertiesData)
Brave Browser%
@nyxaria I don't think you can do the base64 decoding from within the code because the string contains some strange characters. I'd just pipe the result to base64 -d
in the terminal.
I appreciate it!
I tried using python and it managed to decode it properly - as you said there are weird characters but at least now I can do partial matches
In [3]: s = "CJ4REhFjb20uYnJhdmUuQnJvd3NlciD1AzoNQnJhdmUgQnJvd3Nlcg=="
In [4]: base64.b64decode(s)
Out[4]: b'\x08\x9e\x11\x12\x11com.brave.Browser \xf5\x03:\rBrave Browser'
Is this possible?
P.S. Thank you so much for developing this tool! I've been looking for something like this for a long time.