Changeset 26241 for gs2-extensions
- Timestamp:
- 2012-09-25T12:41:31+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/video-and-audio/trunk/src/opt/Terrier/VideoDocument.java
r26236 r26241 82 82 // 0. Initialization from arguments 83 83 this.properties = default_properties; 84 String filepath = this.properties.get("filename"); 85 System.out.println("[F:" + this.epochTime() + "] Starting ingest of " + filepath); 84 86 85 87 // Set properties … … 89 91 this.properties.put("abstract", "This is a video so here is some dummy text to prevent indexer failing."); 90 92 // B. Properties derived from filename 91 String filepath = this.properties.get("filename");92 93 String title = filepath.substring(filepath.lastIndexOf(System.getProperty("file.separator")) + 1); 93 94 this.properties.put("title", title); … … 95 96 String target_filename = "doc." + ext; 96 97 this.properties.put("source","doc." + ext); 98 97 99 // - A unique associated directory. This gets a little tricky as we need 98 100 // to create the directory at the same time if an effort to promote 99 101 // synchronous behaviour 102 System.out.println("[F:" + this.epochTime() + ":PR]"); 100 103 String unique_id = this.generateHash(filepath); 101 104 // - we start with the first 4 characters … … 107 110 // - then we continue adding blocks of 4 characters until we get a 108 111 // directory that doesn't already exist 112 System.out.println("[F:" + this.epochTime() + ":IO]"); 109 113 while (assoc_path.toFile().exists() && offset < unique_id.length()) 110 114 { … … 127 131 Path target_path = assoc_path.resolve(target_filename); 128 132 logger.info("VideoDocument - symlinking original video into assoc directory [IO]"); 133 logger.info("[DEBUG] Raw Video Path: " + raw_video_path); 134 logger.info("[DEBUG] Target Path: " + target_path); 129 135 try 130 136 { … … 134 140 catch (UnsupportedOperationException ex) 135 141 { 142 logger.warn("Symlinking not supported"); 136 143 } 137 144 // All other exceptions can be fatal … … 141 148 } 142 149 // - copy if the file doesn't exist yet 143 if ( !target_path.toFile().exists())150 if (Files.notExists(target_path)) 144 151 { 145 152 logger.info("VideoDocument - symlink failed, copying instead [IO]"); … … 156 163 157 164 // 1. Extract Metadata using MediaInfo and store as properties 165 System.out.println("[F:" + this.epochTime() + ":PR]"); 158 166 logger.info("VideoDocument - extracting video metadata [PR]"); 159 167 try … … 270 278 } 271 279 280 System.out.println("[F:" + this.epochTime() + ":IO]"); 272 281 logger.info("VideoDocument - associating keyframes to video [IO]"); 273 282 File files[] = assoc_path.toFile().listFiles(); … … 309 318 310 319 // 4. Create a dummy reader around some dummy text and then tokenize it 311 logger.info("VideoDocument - feed dummy text as token stream to indexer"); 320 System.out.println("[F:" + this.epochTime() + ":PR]"); 321 logger.info("VideoDocument - feed dummy text as token stream to indexer [PR]"); 312 322 try 313 323 { … … 320 330 } 321 331 logger.info("VideoDocument - Complete!"); 332 System.out.println("[F:" + this.epochTime() + "] Complete"); 322 333 } 323 334 /** VideoDocument(InputStream istream, Map<String,String> default_properties, Tokeniser tok) **/ … … 333 344 } 334 345 /** endOfDocument() **/ 346 347 /** @function epochTime 348 * Returns the current time in seconds since 1970JAN01 349 */ 350 public long epochTime() 351 { 352 return System.currentTimeMillis()/1000; 353 } 354 /** epochTime() **/ 335 355 336 356 /** Returns the underlying map of all the properties defined by this Document.
Note:
See TracChangeset
for help on using the changeset viewer.