}
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);