Changeset 1165 for branches/PlayerFramework/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m
- Timestamp:
- 02/23/2010 04:51:22 PM (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/PlayerFramework/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m
r977 r1165 231 231 self.fileClassValue = FILE_CLASS_TV_SHOW; 232 232 NSString *epCoverPath = [[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:[ep path]]; 233 NSString *oldBasePath = [[epCoverPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[self .path lastPathComponent]];234 NSString *oldCoverPath = searchCoverArtExtForPath( [oldBasePath stringByDeletingPathExtension]);233 NSString *oldBasePath = [[epCoverPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[self fileName]]; 234 NSString *oldCoverPath = searchCoverArtExtForPath(oldBasePath); 235 235 if(oldCoverPath != nil) 236 236 { … … 251 251 self.fileClassValue = FILE_CLASS_MOVIE; 252 252 NSString *movieCoverPath = [movie coverArtPath]; 253 NSString *oldBasePath = [[[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:@"@MOVIES"] stringByAppendingPathComponent:[self .path lastPathComponent]];254 NSString *oldCoverPath = searchCoverArtExtForPath( [oldBasePath stringByDeletingPathExtension]);253 NSString *oldBasePath = [[[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:@"@MOVIES"] stringByAppendingPathComponent:[self fileName]]; 254 NSString *oldCoverPath = searchCoverArtExtForPath(oldBasePath); 255 255 if(oldCoverPath != nil) 256 256 { … … 352 352 353 353 //Check XML 354 NSString *xmlFilePath=[[self .path stringByDeletingPathExtension] stringByAppendingPathExtension:@"xml"];354 NSString *xmlFilePath=[[self extensionlessPath] stringByAppendingPathExtension:@"xml"]; 355 355 SapphireXMLData *xml = self.xmlData; 356 356 NSDictionary *xmlProps = [fm fileAttributesAtPath:xmlFilePath traverseLink:YES]; … … 591 591 { 592 592 NSManagedObjectContext *moc = [self managedObjectContext]; 593 NSString *lowerFileName = [[self .path lastPathComponent] lowercaseString];593 NSString *lowerFileName = [[self fileName] lowercaseString]; 594 594 595 595 SapphireEpisode *ep = self.tvEpisode; … … 613 613 else 614 614 lookupName = lowerFileName; 615 SapphireMovieTranslation *movieTran = [SapphireMovieTranslation movieTranslationWithName: [lookupName stringByDeletingPathExtension]inContext:moc];615 SapphireMovieTranslation *movieTran = [SapphireMovieTranslation movieTranslationWithName:lookupName inContext:moc]; 616 616 if(movieTran != nil) 617 617 { … … 651 651 { 652 652 /*Find cover art for the current file in the "Cover Art" dir */ 653 NSString *subPath = [self path]; 654 if([self fileContainerTypeValue] != FILE_CONTAINER_TYPE_VIDEO_TS) 655 subPath = [subPath stringByDeletingPathExtension]; 653 NSString *subPath = [self extensionlessPath]; 656 654 657 655 NSString *fileName = [subPath lastPathComponent]; … … 737 735 [SapphireMetaDataSupport save:[self managedObjectContext]]; 738 736 NSLog(@"Save done"); 739 NSString *extLessPath = [ oldPath stringByDeletingPathExtension];737 NSString *extLessPath = [self extensionlessPath]; 740 738 NSEnumerator *secondaryExtEnum = [secondaryFiles objectEnumerator]; 741 739 NSString *extension; 740 NSString *newExtlessPath = newPath; 741 if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 742 newExtlessPath = [newExtlessPath stringByDeletingPathExtension]; 742 743 743 744 while((extension = [secondaryExtEnum nextObject]) != nil) … … 746 747 if([fm fileExistsAtPath:secondaryPath]) 747 748 { 748 NSString *newSecondaryPath = [ [newPath stringByDeletingPathExtension]stringByAppendingPathExtension:extension];749 NSString *newSecondaryPath = [newExtlessPath stringByAppendingPathExtension:extension]; 749 750 if(newParent != nil) 750 751 { … … 767 768 if(coverArtPath != nil) 768 769 { 769 NSString *newCoverArtPath = [ [newPath stringByDeletingPathExtension]stringByAppendingPathExtension:[coverArtPath pathExtension]];770 NSString *newCoverArtPath = [newExtlessPath stringByAppendingPathExtension:[coverArtPath pathExtension]]; 770 771 if(newParent != nil) 771 772 { … … 800 801 return BRLocalizedString(@"A File name should not contain any '/' characters", @"Error indicating that filenames cannot contain / characters"); 801 802 NSString *oldPath = [self path]; 802 newFilename = [newFilename stringByAppendingPathExtension:[oldPath pathExtension]]; 803 if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 804 newFilename = [newFilename stringByAppendingPathExtension:[oldPath pathExtension]]; 803 805 NSString *newPath = [[oldPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:newFilename]; 804 806 if([oldPath isEqualToString:newPath]) … … 858 860 } 859 861 862 - (NSString *)fileName 863 { 864 NSString *ret = [self.path lastPathComponent]; 865 if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 866 ret = [ret stringByDeletingPathExtension]; 867 868 return ret; 869 } 870 871 - (NSString *)extensionlessPath 872 { 873 NSString *ret = self.path; 874 if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 875 ret = [ret stringByDeletingPathExtension]; 876 877 return ret; 878 } 879 860 880 - (NSMutableDictionary *)getDisplayedMetaDataInOrder:(NSArray * *)order; 861 881 {
