-
Notifications
You must be signed in to change notification settings - Fork 34
NowPlayingWidget: Saves last music player used to start it from the the touchBar + display album art if available #40
base: master
Are you sure you want to change the base?
Conversation
Present in iTunes but not Deezer for example. Dictionnary key was kMRMediaRemoteNowPlayingInfoArtworkData
Added fix for issue #36 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I have some review comments.
src/System/NowPlaying.m
Outdated
@@ -113,22 +117,27 @@ - (void)updateApp | |||
NSString *appBundleIdentifier = nil; | |||
NSString *appName = nil; | |||
NSImage *appIcon = nil; | |||
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably the wrong place to be storing User Defaults. I would move them to the NowPlayingWidget itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It tries to load the appBundleIdentifier of the last music player from the NSUserDefaults only if MRMediaRemoteGetNowPlayingClient returns nil.
It also saves the last music player used in NSUserDefaults on each updateApp.
It keeps the current implementation logic filling the appBundleIdentifier to get the name+icon of the application.
Let me know if you prefer to duplicate this logic in the NowPlayingWidget also.
@@ -155,12 +170,20 @@ - (void)updateInfo | |||
NSString *album = [info objectForKey:kMRMediaRemoteNowPlayingInfoAlbum]; | |||
NSString *artist = [info objectForKey:kMRMediaRemoteNowPlayingInfoArtist]; | |||
NSString *title = [info objectForKey:kMRMediaRemoteNowPlayingInfoTitle]; | |||
|
|||
if (self.album != album || self.artist != artist || self.title != title) | |||
NSData *artworkData = [info objectForKey:kMRMediaRemoteNowPlayingInfoArtworkData]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is always nil on my machine. I am running macOS 10.14.3.
I have tried with iTunes, Spotify and Hermes and I never get the album art.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird, I'm also running macOS 10.14.3.
Logging info var using iTunes returns:
{
kMRMediaRemoteNowPlayingInfoAlbum = "Whatever People Say I Am, That's What I'm Not";
kMRMediaRemoteNowPlayingInfoAlbumiTunesStoreAdamIdentifier = 111153953;
kMRMediaRemoteNowPlayingInfoArtist = "Arctic Monkeys";
kMRMediaRemoteNowPlayingInfoArtistiTunesStoreAdamIdentifier = 62820413;
kMRMediaRemoteNowPlayingInfoArtworkData = <xxxxxxxx xxxxxxxx ...>
}
On my machine: https://www.youtube.com/watch?v=BEqfOcQq_Xk
Please check |
Hello you both, I am not a coding dude or sth else, but I really want to have this feature. Can I download it somewhere, or how can I show the album art in the Energy bar? Please help me. |
@samabel I have built iamslan's pull request in an app for you. Download it and run it here. Open up the settings, go to the "Widgets" tab and enable "Show album art". Should work fine. |
Hey @simonpacis, thank you very much for the work. This works fine for me! |
Hey @simonpacis, any chance you could make a fork and put it all in there so we can all see the source for the zip you’re providing? Thanks for your work on this! |
I just built this fork: https://github.com/iamslan/EnergyBar. None of the code is mine. :-) |
No description provided.