Permalink
Browse files

metadataRetriever no longer needed.

  • Loading branch information...
1 parent 6460021 commit 8654e3fa967775e7cc4ca6d2ee3607e3b0355f81 @kallepersson kallepersson committed Feb 15, 2012
Showing with 0 additions and 182 deletions.
  1. +0 −1 AppDelegate.m
  2. +0 −6 Perpetual.xcodeproj/project.pbxproj
  3. +0 −22 metadataRetriever.h
  4. +0 −153 metadataRetriever.m
View
1 AppDelegate.m
@@ -9,7 +9,6 @@
#import "AppDelegate.h"
#import <CoreAudio/CoreAudio.h>
#import <QTKit/QTKit.h>
-#import "metadataRetriever.h"
@implementation AppDelegate
View
6 Perpetual.xcodeproj/project.pbxproj
@@ -12,7 +12,6 @@
9395B6B014EB8D91002999D9 /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = 9395B6AF14EB8D91002999D9 /* Podfile */; };
9A041EBD14EAEBA2009AC43F /* cover.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 9A041EBC14EAEBA2009AC43F /* cover.jpg */; };
9A31AA3414EBF3FD00382B2F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A31AA3314EBF3FD00382B2F /* AudioToolbox.framework */; };
- 9A31AA3814EBF49F00382B2F /* metadataRetriever.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A31AA3714EBF49F00382B2F /* metadataRetriever.m */; };
9AC739D314EAEAB6000A57AD /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AC739D214EAEAB6000A57AD /* Cocoa.framework */; };
9AC739DD14EAEAB6000A57AD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9AC739DB14EAEAB6000A57AD /* InfoPlist.strings */; };
9AC739DF14EAEAB6000A57AD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC739DE14EAEAB6000A57AD /* main.m */; };
@@ -28,8 +27,6 @@
9395B6AF14EB8D91002999D9 /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = "<group>"; };
9A041EBC14EAEBA2009AC43F /* cover.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = cover.jpg; sourceTree = "<group>"; };
9A31AA3314EBF3FD00382B2F /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
- 9A31AA3614EBF49F00382B2F /* metadataRetriever.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = metadataRetriever.h; sourceTree = "<group>"; };
- 9A31AA3714EBF49F00382B2F /* metadataRetriever.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = metadataRetriever.m; sourceTree = "<group>"; };
9AC739CE14EAEAB6000A57AD /* Perpetual.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Perpetual.app; sourceTree = BUILT_PRODUCTS_DIR; };
9AC739D214EAEAB6000A57AD /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
9AC739D514EAEAB6000A57AD /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -107,8 +104,6 @@
9AC739D814EAEAB6000A57AD /* Perpetual */ = {
isa = PBXGroup;
children = (
- 9A31AA3614EBF49F00382B2F /* metadataRetriever.h */,
- 9A31AA3714EBF49F00382B2F /* metadataRetriever.m */,
9AC739E414EAEAB6000A57AD /* AppDelegate.h */,
9AC739E514EAEAB6000A57AD /* AppDelegate.m */,
9AC739E714EAEAB6000A57AD /* MainMenu.xib */,
@@ -217,7 +212,6 @@
files = (
9AC739DF14EAEAB6000A57AD /* main.m in Sources */,
9AC739E614EAEAB6000A57AD /* AppDelegate.m in Sources */,
- 9A31AA3814EBF49F00382B2F /* metadataRetriever.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
22 metadataRetriever.h
@@ -1,22 +0,0 @@
-//
-// metadataRetriever.h
-// SwiftLoad
-//
-// Created by Nathaniel Symer on 12/20/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <AudioToolbox/AudioToolbox.h>
-
-@interface metadataRetriever : NSObject
-
-+ (NSArray *)getMetadataForFile:(NSString *)filePath;
-
-+ (NSString *)artistForMetadataArray:(NSArray *)array;
-
-+ (NSString *)songForMetadataArray:(NSArray *)array;
-
-+ (NSString *)albumForMetadataArray:(NSArray *)array;
-
-@end
View
153 metadataRetriever.m
@@ -1,153 +0,0 @@
-//
-// metadataRetriever.m
-// SwiftLoad
-//
-// Created by Nathaniel Symer on 12/20/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
-//
-
-#import "metadataRetriever.h"
-#import <CoreFoundation/CoreFoundation.h>
-
-@implementation metadataRetriever
-
-+ (NSArray *)getMetadataForFile:(NSString *)filePath {
-
- NSURL *fileURL = [NSURL fileURLWithPath:filePath];
-
- AudioFileID fileID = nil;
- OSStatus err = noErr;
-
- err = AudioFileOpenURL( (__bridge_retained CFURLRef) fileURL, kAudioFileReadPermission, 0, &fileID );
- if (err != noErr) {
- NSLog(@"AudioFileOpenURL failed");
- }
-
- UInt32 id3DataSize = 0;
- char * rawID3Tag = NULL;
-
- err = AudioFileGetPropertyInfo( fileID, kAudioFilePropertyID3Tag, &id3DataSize, NULL );
- if (err != noErr) {
- NSLog(@"AudioFileGetPropertyInfo failed for ID3 tag");
- }
-
- rawID3Tag = (char *) malloc(id3DataSize);
- if (rawID3Tag == NULL) {
- NSLog(@"could not allocate %u bytes of memory for ID3 tag", id3DataSize);
- }
-
- err = AudioFileGetProperty(fileID, kAudioFilePropertyID3Tag, &id3DataSize, rawID3Tag);
- if (err != noErr) {
- NSLog(@"AudioFileGetProperty failed for ID3 tag");
- }
-
- int ilim = 100;
- if (ilim > id3DataSize) {
- ilim = id3DataSize;
- }
- for (int i=0; i < ilim; i++) {
- if( rawID3Tag[i] < 32 ) {
- printf( "." );
- } else {
- printf( "%c", rawID3Tag[i] );
- }
- }
-
- UInt32 id3TagSize = 0;
- UInt32 id3TagSizeLength = 0;
- err = AudioFormatGetProperty( kAudioFormatProperty_ID3TagSize,
- id3DataSize,
- rawID3Tag,
- &id3TagSizeLength,
- &id3TagSize
- );
- if( err != noErr ) {
- NSLog(@"AudioFormatGetProperty failed for ID3 tag size");
- switch( err ) {
- case kAudioFormatUnspecifiedError:
- NSLog(@"err: audio format unspecified error" );
- break;
- case kAudioFormatUnsupportedPropertyError:
- NSLog(@"err: audio format unsupported property error" );
- break;
- case kAudioFormatBadPropertySizeError:
- NSLog(@"err: audio format bad property size error" );
- break;
- case kAudioFormatBadSpecifierSizeError:
- NSLog(@"err: audio format bad specifier size error" );
- break;
- case kAudioFormatUnsupportedDataFormatError:
- NSLog(@"err: audio format unsupported data format error");
- break;
- case kAudioFormatUnknownFormatError:
- NSLog(@"err: audio format unknown format error");
- break;
- default:
- NSLog(@"err: some other audio format error");
- break;
- }
- }
-
- CFDictionaryRef piDict = nil;
- UInt32 piDataSize = sizeof(piDict);
-
- err = AudioFileGetProperty( fileID, kAudioFilePropertyInfoDictionary, &piDataSize, &piDict );
- if(err != noErr) {
- NSLog(@"AudioFileGetProperty failed for property info dictionary");
- }
-
-
- NSString *artistCF = (__bridge_transfer NSString *)CFDictionaryGetValue(piDict, CFSTR(kAFInfoDictionary_Artist));
- NSString *songCF = (__bridge_transfer NSString *)CFDictionaryGetValue(piDict, CFSTR(kAFInfoDictionary_Title));
- NSString *albumCF = (__bridge_transfer NSString *)CFDictionaryGetValue(piDict, CFSTR(kAFInfoDictionary_Album));
-
- NSString *artist = [NSString stringWithFormat:@"%@",artistCF];
- NSString *song = [NSString stringWithFormat:@"%@",songCF];
- NSString *album = [NSString stringWithFormat:@"%@",albumCF];
-
- NSString *artistNil = [NSString stringWithString:@"---"];
- NSString *songNil = [NSString stringWithString:@"---"];
- NSString *albumNil = [NSString stringWithString:@"---"];
-
- BOOL artistIsNil = [artist isEqualToString:@"(null)"];
- BOOL albumIsNil = [album isEqualToString:@"(null)"];
- BOOL songIsNil = [song isEqualToString:@"(null)"];
-
- NSMutableArray *initArray = [NSMutableArray arrayWithCapacity:10];
- if (artistIsNil) {
- [initArray addObject:artistNil];
- } else {
- [initArray addObject:artist];
- }
- if (songIsNil) {
- [initArray addObject:songNil];
- } else {
- [initArray addObject:song];
- }
-
- if (albumIsNil) {
- [initArray addObject:albumNil];
- } else {
- [initArray addObject:album];
- }
-
- free(rawID3Tag);
-
- NSArray *theArray = [NSArray arrayWithArray:initArray];
-
- return theArray;
-}
-
-+ (NSString *)artistForMetadataArray:(NSArray *)array {
- return [array objectAtIndex:0];
-}
-
-+ (NSString *)songForMetadataArray:(NSArray *)array {
- return [array objectAtIndex:1];
-}
-
-+ (NSString *)albumForMetadataArray:(NSArray *)array {
- return [array objectAtIndex:2];
-}
-
-@end

0 comments on commit 8654e3f

Please sign in to comment.