Package org.gudy.azureus2.plugins.disk

Examples of org.gudy.azureus2.plugins.disk.DiskManagerFileInfo


    }

    HashMap<String, Object> map = new HashMap<String, Object>();

    TranscodeFile transcodeFile = job.getTranscodeFile();
    DiskManagerFileInfo sourceFileInfo = null;
    try {
      sourceFileInfo = transcodeFile.getSourceFile();
    } catch (Throwable t) {
    }
   
    // Don't worry, we don't send the filename, just the extension.  This
    // helps us figure out which file types are failing/succeeding the most
    if (sourceFileInfo != null) {
      String extension = FileUtil.getExtension(sourceFileInfo.getFile().getName()).toLowerCase();
      long len = sourceFileInfo.getLength();
      /*
      if (Arrays.binarySearch(ignoreExtensions, extension) >= 0
          || extension.matches("^\\.r[0-9][0-9]$") || len < 768000) {
        return;
      }
      */
      map.put("source-file-ext", extension);
      map.put("source-file-size", new Long(len));
    }
   
   
    DiskManagerFileInfo targetFileInfo = null;
    try {
      targetFileInfo = transcodeFile.getTargetFile();
    } catch (Throwable t) {
    }
    TranscodeProfile profile = job.getProfile();
    TranscodeTarget target = job.getTarget();
    Device device = target.getDevice();
   
    addPluginVersionsToMap(map);

    map.put("job-state", Integer.valueOf(stateOveride));

    if ((stateOveride & 0xff) == TranscodeJob.ST_FAILED) {
      String error = job.getError();
      if (error != null) {
        if (error.endsWith("\r\n")) {
          error.substring(0, error.length() - 2);
        } else if (error.endsWith("\r") || error.endsWith("\n")) {
          error.substring(0, error.length() - 1);
        }
      }
      map.put("job-error", error);
    }
   
    try {
      Torrent torrent = job.getFile().getDownload().getTorrent();
      if (PlatformTorrentUtils.isContent(torrent, true)) {
        map.put("asset-hash", new HashWrapper(torrent.getHash()).toBase32String());
      }
    } catch (Throwable t) {
    }

    map.put("transcode-mode", new Integer(job.getTranscodeRequirement()));
    map.put("transcode-required", new Boolean(transcodeFile.getTranscodeRequired()));

    // These help us determine if the transcode is taking too long
    map.put("transcode-video-width", new Long(transcodeFile.getVideoWidth()));
    map.put("transcode-video-height", new Long(transcodeFile.getVideoHeight()));
    map.put("transcode-video-duration-ms", new Long(transcodeFile.getDurationMillis()));
    map.put("process-time-ms", new Long(job.getProcessTime()));

    // Gotta know which device/profile/renderer we are transcoding to so we
    // know what's should be worked on more
    map.put("device-name", getDeviceName(device));
    map.put("device-type", new Integer(device.getType()));
    if (profile != null) {
      map.put("profile-name", profile.getName());
    }
   
    if (target instanceof DeviceMediaRenderer) {
      DeviceMediaRenderer renderer = (DeviceMediaRenderer) target;
      map.put("renderer-species", Integer.valueOf(renderer.getRendererSpecies()));
    }

    if (targetFileInfo != null) {
      map.put("target-file-ext", FileUtil.getExtension(targetFileInfo.getFile().getName()));
      map.put("target-file-size", new Long(targetFileInfo.getLength()));
    }
   

    PlatformMessage message = new PlatformMessage("AZMSG", LISTENER_ID,
        OP_QOS_TRANSCODE, map, 5000);
