Changeset 1273
- Timestamp:
- 06/07/10 17:57:39 (2 years ago)
- Location:
- trunk/SapphireFrappliance
- Files:
-
- 3 modified
-
Browser/SapphireMarkMenu.m (modified) (4 diffs)
-
MetaData/SapphireMObjects/SapphireFileMetaData.h (modified) (1 diff)
-
MetaData/SapphireMObjects/SapphireFileMetaData.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SapphireFrappliance/Browser/SapphireMarkMenu.m
r1270 r1273 73 73 COMMAND_CHANGE_ARTWORK, 74 74 //File Only Commands 75 COMMAND_MOVE_TO_AUTO_SORT, 75 76 COMMAND_MARK_TO_JOIN, 76 77 COMMAND_MARK_AND_JOIN, … … 292 293 nil]; 293 294 295 NSString *autoSortPath = [fileMeta autoSortPath]; 296 if(autoSortPath != nil && [[[fileMeta path] stringByDeletingLastPathComponent] caseInsensitiveCompare:autoSortPath] != NSOrderedSame) 297 { 298 [marks insertObject: 299 [NSDictionary dictionaryWithObjectsAndKeys: 300 BRLocalizedString(@"Move to Auto Sort Path", @"Moving a file to auto sort path menu title"), MARK_NAME, 301 [NSString stringWithFormat:BRLocalizedString(@"Move to \"%@\"", @"Moving a file to auto sort path description; parameter is new path"), autoSortPath], MARK_DESCRIPTION, 302 [NSNumber numberWithInt:COMMAND_MOVE_TO_AUTO_SORT], MARK_COMMAND, 303 nil] 304 atIndex:1]; 305 } 294 306 NSString *prettyName = [fileMeta prettyName]; 295 307 if(prettyName != nil && [[fileMeta fileName] caseInsensitiveCompare:prettyName] != NSOrderedSame) … … 778 790 } 779 791 break; 792 case COMMAND_MOVE_TO_AUTO_SORT: 793 { 794 NSInvocation *invoke = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(pasteInDir:)]]; 795 [invoke setSelector:@selector(moveToAutoSortName:)]; 796 [invoke setTarget:self]; 797 [invoke setArgument:&fileMeta atIndex:2]; 798 799 SapphireWaitDisplay *wait = [[SapphireWaitDisplay alloc] initWithScene:[self scene] title:[NSString stringWithFormat:BRLocalizedString(@"Moving %@", @"parameter is file/dir that is being moved"), [[fileMeta path] lastPathComponent]] invocation:invoke]; 800 801 replaceController = [wait autorelease]; 802 } 803 break; 780 804 case COMMAND_CUT_PATH: 781 805 [movingPath release]; … … 806 830 else 807 831 [[self stack] popController]; 832 } 833 834 - (BRControl *)moveToAutoSortName:(SapphireFileMetaData *)fileMeta 835 { 836 NSString *error = [fileMeta moveToAutoSortName]; 837 if(error != nil) 838 return [[[SapphireErrorDisplayController alloc] initWithScene:[self scene] error:BRLocalizedString(@"Error", @"Short message indicating error condition") longError:error] autorelease]; 839 return nil; 808 840 } 809 841 -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.h
r1267 r1273 201 201 202 202 /*! 203 * @brief Get the file's auto-sort path 204 * 205 * @return The file's auto sort path, nil if none exists 206 */ 207 - (NSString *)autoSortPath; 208 209 /*! 210 * @brief Move to auto-sort path 211 * 212 * @return Move error, if one occurs 213 */ 214 - (NSString *)moveToAutoSortName; 215 216 /*! 203 217 * @brief Return the filename, minus the path extension 204 218 */ -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m
r1267 r1273 18 18 #import "NSArray-Extensions.h" 19 19 #import "NSString-Extensions.h" 20 #import "NSFileManager-Extensions.h" 20 21 21 22 #import <QTKit/QTKit.h> … … 937 938 } 938 939 940 - (NSString *)autoSortPath 941 { 942 SapphireEpisode *episode = self.tvEpisode; 943 return [episode.season autoSortPath]; 944 } 945 946 - (NSString *)moveToAutoSortName 947 { 948 NSString *error = nil; 949 if(![[self fileName] isEqualToString:[self prettyName]]) 950 error = [self renameToPrettyName]; 951 952 if(error != nil) 953 return error; 954 955 NSString *autoSortSeasonPath = [self autoSortPath]; 956 if(autoSortSeasonPath == nil) 957 return nil; 958 959 NSString *autoSortShowPath = [autoSortSeasonPath stringByDeletingLastPathComponent]; 960 961 NSFileManager *fm = [NSFileManager defaultManager]; 962 if(![fm isDirectory:autoSortShowPath]) 963 return [NSString stringWithFormat:BRLocalizedString(@"Auto sort path %@ is not a directory", @"Error indicating auto sort path isn't a directory"), autoSortShowPath]; 964 965 if(![fm constructPath:autoSortSeasonPath]) 966 return [NSString stringWithFormat:BRLocalizedString(@"Cannot create directory at path %@", @"Error indicating auto sort path can't be created"), autoSortSeasonPath]; 967 968 SapphireDirectoryMetaData *dirMeta = [SapphireDirectoryMetaData createDirectoryWithPath:autoSortSeasonPath inContext:[self managedObjectContext]]; 969 return [self moveToDir:dirMeta]; 970 } 971 939 972 - (NSString *)fileName 940 973 {
