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

MLLabel: add selector to fetch all labels

parent 55103bb5
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* $Id$ * $Id$
* *
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org> * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
* Felix Paul Kühne <fkuehne # videolan.org>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
@interface MLLabel : NSManagedObject @interface MLLabel : NSManagedObject
{ {
} }
+ (NSArray *)allLabels;
@property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSSet* files; @property (nonatomic, retain) NSSet* files;
......
...@@ -7,6 +7,8 @@ Added Public APIs: ...@@ -7,6 +7,8 @@ Added Public APIs:
- new selectors: removeEpisode, removeEpisodeWithSeasonNumberandEpisodeNumber - new selectors: removeEpisode, removeEpisodeWithSeasonNumberandEpisodeNumber
- MLAlbum: - MLAlbum:
- new selectors: removeTrack, removeTrackWithTrackNumber - new selectors: removeTrack, removeTrackWithTrackNumber
- MLLabel
- new selector: allLabels
Version 2.1.3 Version 2.1.3
------------- -------------
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* $Id$ * $Id$
* *
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org> * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
* Felix Paul Kühne <fkuehne # videolan.org>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -24,10 +25,28 @@ ...@@ -24,10 +25,28 @@
*****************************************************************************/ *****************************************************************************/
#import "MLLabel.h" #import "MLLabel.h"
#import "MLMediaLibrary.h"
#import "MLFile.h" #import "MLFile.h"
@implementation MLLabel @implementation MLLabel
+ (NSArray *)allLabels
{
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSManagedObjectContext *moc = [[MLMediaLibrary sharedMediaLibrary] managedObjectContext];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Label" inManagedObjectContext:moc];
[request setEntity:entity];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:NO];
[request setSortDescriptors:@[descriptor]];
NSArray *labels = [moc executeFetchRequest:request error:nil];
[request release];
[descriptor release];
return labels;
}
@dynamic name; @dynamic name;
@dynamic files; @dynamic files;
......
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