Commit 769867c8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

library view cells: listen to a few more media object changes

parent 565cca09
......@@ -96,9 +96,10 @@
- (void)_removeObserver
{
if ([_mediaObject isKindOfClass:[MLLabel class]])
if ([_mediaObject isKindOfClass:[MLLabel class]]) {
[_mediaObject removeObserver:self forKeyPath:@"files"];
[_mediaObject removeObserver:self forKeyPath:@"name"];
else if ([_mediaObject isKindOfClass:[MLShow class]])
} else if ([_mediaObject isKindOfClass:[MLShow class]])
[_mediaObject removeObserver:self forKeyPath:@"episodes"];
else if ([_mediaObject isKindOfClass:[MLShowEpisode class]]) {
[_mediaObject removeObserver:self forKeyPath:@"name"];
......@@ -108,6 +109,13 @@
} else if ([_mediaObject isKindOfClass:[MLAlbum class]]) {
[_mediaObject removeObserver:self forKeyPath:@"name"];
[_mediaObject removeObserver:self forKeyPath:@"tracks"];
} else if ([_mediaObject isKindOfClass:[MLAlbumTrack class]]) {
[_mediaObject addObserver:self forKeyPath:@"unread" options:0 context:nil];
[_mediaObject removeObserver:self forKeyPath:@"artist"];
[_mediaObject removeObserver:self forKeyPath:@"title"];
[_mediaObject removeObserver:self forKeyPath:@"files"];
MLFile *anyFileFromTrack = [(MLAlbumTrack *)_mediaObject files].anyObject;
[anyFileFromTrack removeObserver:self forKeyPath:@"artworkURL"];
} else if ([_mediaObject isKindOfClass:[MLFile class]]) {
[_mediaObject removeObserver:self forKeyPath:@"computedThumbnail"];
[_mediaObject removeObserver:self forKeyPath:@"lastPosition"];
......@@ -126,9 +134,10 @@
- (void)_addObserver
{
if ([_mediaObject isKindOfClass:[MLLabel class]])
if ([_mediaObject isKindOfClass:[MLLabel class]]) {
[_mediaObject addObserver:self forKeyPath:@"files" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"name" options:0 context:nil];
else if ([_mediaObject isKindOfClass:[MLShow class]])
} else if ([_mediaObject isKindOfClass:[MLShow class]])
[_mediaObject addObserver:self forKeyPath:@"episodes" options:0 context:nil];
else if ([_mediaObject isKindOfClass:[MLShowEpisode class]]) {
[_mediaObject addObserver:self forKeyPath:@"name" options:0 context:nil];
......@@ -138,6 +147,13 @@
} else if ([_mediaObject isKindOfClass:[MLAlbum class]]) {
[_mediaObject addObserver:self forKeyPath:@"name" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"tracks" options:0 context:nil];
} else if ([_mediaObject isKindOfClass:[MLAlbumTrack class]]) {
[_mediaObject addObserver:self forKeyPath:@"unread" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"artist" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"title" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"files" options:0 context:nil];
MLFile *anyFileFromTrack = [(MLAlbumTrack *)_mediaObject files].anyObject;
[anyFileFromTrack addObserver:self forKeyPath:@"artworkURL" options:0 context:nil];
} else if ([_mediaObject isKindOfClass:[MLFile class]]) {
[_mediaObject addObserver:self forKeyPath:@"computedThumbnail" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"lastPosition" options:0 context:nil];
......
......@@ -74,6 +74,13 @@
} else if ([_mediaObject isKindOfClass:[MLAlbum class]]) {
[_mediaObject removeObserver:self forKeyPath:@"name"];
[_mediaObject removeObserver:self forKeyPath:@"tracks"];
} else if ([_mediaObject isKindOfClass:[MLAlbumTrack class]]) {
[_mediaObject addObserver:self forKeyPath:@"unread" options:0 context:nil];
[_mediaObject removeObserver:self forKeyPath:@"artist"];
[_mediaObject removeObserver:self forKeyPath:@"title"];
[_mediaObject removeObserver:self forKeyPath:@"files"];
MLFile *anyFileFromTrack = [(MLAlbumTrack *)_mediaObject files].anyObject;
[anyFileFromTrack removeObserver:self forKeyPath:@"artworkURL"];
} else if ([_mediaObject isKindOfClass:[MLFile class]]) {
[_mediaObject removeObserver:self forKeyPath:@"computedThumbnail"];
[_mediaObject removeObserver:self forKeyPath:@"lastPosition"];
......@@ -105,6 +112,13 @@
} else if ([_mediaObject isKindOfClass:[MLAlbum class]]) {
[_mediaObject addObserver:self forKeyPath:@"name" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"tracks" options:0 context:nil];
} else if ([_mediaObject isKindOfClass:[MLAlbumTrack class]]) {
[_mediaObject addObserver:self forKeyPath:@"unread" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"artist" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"title" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"files" options:0 context:nil];
MLFile *anyFileFromTrack = [(MLAlbumTrack *)_mediaObject files].anyObject;
[anyFileFromTrack addObserver:self forKeyPath:@"artworkURL" options:0 context:nil];
} else if ([_mediaObject isKindOfClass:[MLFile class]]) {
[_mediaObject addObserver:self forKeyPath:@"computedThumbnail" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"lastPosition" options:0 context:nil];
......@@ -165,6 +179,9 @@
[self _configureForAlbum:(MLAlbum *)self.mediaObject];
} else if ([self.mediaObject isKindOfClass:[MLAlbumTrack class]]) {
[self _configureForAlbumTrack:(MLAlbumTrack *)self.mediaObject];
if ([keyPath isEqualToString:@"computedThumbnail"] || !keyPath || (!self.thumbnailView.image && [keyPath isEqualToString:@"editing"])) {
self.thumbnailView.image = [VLCThumbnailsCache thumbnailForManagedObject:self.mediaObject];
}
} else if ([self.mediaObject isKindOfClass:[MLShow class]]) {
MLShow *mediaObject = (MLShow *)self.mediaObject;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment