source: trunk/SapphireFrappliance/MetaData/Support/SapphireDirectory.h @ 1270

Revision 1270, 9.3 KB checked in by gbooker, 5 years ago (diff)

Corrected spelling of invocation

Line 
1/*
2 * SapphireDirectory.h
3 * Sapphire
4 *
5 * Created by Graham Booker on Apr. 9, 2008.
6 * Copyright 2008 Sapphire Development Team and/or www.nanopi.net
7 * All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License as published by the Free Software Foundation; either version 3 of the License,
11 * or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15 * Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with this program; if not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 */
20
21//Sapphire Virtual Directory Movie Folders
22extern NSString *VIRTUAL_DIR_ROOT_PATH;
23extern NSString *VIRTUAL_DIR_ALL_PATH;
24extern NSString *VIRTUAL_DIR_CAST_PATH;
25extern NSString *VIRTUAL_DIR_DIRECTOR_PATH;
26extern NSString *VIRTUAL_DIR_GENRE_PATH;
27extern NSString *VIRTUAL_DIR_TOP250_PATH;
28extern NSString *VIRTUAL_DIR_OSCAR_PATH;
29
30@class SapphireFileMetaData;
31@protocol SapphireMetaData;
32
33/*!
34 * @brief A protocol for the SapphireMetaData to inform its delegate of updates to data
35 *
36 * This protocol provides a method by which metadata can send changes back to its delegate.
37 */
38@protocol SapphireMetaDataDelegate <NSObject>
39
40/*!
41 * @brief The import on a file completed
42 *
43 * If a import of metadata was progressing in the background, the delegate is informed when the process has completed for a file.
44 *
45 * @param file Filename to the file which completed
46 */
47- (void)updateCompleteForFile:(NSString *)file;
48
49/*!
50 * @brief The directory contents changed, update display
51 *
52 * A background import can add or remove files from a directory.  The delegate is informed that this has happened so it can update its UI or some other action
53 */
54- (void)directoryContentsChanged;
55@end
56
57/*!
58 * @brief A protocol for the SapphireMetaDataScanner to request more data of its delegate
59 *
60 * Since the SapphireMetaDataScanner runs with the event loop, it needs a method to report back its progress and results.  It also provides a means for the scanner to know it should cancel its process.
61 */
62@protocol SapphireMetaDataScannerDelegate <NSObject>
63
64/*!
65 * @brief Finished scanning the dir
66 *
67 * The SapphireMetaDataScanner has finished scanning a directory and is ready to return its results.
68 *
69 * @param subs The subfiles found by the scanner
70 */
71- (void)gotSubFiles:(NSArray *)subs;
72
73/*!
74 * @brief Started Scanning a directory
75 *
76 * The SapphireMetaDataScanner has started scanning a directory.
77 *
78 * @param dir The current directory it is scanning
79 */
80- (void)scanningDir:(NSString *)dir;
81
82/*!
83 * @brief Check to see if the scan should be canceled
84 *
85 * If a delegate wishes to cancel the scan of a directory, then simply return YES to this function, and the scan will cease.
86 *
87 * @return YES if the scan should be canceled
88 */
89- (BOOL)getSubFilesCanceled;
90@end
91
92/*!
93 * @brief The importer Backgrounding protocol
94 *
95 * This protocol is designed for use with distributed objects.
96 */
97@protocol SapphireImporterBackgroundProtocol <NSObject>
98/*!
99 * @brief Tells the importer of a background import
100 *
101 * This is for use with distributed objects
102 */
103- (oneway void)informComplete:(BOOL)updated onPath:(NSString *)path;
104@end
105
106/*!
107 * @brief A protocol for a directory
108 *
109 * This protocol provides a method by which metadata directories can be used without regard as to whether they are real or virtual
110 */
111@protocol SapphireDirectory <SapphireMetaData>
112
113/*!
114 * @brief Get the delegate for the metadata
115 *
116 * @return The current delegate
117 */
118- (id <SapphireMetaDataDelegate>)delegate;
119
120/*!
121 * @brief Sets the delegate for the metadata
122 *
123 * @param newDelegate The new delegate
124 */
125- (void)setDelegate:(id <SapphireMetaDataDelegate>)newDelegate;
126
127/*!
128 * @brief Reloads the directory contents
129 *
130 * This function examines the directory on the disk and reloads the objects contents from what it finds there.
131 */
132- (void)reloadDirectoryContents;
133
134/*!
135 * @brief Returns the path of the current metadata
136 *
137 * All metadata has a path associated with it; this function returns the path for this one.
138 *
139 * @return The path
140 */
141- (NSString *)path;
142
143/*!
144 * @brief Retrieve a list of all file names
145 *
146 * @return An NSArray of all file names
147 */
148- (NSArray *)files;
149
150/*!
151 * @brief Retrieve a list of all directory names
152 *
153 * @return An NSArray of all directory names
154 */
155- (NSArray *)directories;
156
157/*!
158 * @brief Get the metadata object for a file.
159 *
160 * @param file The file within this dir
161 * @return The file's metadata, nil if one doesn't exist
162 */
163- (SapphireFileMetaData *)metaDataForFile:(NSString *)file;
164
165/*!
166 * @brief Get the metadata object for a directory.
167 *
168 * @param dir The directory within this dir
169 * @return The directory's metadata, nil if one doesn't exist
170 */
171- (id <SapphireDirectory>)metaDataForDirectory:(NSString *)directory;
172
173/*!
174 * @brief Check to see if any filtered files match the predicate
175 *
176 * @param pred The predicate to check
177 */
178- (BOOL)containsFileMatchingPredicate:(NSPredicate *)pred;
179
180/*!
181 * @brief Checks to see if directory contains any files with filter
182 *
183 * @param filter The filter predicate to test
184 */
185- (BOOL)containsFileMatchingFilterPredicate:(NSPredicate *)pred;
186
187/*!
188 * @brief Invoke a command on all files contained within this directory within filter
189 *
190 * @param fileInv The invocation to invoke
191 */
192- (void)invokeOnAllFiles:(NSInvocation *)fileInv;
193
194/*!
195 * @brief Gets the filter predicate in use for filtering in this directory
196 *
197 * @return The predict in use
198 */
199- (NSPredicate *)filterPredicate;
200
201/*!
202 * @brief Sets the filter predicate to use for filtering in this directory
203 *
204 * @param predicate The predict to use
205 */
206- (void)setFilterPredicate:(NSPredicate *)predicate;
207
208/*!
209 * @brief Resume the import process
210 */
211- (void)resumeImport;
212
213/*!
214 * @brief Cancel the import process
215 */
216- (void)cancelImport;
217
218/*!
219 * @brief Get the metadata for all the files contained within this directory tree
220 *
221 * @param subDelegate The delegate to inform when scan is complete
222 * @param skip A set of directories to skip.  Note, this set is modified
223 */
224- (void)getSubFileMetasWithDelegate:(id <SapphireMetaDataScannerDelegate>)subDelegate skipDirectories:(NSMutableSet *)skip;
225
226/*!
227 * @brief Scan for all files contained within this directory tree
228 *
229 * @param subDelegate The delegate to inform when scan is complete
230 * @param skip A set of directories to skip.  Note, this set is modified
231 */
232- (void)scanForNewFilesWithDelegate:(id <SapphireMetaDataScannerDelegate>)subDelegate skipDirectories:(NSMutableSet *)skip;
233
234/*!
235 * @brief Get the cover art Path
236 *
237 * Returns the cover art path for this show
238 *
239 * @return The path for the cover art, nil if none found
240 */
241- (NSString *)coverArtPath;
242
243/*!
244 * @brief Clear the watched/favorite cache for this dir and its parents
245 *
246 * The watched and favorite values for all dirs is cached for speed reasons.  If this value changes, the cache needs to be invalidated
247 */
248- (void)clearPredicateCache;
249
250/*!
251 * @brief The managed object context
252 *
253 * @return The managed object context for the metadata
254 */
255- (NSManagedObjectContext *)managedObjectContext;
256
257/*!
258 * @brief Turn all managed objects directly in this directory into faults
259 *
260 * This function turns the managed objects into faults.  This means when they are next referenced,
261 * they will refetch data from the store.  It is also used to allow core data to free memory
262 */
263- (void)faultAllObjects;
264
265/*!
266 * @brief Returns whether the managed object is deleted
267 *
268 * @return YES if the current directory is deleted, NO otherwise
269 */
270- (BOOL)objectIsDeleted;
271
272@end
273
274@protocol SapphireSortableDirectory <SapphireDirectory>
275
276/*!
277 * @brief Gets the available file sorters, default first
278 *
279 * @return The available file sorters, default first
280 */
281- (NSArray *)fileSorters;
282
283/*!
284 * @brief Gets the sort method used
285 *
286 * @return The sort method used
287 */
288- (int)sortMethodValue;
289
290/*!
291 * @brief Sets the sort method to use
292 *
293 * @param value_ The sort method to use
294 */
295- (void)setSortMethodValue:(int)value_;
296
297@end
298
299
300/*!
301 * @brief Set subtree to watched or unwatched with restriction as to predicate.  Does not follow symlinks
302 *
303 * @param dir The subtree
304 * @param watched YES if watched, NO otherwise
305 */
306void setSubtreeToWatched(id <SapphireDirectory> dir, BOOL watched);
307
308/*!
309 * @brief Set subtree to favorite or not favorite with restriction as to predicate.  Does not follow symlinks
310 *
311 * @param dir The subtree
312 * @param favorite YES if favorite, NO otherwise
313 */
314void setSubtreeToFavorite(id <SapphireDirectory> dir, BOOL favorite);
315
316/*!
317 * @brief Set subtree to re-import from the specified source with restriction as to predicate.  Does not follow symlinks
318 *
319 * @param dir The subtree
320 * @param mask The source(s) on which to re-import
321 */
322void setSubtreeToReimportFromMask(id <SapphireDirectory> dir, int mask);
323
324/*!
325 * @brief Clear metadata for an entire subtree with restriction as to predicate.  Does not follow symlinks
326 */
327void setSubtreeToClearMetaData(id <SapphireDirectory> dir);
328
329/*!
330 * @brief Reset import decisions for this file (also mark to re-import) for an entire subtree with restriction as to predicate.  Does not follow symlinks
331 */
332void setSubtreeToResetImportDecisions(id <SapphireDirectory> dir);
Note: See TracBrowser for help on using the repository browser.