Changeset 26241 for gs2-extensions


Ignore:
Timestamp:
2012-09-25T12:41:31+12:00 (12 years ago)
Author:
jmt12
Message:

Modifications to progress messages to improve extracting information from the logs in an automated fashion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/video-and-audio/trunk/src/opt/Terrier/VideoDocument.java

    r26236 r26241  
    8282    // 0. Initialization from arguments
    8383    this.properties = default_properties;
     84    String filepath = this.properties.get("filename");
     85    System.out.println("[F:" + this.epochTime() + "] Starting ingest of " + filepath);
    8486
    8587    // Set properties
     
    8991    this.properties.put("abstract", "This is a video so here is some dummy text to prevent indexer failing.");
    9092    // B. Properties derived from filename
    91     String filepath = this.properties.get("filename");
    9293    String title = filepath.substring(filepath.lastIndexOf(System.getProperty("file.separator")) + 1);
    9394    this.properties.put("title", title);
     
    9596    String target_filename = "doc." + ext;
    9697    this.properties.put("source","doc." + ext);
     98
    9799    // - A unique associated directory. This gets a little tricky as we need
    98100    //   to create the directory at the same time if an effort to promote
    99101    //   synchronous behaviour
     102    System.out.println("[F:" + this.epochTime() + ":PR]");
    100103    String unique_id = this.generateHash(filepath);
    101104    //   - we start with the first 4 characters
     
    107110    //   - then we continue adding blocks of 4 characters until we get a
    108111    //     directory that doesn't already exist
     112    System.out.println("[F:" + this.epochTime() + ":IO]");
    109113    while (assoc_path.toFile().exists() && offset < unique_id.length())
    110114    {
     
    127131    Path target_path = assoc_path.resolve(target_filename);
    128132    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);
    129135    try
    130136    {
     
    134140    catch (UnsupportedOperationException ex)
    135141    {
     142      logger.warn("Symlinking not supported");
    136143    }
    137144    // All other exceptions can be fatal
     
    141148    }
    142149    // - copy if the file doesn't exist yet
    143     if (!target_path.toFile().exists())
     150    if (Files.notExists(target_path))
    144151    {
    145152      logger.info("VideoDocument - symlink failed, copying instead [IO]");
     
    156163
    157164    // 1. Extract Metadata using MediaInfo and store as properties
     165    System.out.println("[F:" + this.epochTime() + ":PR]");
    158166    logger.info("VideoDocument - extracting video metadata [PR]");
    159167    try
     
    270278      }
    271279
     280      System.out.println("[F:" + this.epochTime() + ":IO]");
    272281      logger.info("VideoDocument - associating keyframes to video [IO]");
    273282      File files[] = assoc_path.toFile().listFiles();
     
    309318
    310319    // 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]");
    312322    try
    313323    {
     
    320330    }
    321331    logger.info("VideoDocument - Complete!");
     332    System.out.println("[F:" + this.epochTime() + "] Complete");
    322333  }
    323334  /** VideoDocument(InputStream istream, Map<String,String> default_properties, Tokeniser tok) **/
     
    333344  }
    334345  /** 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() **/
    335355
    336356  /** Returns the underlying map of all the properties defined by this Document.
Note: See TracChangeset for help on using the changeset viewer.