예제 #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;
 }
  private DHT[] getDHTs() {
    if (dhts == null) {

      try {
        PluginManager pm = core.getPluginManager();

        if (pm.isInitialized()) {

          PluginInterface dht_pi = pm.getPluginInterfaceByClass(DHTPlugin.class);

          if (dht_pi == null) {

            dhts = new DHT[0];

          } else {

            DHTPlugin plugin = (DHTPlugin) dht_pi.getPlugin();

            if (!plugin.isInitialising()) {

              if (plugin.isEnabled()) {

                dhts = ((DHTPlugin) dht_pi.getPlugin()).getDHTs();

              } else {

                dhts = new DHT[0];
              }
            }
          }
        }
      } catch (Throwable e) {

        dhts = new DHT[0];
      }
    }

    return (dhts);
  }