Added Remove Dead Items command

CQTexperiment
Chris Moeller 2013-10-18 00:14:53 -07:00
parent 2d5f340011
commit 7a9e4a720c
3 changed files with 26 additions and 2 deletions

View File

@ -85,7 +85,7 @@
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<imageCell key="dataCell" controlSize="small" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="623CE0BD-CB51-4F0B-995B-E803BBE962CA" id="1801">
<imageCell key="dataCell" controlSize="small" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="DE10E5BB-5D9E-4B74-9085-7E5ACEFB1BB0" id="1801">
<font key="font" metaFont="system"/>
</imageCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
@ -1165,6 +1165,12 @@ CA
<action selector="removeDuplicates:" target="218" id="bS3-zS-wcJ"/>
</connections>
</menuItem>
<menuItem title="Remove Dead Items" id="Ajn-k4-afd" userLabel="Menu Item - Remove Dead Items">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="removeDeadItems:" target="218" id="vGZ-l5-tlE"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="dfu-5S-1BE"/>
<menuItem title="Add to Queue" id="1864"/>
<menuItem title="Remove from Queue" id="1865"/>
@ -1780,7 +1786,7 @@ Gw
<customObject id="2434" customClass="FeedbackController"/>
</objects>
<resources>
<image name="623CE0BD-CB51-4F0B-995B-E803BBE962CA" width="17" height="17">
<image name="DE10E5BB-5D9E-4B74-9085-7E5ACEFB1BB0" width="17" height="17">
<mutableData key="keyedArchiveRepresentation">
YnBsaXN0MDDUAQIDBAUGRkdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK8QDwcI
ExQZHh8qKyw0NzpAQ1UkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5T

View File

@ -78,6 +78,7 @@ typedef enum {
- (IBAction)randomizeList:(id)sender;
- (IBAction)removeDuplicates:(id)sender;
- (IBAction)removeDeadItems:(id)sender;
- (IBAction)showEntryInFinder:(id)sender;
- (IBAction)clearFilterPredicate:(id)sender;

View File

@ -478,6 +478,23 @@
[originals release];
}
- (IBAction)removeDeadItems:(id)sender {
NSMutableIndexSet *deadItems = [[NSMutableIndexSet alloc] init];
for (PlaylistEntry *pe in [self content])
{
NSURL *url = [pe URL];
if ([url isFileURL])
if (![[NSFileManager defaultManager] fileExistsAtPath:[url path]])
[deadItems addIndex:[pe index]];
}
if ([deadItems count] > 0)
[self removeObjectsAtArrangedObjectIndexes:deadItems];
[deadItems release];
}
- (PlaylistEntry *)shuffledEntryAtIndex:(int)i
{
RepeatMode repeat = [self repeat];