source: trunk/SapphireMetaData.h @ 212

Revision 212, 5.7 KB checked in by gbooker, 7 years ago (diff)
  • Changing to version 3
  • Everything is stored within the "/" collection rather than seperate collections
  • Symlinks are now resolved and the data transfered that way
Line 
1//
2//  SapphireMetaData.h
3//  Sapphire
4//
5//  Created by Graham Booker on 6/22/07.
6//  Copyright 2007 www.nanopi.net. All rights reserved.
7//
8
9#import <Cocoa/Cocoa.h>
10#import "SapphirePredicates.h"
11
12#define META_TVRAGE_IMPORT_KEY                  @"TVRage Source"
13#define META_XML_IMPORT_KEY                             @"XML Source"
14
15//TV Show Specific Keys
16#define META_TITLE_KEY                                  @"Title"
17#define META_SEASON_NUMBER_KEY                  @"Season"
18#define META_EPISODE_NUMBER_KEY                 @"Episode"
19#define META_SHOW_NAME_KEY                              @"Show Name"
20#define META_DESCRIPTION_KEY                    @"Show Description"
21#define META_SHOW_AIR_DATE                              @"Air Date"
22#define META_RATING_KEY                                 @"Rating"
23#define META_SUMMARY_KEY                                @"Summary"
24#define META_ABSOLUTE_EP_NUMBER_KEY             @"Episode Number"
25#define META_SHOW_IDENTIFIER_KEY                @"Show ID"
26
27//ATV Extra Info
28#define META_SHOW_BROADCASTER_KEY               @"Broadcast Company"
29#define META_SHOW_PUBLISHED_DATE_KEY    @"Published Date"
30#define META_SHOW_AQUIRED_DATE                  @"Date Aquired"
31#define META_SHOW_RATING_KEY                    @"Rating"
32#define META_SHOW_FAVORITE_RATING_KEY   @"User Rating"
33#define META_COPYRIGHT_KEY                              @"Copyright"
34
35//IMDB Type Info
36
37//Special Display Only Info
38#define META_EPISODE_AND_SEASON_KEY             @"S/E"
39
40#define META_DATA_FILE_ADDED_NOTIFICATION                               @"MetaDataFileAdded"
41#define META_DATA_FILE_REMOVED_NOTIFICATION                             @"MetaDataFileRemoved"
42#define META_DATA_FILE_INFO_WILL_CHANGE_NOTIFICATION    @"MetaDataFileInfoWillChange"
43#define META_DATA_FILE_INFO_HAS_CHANGED_NOTIFICATION    @"MetaDataFileInfoHasChanged"
44#define META_DATA_FILE_INFO_KIND                                                @"MetaDataFileInfoKind"
45
46typedef enum {
47        FILE_CLASS_UNKNOWN = 0,
48        FILE_CLASS_TV_SHOW = 1,
49        FILE_CLASS_MOVIE = 2,
50} FileClass;
51
52@class SapphireMetaData, SapphireMetaDataCollection, SapphireFileMetaData, SapphireDirectoryMetaData;
53
54@protocol SapphireMetaDataDelegate <NSObject>
55- (void)updateCompleteForFile:(NSString *)file;
56@end
57
58@protocol SapphireMetaDataScannerDelegate <NSObject>
59- (void)gotSubFiles:(NSArray *)subs;
60- (void)scanningDir:(NSString *)dir;
61- (BOOL)getSubFilesCanceled;
62@end
63
64@interface SapphireMetaData : NSObject {
65        NSMutableDictionary                             *metaData;
66        SapphireMetaData                                *parent;
67        /* These two are not retained */
68        NSString                                                *path;
69        id <SapphireMetaDataDelegate>   delegate;
70}
71
72+ (NSSet *)videoExtensions;
73+ (NSSet *)audioExtensions;
74- (NSString *)path;
75
76- (void)setDelegate:(id <SapphireMetaDataDelegate>)newDelegate;
77- (void)writeMetaData;
78- (SapphireMetaDataCollection *)collection;
79- (NSMutableDictionary *)getDisplayedMetaDataInOrder:(NSArray * *)order;
80
81@end
82
83@interface SapphireMetaDataCollection : SapphireMetaData {
84        NSMutableDictionary                     *directories;
85        NSMutableDictionary                     *skipCollection;
86        NSMutableDictionary                     *hideCollection;
87        NSString                                        *dictionaryPath;
88        BOOL                                            importing;
89}
90- (id)initWithFile:(NSString *)dictionary;
91- (SapphireMetaData *)dataForPath:(NSString *)path;
92- (SapphireDirectoryMetaData *)directoryForPath:(NSString *)path;
93- (SapphireMetaData *)dataForPath:(NSString *)path withData:(NSDictionary *)data;
94- (NSArray *)collectionDirectories;
95- (void)setImporting:(BOOL)isImporting;
96- (BOOL)hideCollection:(NSString *)collection;
97- (void)setHide:(BOOL)hide forCollection:(NSString *)collection;
98- (BOOL)skipCollection:(NSString *)collection;
99- (void)setSkip:(BOOL)skip forCollection:(NSString *)collection;
100
101@end
102
103@interface SapphireDirectoryMetaData : SapphireMetaData {
104        /*These two are not retained*/
105        NSMutableDictionary                     *metaFiles;
106        NSMutableDictionary                     *metaDirs;
107       
108        NSMutableDictionary                     *cachedMetaFiles;
109        NSMutableDictionary                     *cachedMetaDirs;
110
111        NSMutableArray                          *files;
112        NSMutableArray                          *directories;
113       
114        NSTimer                                         *importTimer;
115        NSMutableArray                          *importArray;
116        BOOL                                            scannedDirectory;
117       
118        /*This is not retained*/
119        SapphireMetaDataCollection      *collection;
120}
121
122- (void)reloadDirectoryContents;
123- (NSArray *)files;
124- (NSArray *)directories;
125- (NSArray *)predicatedFiles:(SapphirePredicate *)predicate;
126- (NSArray *)predicatedDirectories:(SapphirePredicate *)predicate;
127
128- (SapphireFileMetaData *)metaDataForFile:(NSString *)file;
129- (SapphireDirectoryMetaData *)metaDataForDirectory:(NSString *)dir;
130
131- (BOOL)pruneMetaData;
132- (BOOL)updateMetaData;
133
134- (void)cancelImport;
135- (void)resumeImport;
136- (void)resumeDelayedImport;
137
138- (SapphireMetaData *)metaDataForSubPath:(NSString *)path;
139- (void)getSubFileMetasWithDelegate:(id <SapphireMetaDataScannerDelegate>)subDelegate skipDirectories:(NSMutableSet *)skip;
140- (void)scanForNewFilesWithDelegate:(id <SapphireMetaDataScannerDelegate>)subDelegate skipDirectories:(NSMutableSet *)skip;
141- (void)loadMetaData;
142
143- (BOOL)watchedForPredicate:(SapphirePredicate *)predicate;
144- (void)setWatched:(BOOL)watched forPredicate:(SapphirePredicate *)predicate;
145- (BOOL)favoriteForPredicate:(SapphirePredicate *)predicate;
146- (void)setFavorite:(BOOL)favorite forPredicate:(SapphirePredicate *)predicate;
147- (void)setToImportFromSource:(NSString *)source forPredicate:(SapphirePredicate *)predicate;
148- (void)setFileClass:(FileClass)fileClass forPredicate:(SapphirePredicate *)predicate;
149
150@end
151
152@interface SapphireFileMetaData : SapphireMetaData {
153        NSDictionary            *combinedInfo;
154}
155
156- (BOOL) updateMetaData;
157
158- (int)modified;
159- (BOOL)watched;
160- (void)setWatched:(BOOL)watched;
161- (BOOL)favorite;
162- (void)setFavorite:(BOOL)favorite;
163- (long)importedTimeFromSource:(NSString *)source;
164- (void)setToImportFromSource:(NSString *)source;
165- (void)importInfo:(NSMutableDictionary *)newMeta fromSource:(NSString *)source withTime:(long)modTime;
166- (unsigned int)resumeTime;
167- (void)setResumeTime:(unsigned int)resumeTime;
168- (FileClass)fileClass;
169- (void)setFileClass:(FileClass)fileClass;
170
171- (long long)size;
172- (float)duration;
173- (Float64)sampleRate;
174- (UInt32)audioFormatID;
175- (BOOL)hasVideo;
176- (int)episodeNumber;
177- (int)seasonNumber;
178- (NSString *)episodeTitle;
179- (NSString *)showID;
180- (NSString *)showName;
181- (NSString *)sizeString;
182
183@end
Note: See TracBrowser for help on using the repository browser.