Changeset 548

Show
Ignore:
Timestamp:
05/26/08 18:21:48 (6 months ago)
Author:
gbooker
Message:

Handle the plot for movies (untested)
Refs #177

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireXMLFileDataImporter.m

    r541 r548  
    2121#import "SapphireXMLFileDataImporter.h" 
    2222#import "SapphireFile.h" 
     23#import "SapphireMediaPreview.h" 
    2324#include <sys/types.h> 
    2425#include <sys/stat.h> 
     
    117118        if(!root) 
    118119                return IMPORT_STATE_NOT_UPDATED; 
    119         /* 
    120          NSString *type = [[root attributeForName:@"type"] stringValue]; 
    121          //Need to catch the media type {"TV Show" , "Movie"} 
    122          if(type!=nil)metaData 
    123          */ 
     120         
     121        NSString *type = [[root attributeForName:@"type"] stringValue]; 
     122        FileClass fclass = FILE_CLASS_UNKNOWN; 
     123        //Need to catch the media type {"TV Show" , "Movie"} 
     124        if(type!=nil) 
     125        { 
     126                if([type isEqualToString:@"TV Show"]) 
     127                        fclass = FILE_CLASS_TV_SHOW; 
     128                else if([type isEqualToString:@"Movie"]) 
     129                        fclass = FILE_CLASS_MOVIE; 
     130                 
     131                if(fclass != FILE_CLASS_UNKNOWN) 
     132                        [newMetaData setObject:[NSNumber numberWithInt:fclass] forKey:FILE_CLASS_KEY]; 
     133                else 
     134                        fclass = [metaData fileClassValue]; 
     135        } 
     136                 
    124137        /*Import single attribute items*/ 
    125138        NSEnumerator *keyEnum = [xmlSingleAttributes keyEnumerator]; 
     
    196209                } 
    197210        } 
     211        /*Special case: plot*/ 
     212        if(fclass == FILE_CLASS_MOVIE) 
     213        { 
     214                NSString *plot = [newMetaData objectForKey:META_SUMMARY_KEY]; 
     215                if(plot != nil) 
     216                { 
     217                        [newMetaData setObject:plot forKey:META_MOVIE_PLOT_KEY]; 
     218                        [newMetaData removeObjectForKey:META_SUMMARY_KEY]; 
     219                } 
     220        } 
    198221        /*Import into metadata*/ 
    199222        [metaData importInfo: newMetaData fromSource:IMPORT_TYPE_XML_MASK withTime:modTime];