/** * @param dl * @since 3.0.2.3 */ public static String getMediaServerContentURL(Download dl) { // TorrentListViewsUtils.debugDCAD("enter - getMediaServerContentURL"); PluginManager pm = AzureusCoreFactory.getSingleton().getPluginManager(); PluginInterface pi = pm.getPluginInterfaceByID("azupnpav", false); if (pi == null) { Logger.log(new LogEvent(LogIDs.UI3, "Media server plugin not found")); return null; } if (!pi.getPluginState().isOperational()) { Logger.log(new LogEvent(LogIDs.UI3, "Media server plugin not operational")); return null; } try { Program program = Program.findProgram(".qtl"); boolean hasQuickTime = program == null ? false : (program.getName().toLowerCase().indexOf("quicktime") != -1); pi.getIPC().invoke("setQuickTimeAvailable", new Object[] {new Boolean(hasQuickTime)}); Object url = pi.getIPC().invoke("getContentURL", new Object[] {dl}); if (url instanceof String) { return (String) url; } } catch (Throwable e) { Logger.log( new LogEvent(LogIDs.UI3, LogEvent.LT_WARNING, "IPC to media server plugin failed", e)); } return null; }
public static boolean play(File file, String ext) { boolean played = false; if (ext != null) { IPreferenceStore store = Akj_betasPlugin.getDefault().getPreferenceStore(); String playerPath = store.getString(FLVToolsPage.PLAYER_PATH); if (playerPath.length() > 0) { File player = new File(playerPath); if (player.exists()) { doPlay(player, file); return true; } } // i don't know reason why. // return Program.launch(file.getAbsolutePath()); Program program = Program.findProgram(ext); if (program != null) { log.info("file:" + file.getAbsolutePath()); // program.execute(file.getAbsolutePath()); played = true; } } else { log.warn("no extension:" + file); } return played; }
public boolean isProgramInstalled(String extension, String name) { if (!extension.startsWith(".")) { extension = "." + extension; } Program program = Program.findProgram(extension); return (program == null ? false : (program.getName().toLowerCase(Locale.US).indexOf(name.toLowerCase(Locale.US)) != -1)); }
/** See {@link #getIcon(File, Image)}. */ @Nullable public Image getIcon(@NotNull String filename, @Nullable Image defaultIcon) { String extension = Util.getExtension(filename); Image image = fileIconMap.get(extension); if (image != null) return image; Program program = Program.findProgram(extension); if (program == null) return defaultIcon; ImageData imgData = program.getImageData(); if (imgData == null) return defaultIcon; image = new Image(disposeWidget.getDisplay(), imgData); fileIconMap.put(extension, image); return image; }