示例#1
0
  /**
   * @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;
  }
示例#2
0
 private IPCInterface getMediaIpc() {
   if (mediaIpc == null) {
     final PluginInterface mediaInterface = pluginManager.getPluginInterfaceByID("azupnpav", true);
     if (mediaInterface == null) {
       throw new RuntimeException(
           "couldnot find azupnpav plugin - check it is installed and started up");
     }
     mediaIpc = mediaInterface.getIPC();
   }
   return mediaIpc;
 }