Commit b7e1233c authored by Felix Paul Kühne's avatar Felix Paul Kühne

MLShow: add ability to remove individual episodes from the set

parent f2aa9a4c
......@@ -25,6 +25,7 @@
#import <CoreData/CoreData.h>
@class MLShowEpisode;
@interface MLShow : NSManagedObject
{
......@@ -42,6 +43,9 @@
@property (nonatomic, retain) NSSet *episodes;
@property (nonatomic, retain, readonly) NSSet *unreadEpisodes;
- (void)removeEpisode:(MLShowEpisode*)episode;
- (void)removeEpisodeWithSeasonNumber:(NSNumber *)seasonNumber andEpisodeNumber:(NSNumber *)episodeNumber;
@end
......
Next Version
------------
- fixed subitem behavior of MLShow and MLAlbum on removal
Added Public APIs:
- MLShow:
- new selectors: removeEpisode, removeEpisodeWithSeasonNumberandEpisodeNumber
Version 2.1.2
-------------
- fix crashes and missing exception handlings
......@@ -26,7 +34,7 @@ Added Public APIs:
- MLFile:
- new properties: lastAudioTrack, lastSubtitleTrack
- MLMediaLibrary:
- new proporties: delegate, libraryNeedsUpgrade
- new properties: delegate, libraryNeedsUpgrade
- new selector: upgradeLibrary
- new delegate protocol: libraryUpgradeComplete
......
......@@ -25,6 +25,7 @@
*****************************************************************************/
#import "MLShow.h"
#import "MLShowEpisode.h"
#import "MLMediaLibrary.h"
@implementation MLShow
......@@ -85,4 +86,42 @@
// }
// return set;
//}
- (void)removeEpisode:(MLShowEpisode*)episode
{
if (!episode)
return;
NSMutableSet *episodes = [self mutableSetValueForKey:@"episodes"];
[episodes removeObject:episode];
[self willChangeValueForKey:@"episodes"];
[self setValue:episodes forKey:@"episodes"];
[self didChangeValueForKey:@"episodes"];
}
- (void)removeEpisodeWithSeasonNumber:(NSNumber *)seasonNumber andEpisodeNumber:(NSNumber *)episodeNumber
{
NSMutableSet *episodes = [self mutableSetValueForKey:@"episodes"];
MLShowEpisode *episode = nil;
if (seasonNumber && episodeNumber) {
for (MLShowEpisode *episodeIter in episodes) {
if ([episodeIter.seasonNumber intValue] == [seasonNumber intValue] &&
[episodeIter.episodeNumber intValue] == [episodeNumber intValue]) {
episode = episodeIter;
break;
}
}
}
if (!episode)
return;
[episodes removeObject:episode];
[self willChangeValueForKey:@"episodes"];
[self setValue:episodes forKey:@"episodes"];
[self didChangeValueForKey:@"episodes"];
}
@end
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