View Full Code Here


        return( acf );
      }   
     
      final TOTorrent torrent = ((TorrentImpl)t_torrent).getTorrent();
     
      final DiskManagerFileInfo  file = download.getDiskManagerFileInfo()[index];

      if ( PlatformTorrentUtils.isContent( torrent, false )){
     
        acf =
          new AzureusContentFile()
          {
            public DiskManagerFileInfo
            getFile()
            {
              return( file );
            }
           
            public Object
            getProperty(
              String    name )
            {
              try{
                if ( name.equals( PT_DURATION )){
                 
                  long duration = PlatformTorrentUtils.getContentVideoRunningTime( torrent );
                 
                  if ( duration > 0 ){
                   
                      // secs -> millis
                   
                    return( new Long( duration*1000 ));
                  }
                }else if ( name.equals( PT_VIDEO_WIDTH )){
   
                  int[] res = PlatformTorrentUtils.getContentVideoResolution(torrent);
                 
                  if ( res != null ){
                   
                    return(new Long( res[0]));
                  }               
                }else if ( name.equals( PT_VIDEO_HEIGHT )){
   
                  int[] res = PlatformTorrentUtils.getContentVideoResolution(torrent);
                 
                  if ( res != null ){
                   
                    return(new Long( res[1] ));
                  }
                }else if ( name.equals( PT_DATE )){
   
                  return( new Long( file.getDownload().getCreationTime()));
                 
                }else if ( name.equals( PT_CATEGORIES )){

                  try{
                    String cat = file.getDownload().getCategoryName();
                   
                    if ( cat != null && cat.length() > 0 ){
                     
                      if ( !cat.equalsIgnoreCase( "Categories.uncategorized" )){
                     
                        return( new String[]{ cat });
                      }
                    }
                  }catch( Throwable e ){
                   
                  }
                 
                  return( new String[0] );
                 
                }else if ( name.equals( PT_PERCENT_DONE )){
                 
                  long  size = file.getLength();
                 
                  return( new Long( size==0?100:(1000*file.getDownloaded()/size )));
                 
                }else if ( name.equals( PT_ETA )){             
               
                  return( getETA( file ));
                }
              }catch( Throwable e ){             
              }
             
              return( null );
            }
          };
      }else{
        acf =
            new AzureusContentFile()
            {
              public DiskManagerFileInfo
              getFile()
              {
                return( file );
              }
             
              public Object
              getProperty(
                String    name )
              {
                try{
                  if ( name.equals( PT_DATE )){
 
                    return( new Long( file.getDownload().getCreationTime()));
                   
                  }else if ( name.equals( PT_CATEGORIES )){

                    try{
                      String cat = file.getDownload().getCategoryName();
                     
                      if ( cat != null && cat.length() > 0 ){
                       
                        if ( !cat.equalsIgnoreCase( "Categories.uncategorized" )){
                       
                          return( new String[]{ cat });
                        }
                      }
                    }catch( Throwable e ){
                     
                    }
                   
                    return( new String[0] );
                   
                  }else if ( name.equals( PT_PERCENT_DONE )){
                   
                    long  size = file.getLength();
                   
                    return( new Long( size==0?100:(1000*file.getDownloaded()/size )));
 
                  }else if ( name.equals( PT_ETA )){             
                 
                    return( getETA( file ));
                  }
View Full Code Here

    String text;
   
    if ( job == null){
     
      try{
        DiskManagerFileInfo sourceFile = getSourceFile();
       
        try {
          Download download = sourceFile.getDownload();
         
          if ( download == null ){
           
            text = sourceFile.getFile().getName();
           
          }else{
           
            text = download.getName();
           
            DiskManagerFileInfo[] fileInfo = download.getDiskManagerFileInfo();
           
            if (fileInfo.length > 1) {
             
              text += ": " + sourceFile.getFile().getName();
            }
          }
        }catch (DownloadException e ){
         
          text = sourceFile.getFile().getName();
        }
     
      }catch( Throwable e ){

        text = "";
View Full Code Here

      return( new DiskManagerFileInfoFile( cache_file ));
    }
   
    if ( getBoolean( KEY_NO_XCODE )){
     
      DiskManagerFileInfo res = getSourceFile();
     
      if ( res instanceof DiskManagerFileInfoFile ){
       
        return( res );
       
View Full Code Here

        } catch (DownloadException e) {
        }
      } else if (ds instanceof TranscodeFile) {
        TranscodeFile tf = (TranscodeFile) ds;
        try {
          DiskManagerFileInfo file = tf.getSourceFile();
          return PluginCoreUtils.unwrap(file);
        } catch (DownloadException e) {
        }
      }
View Full Code Here

      } else if (ds instanceof ISelectedContent) {
        return getDM(((ISelectedContent)ds).getDownloadManager());
      } else   if (ds instanceof TranscodeJob) {
        TranscodeJob tj = (TranscodeJob) ds;
        try {
          DiskManagerFileInfo file = tj.getFile();
          if (file != null) {
            Download download = tj.getFile().getDownload();
            if (download != null) {
              return PluginCoreUtils.unwrap(download);
            }
          }
        } catch (DownloadException e) {
        }
      } else if (ds instanceof TranscodeFile) {
        TranscodeFile tf = (TranscodeFile) ds;
        try {
          DiskManagerFileInfo file = tf.getSourceFile();
          if (file != null) {
            Download download = file.getDownload();
            if (download != null) {
              return PluginCoreUtils.unwrap(download);
            }
          }
        } catch (DownloadException e) {
View Full Code Here

    }

    if (ds instanceof TranscodeFile) {
      TranscodeFile tf = (TranscodeFile) ds;
      try {
        DiskManagerFileInfo file = tf.getSourceFile();
        if (file != null) {
          Download download = file.getDownload();
          if (download != null) {
            Torrent torrent = download.getTorrent();
            if (torrent != null) {
              return PluginCoreUtils.unwrap(torrent);
            }
          }
        }
      } catch (Throwable e) {
      }
    }

    if (ds instanceof TranscodeJob) {
      TranscodeJob tj = (TranscodeJob) ds;
      try {
        DiskManagerFileInfo file = tj.getFile();
        if (file != null) {
          Download download = tj.getFile().getDownload();
         
          if (download != null) {
            Torrent torrent = download.getTorrent();
View Full Code Here

        // assume 32 byte string is a hash and that it belongs to the def. network
        id = ConstantsVuze.getDefaultContentNetwork().getID();
      } else   if (ds instanceof TranscodeJob) {
        TranscodeJob tj = (TranscodeJob) ds;
        try {
          DiskManagerFileInfo file = tj.getFile();
          if (file != null) {
            Download download = tj.getFile().getDownload();
            if (download != null) {
              DownloadManager dm = PluginCoreUtils.unwrap(download);
              return getContentNetwork(dm);
            }
          }
        } catch (DownloadException e) {
        }
      } else if (ds instanceof TranscodeFile) {
        TranscodeFile tf = (TranscodeFile) ds;
        try {
          DiskManagerFileInfo file = tf.getSourceFile();
          if (file != null) {
            Download download = file.getDownload();
            if (download != null) {
              DownloadManager dm = PluginCoreUtils.unwrap(download);
              return getContentNetwork(dm);
            }
          }
View Full Code Here

    }
    return true;
  }
 
  public static File getPrimaryFile(Download d) {
    DiskManagerFileInfo info = getPrimaryFileInfo(d);

    if ( info == null ){
      return( null );
    }else{
      return( info.getFile( true ));
    }
  }
View Full Code Here

  public static int getPrimaryFileIndex(DownloadManager dm ){
    return( getPrimaryFileIndex( PluginCoreUtils.wrap( dm )));
  }
 
  public static int getPrimaryFileIndex(Download d) {
    DiskManagerFileInfo info = getPrimaryFileInfo(d);
   
    if ( info == null ){
      return( -1 );
    }else{
      return( info.getIndex());
    }
  }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.disk.DiskManagerFileInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.