Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 227 lines (153 sloc) 7.055 kB
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
1 /*
2 iMedia Browser Framework <http://karelia.com/imedia/>
3
a63baee @danwood update copyrights to 2011. Fix a couple of files that were not inden…
danwood authored
4 Copyright (c) 2005-2011 by Karelia Software et al.
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
5
6 iMedia Browser is based on code originally developed by Jason Terhorst,
7 further developed for Sandvox by Greg Hulands, Dan Wood, and Terrence Talbot.
8 The new architecture for version 2.0 was developed by Peter Baumgartner.
9 Contributions have also been made by Matt Gough, Martin Wennerberg and others
10 as indicated in source files.
11
12 The iMedia Browser Framework is licensed under the following terms:
13
14 Permission is hereby granted, free of charge, to any person obtaining a copy
15 of this software and associated documentation files (the "Software"), to deal
16 in all or substantial portions of the Software without restriction, including
17 without limitation the rights to use, copy, modify, merge, publish,
18 distribute, sublicense, and/or sell copies of the Software, and to permit
19 persons to whom the Software is furnished to do so, subject to the following
20 conditions:
21
22 Redistributions of source code must retain the original terms stated here,
23 including this list of conditions, the disclaimer noted below, and the
a63baee @danwood update copyrights to 2011. Fix a couple of files that were not inden…
danwood authored
24 following copyright notice: Copyright (c) 2005-2011 by Karelia Software et al.
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
25
26 Redistributions in binary form must include, in an end-user-visible manner,
27 e.g., About window, Acknowledgments window, or similar, either a) the original
28 terms stated here, including this list of conditions, the disclaimer noted
29 below, and the aforementioned copyright notice, or b) the aforementioned
30 copyright notice and a link to karelia.com/imedia.
31
32 Neither the name of Karelia Software, nor Sandvox, nor the names of
33 contributors to iMedia Browser may be used to endorse or promote products
34 derived from the Software without prior and express written permission from
35 Karelia Software or individual contributors, as appropriate.
36
37 Disclaimer: THE SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER AND CONTRIBUTORS
38 "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
39 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
40 AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
41 LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
42 CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH, THE
43 SOFTWARE OR THE USE OF, OR OTHER DEALINGS IN, THE SOFTWARE.
44 */
45
46
135075f Added an author line in the header of each source file. This is done …
Peter Baumgartner authored
47 // Author: Peter Baumgartner
48
49
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
50 //----------------------------------------------------------------------------------------------------------------------
51
52
53 #pragma mark HEADERS
54
55 #import "IMBiPhotoVideoParser.h"
56 #import "IMBParserController.h"
f037d7e @danwood From Jörg:
danwood authored
57 #import "IMBMovieViewController.h"
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
58 #import "IMBNode.h"
59 #import "IMBObject.h"
f037d7e @danwood From Jörg:
danwood authored
60 #import "IMBObject.h"
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
61 #import "NSDictionary+iMedia.h"
f7642df @danwood Trying to get metadata descriptions of videos lined up across data so…
danwood authored
62 #import "NSString+iMedia.h"
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
63 #import "NSURL+iMedia.h"
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
64 //#import "IMBIconCache.h"
65 //#import "NSWorkspace+iMedia.h"
66 //#import "NSFileManager+iMedia.h"
67 #import <Quartz/Quartz.h>
f7642df @danwood Trying to get metadata descriptions of videos lined up across data so…
danwood authored
68 #import "IMBTimecodeTransformer.h"
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
69
70
71 //----------------------------------------------------------------------------------------------------------------------
72
73
74 #pragma mark
75
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
76 @interface IMBiPhotoVideoParser ()
77
78 - (NSString*) metadataDescriptionForMetadata:(NSDictionary*)inMetadata;
79
80 @end
81
82
83 //----------------------------------------------------------------------------------------------------------------------
84
85
86 #pragma mark
87
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
88 @implementation IMBiPhotoVideoParser
89
f7642df @danwood Trying to get metadata descriptions of videos lined up across data so…
danwood authored
90 @synthesize timecodeTransformer = _timecodeTransformer;
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
91
92 //----------------------------------------------------------------------------------------------------------------------
93
94
95 // Register this parser, so that it gets automatically loaded...
96
97 + (void) load
98 {
99 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
100 [IMBParserController registerParserClass:self forMediaType:kIMBMediaTypeMovie];
16f2aab @danwood Trying to track down issue 222, using the static analyzer I got a bun…
danwood authored
101 [pool drain];
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
102 }
103
f037d7e @danwood From Jörg:
danwood authored
104
105 //----------------------------------------------------------------------------------------------------------------------
106
107
108 + (NSString*) objectCountFormatSingular
109 {
110 return [IMBMovieViewController objectCountFormatSingular];
111 }
112
113
114 + (NSString*) objectCountFormatPlural
115 {
116 return [IMBMovieViewController objectCountFormatPlural];
117 }
118
119
120 //----------------------------------------------------------------------------------------------------------------------
121
122
f7642df @danwood Trying to get metadata descriptions of videos lined up across data so…
danwood authored
123 - (void)dealloc
124 {
125 IMBRelease(_timecodeTransformer);
126 [super dealloc];
127 }
128
129 - (id) initWithMediaType:(NSString*)inMediaType
130 {
131 if (self = [super initWithMediaType:inMediaType])
132 {
133 self.timecodeTransformer = [[[IMBTimecodeTransformer alloc] init] autorelease];
134 }
135
136 return self;
137 }
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
138
139 //----------------------------------------------------------------------------------------------------------------------
140
141
142 // This media type is specific to iPhoto and is not to be confused with kIMBMediaTypeImage...
143
144 - (NSString*) iPhotoMediaType
145 {
146 return @"Movie";
147 }
148
68abcd8 @danwood Make the iPhoto video parser work and properly create correct object …
danwood authored
149 //----------------------------------------------------------------------------------------------------------------------
150
151
152 - (Class) objectClass
153 {
f037d7e @danwood From Jörg:
danwood authored
154 return [IMBObject class];
68abcd8 @danwood Make the iPhoto video parser work and properly create correct object …
danwood authored
155 }
156
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
157
158 //----------------------------------------------------------------------------------------------------------------------
159
9ec4905 Improved thumbnail loading of movies in combo view. Poster frames are…
Peter Baumgartner authored
160
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
161 - (NSString*) requestedImageRepresentationType
162 {
0f161c1 @danwood took out a couple of obsolete comments; enhanced logging on KVO problem
danwood authored
163 return IKImageBrowserQTMoviePathRepresentationType;
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
164 }
165
166
167 // Use the path of the hires file to get to the QTMovie...
168
169 - (NSString*) imageLocationForObject:(NSDictionary*)inObjectDict
170 {
171 return [inObjectDict objectForKey:@"ImagePath"];
172 }
173
6cecb4e @danwood Expose QTMovie movieWithIMBImageItem again so client apps like sandvo…
danwood authored
174
9da6100 Bugfix for a regression on 10.5 (kind key seems to be missing on old …
Peter Baumgartner authored
175 //----------------------------------------------------------------------------------------------------------------------
f7642df @danwood Trying to get metadata descriptions of videos lined up across data so…
danwood authored
176
177
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
178 - (void) loadMetadataForObject:(IMBObject*)inObject
9da6100 Bugfix for a regression on 10.5 (kind key seems to be missing on old …
Peter Baumgartner authored
179 {
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
180 NSURL* videoURL = [inObject URL];
9da6100 Bugfix for a regression on 10.5 (kind key seems to be missing on old …
Peter Baumgartner authored
181
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
182 if (videoURL == nil) {
183 return;
9da6100 Bugfix for a regression on 10.5 (kind key seems to be missing on old …
Peter Baumgartner authored
184 }
6ac9497 Got rid of compile time warning
Peter Baumgartner authored
185 NSMutableDictionary* metadata = [NSMutableDictionary dictionaryWithDictionary:inObject.preliminaryMetadata];
186
f037d7e @danwood From Jörg:
danwood authored
187 // Do not load (key) movie specific metadata for node objects
188 // because it doesn't represent the nature of the object well enough.
189
190 if (![inObject isKindOfClass:[IMBNodeObject class]])
191 {
192 [metadata addEntriesFromDictionary:[NSURL imb_metadataFromVideoAtURL:videoURL]];
193 }
6ac9497 Got rid of compile time warning
Peter Baumgartner authored
194
195 NSString* description = [self metadataDescriptionForMetadata:metadata];
196
197 if ([NSThread isMainThread])
198 {
199 inObject.metadata = metadata;
200 inObject.metadataDescription = description;
201 }
202 else
203 {
204 NSArray* modes = [NSArray arrayWithObject:NSRunLoopCommonModes];
205 [inObject performSelectorOnMainThread:@selector(setMetadata:) withObject:metadata waitUntilDone:NO modes:modes];
206 [inObject performSelectorOnMainThread:@selector(setMetadataDescription:) withObject:description waitUntilDone:NO modes:modes];
207 }
208 }
209
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
210 - (NSString*) metadataDescriptionForMetadata:(NSDictionary*)inMetadata
211 {
f037d7e @danwood From Jörg:
danwood authored
212 // Events have other metadata than images
213
214 if ([inMetadata objectForKey:@"RollID"]) // Event
215 {
216 return [self eventMetadataDescriptionForMetadata:inMetadata];
217 }
218
219 // Movie
b8a5da4 Factored out methods to query Spotlight for metadata for audio and vi…
Pierre Bernard authored
220 return [NSDictionary imb_metadataDescriptionForMovieMetadata:inMetadata];
221 }
6ac9497 Got rid of compile time warning
Peter Baumgartner authored
222
223 //----------------------------------------------------------------------------------------------------------------------
224
225
ffd28df • Made iPhoto parser more general. It now filters out nodes that do n…
Peter Baumgartner authored
226 @end
Something went wrong with that request. Please try again.