Notification: Fix album date assignment
The NSCalendar assignment should have a placeholder month and day of January 1st, instead of the invalid month/day of 0/0. Also, even if this somehow fails, don't attempt to assign it if it returns nil. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
925a3502fa
commit
91b31255e6
1 changed files with 4 additions and 2 deletions
|
@ -948,9 +948,11 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
if(entry.year) {
|
||||
// If PlaylistEntry can represent a full date like some tag formats can do, change it
|
||||
NSCalendar *calendar = [NSCalendar currentCalendar];
|
||||
NSDate *releaseYear = [calendar dateWithEra:1 year:entry.year month:0 day:0 hour:0 minute:0 second:0 nanosecond:0];
|
||||
NSDate *releaseYear = [calendar dateWithEra:1 year:entry.year month:1 day:1 hour:0 minute:0 second:0 nanosecond:0];
|
||||
if(releaseYear) {
|
||||
[songInfo setObject:releaseYear forKey:MPMediaItemPropertyReleaseDate];
|
||||
}
|
||||
}
|
||||
[songInfo setObject:@(entry.currentPosition) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
|
||||
[songInfo setObject:entry.length forKey:MPMediaItemPropertyPlaybackDuration];
|
||||
[songInfo setObject:@(entry.index) forKey:MPMediaItemPropertyPersistentID];
|
||||
|
|
Loading…
Reference in a new issue