Examples of GlobalManager


Examples of org.gudy.azureus2.core3.global.GlobalManager

        String dropped = (String) payload;
        String[] split = Constants.PAT_SPLIT_SLASH_N.split(dropped);
        if (split.length > 1) {
          String type = split[0];
          if (type.startsWith("DownloadManager")) {
            GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
            for (int i = 1; i < split.length; i++) {
              String hash = split[i];

              try {
                DownloadManager dm = gm.getDownloadManager(new HashWrapper(
                    Base32.decode(hash)));

                if (dm != null) {
                  TorrentUtil.assignToCategory(new Object[] {
                    dm
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

  private static void recountUnopened() {
    if (!AzureusCoreFactory.isCoreRunning()) {
      return;
    }
    GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
    List<?> dms = gm.getDownloadManagers();
    statsNoLowNoise.numUnOpened = 0;
    for (Iterator<?> iter = dms.iterator(); iter.hasNext();) {
      DownloadManager dm = (DownloadManager) iter.next();
      if (!PlatformTorrentUtils.getHasBeenOpened(dm) && dm.getAssumedComplete()) {
        statsNoLowNoise.numUnOpened++;
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

        VuzeActivitiesEntry entry = (VuzeActivitiesEntry) ds;
        DownloadManager dm = entry.getDownloadManger();
        if (dm == null) {
          String assetHash = entry.getAssetHash();
          if (assetHash != null && AzureusCoreFactory.isCoreRunning()) {
            GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
            dm = gm.getDownloadManager(new HashWrapper(Base32.decode(assetHash)));
            entry.setDownloadManager(dm);
          }
        }
        return dm;
      } else if ((ds instanceof TOTorrent) && AzureusCoreFactory.isCoreRunning()) {
        GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
        return gm.getDownloadManager((TOTorrent) ds);
      } else if (ds instanceof ISelectedContent) {
        return getDM(((ISelectedContent)ds).getDownloadManager());
      } else   if (ds instanceof TranscodeJob) {
        TranscodeJob tj = (TranscodeJob) ds;
        try {
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

    }
   
    if (ds instanceof String) {
      String hash = (String) ds;
      try {
        GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
        DownloadManager dm = gm.getDownloadManager(new HashWrapper(Base32.decode(hash)));
        if (dm != null) {
          return dm.getTorrent();
        }
      } catch (Exception e) {
        // ignore
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

 
    if (!AzureusCoreFactory.isCoreRunning()) {
      return false;
    }

    GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
    DownloadManager dm = gm.getDownloadManager(torrent);
 
 
    if (dm != null) {
      return dm.getAssumedComplete() || canUseEMP(torrent, file_index);
    }
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

  // @see com.aelitis.azureus.ui.selectedcontent.ISelectedContent#getDM()
  public DownloadManager getDownloadManager() {
    if (dm == null && hash != null) {
      try {
        GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
        return gm.getDownloadManager(new HashWrapper(Base32.decode(hash)));
      } catch (Exception ignore) {
       
      }
    }
    return dm;
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

            Arrays.sort(dms, new Comparator<DownloadManager>() {
              public int compare(DownloadManager a, DownloadManager b) {
                return a.getPosition() - b.getPosition();
              }
            });
            GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
            for (int i = 0; i < dms.length; i++) {
              DownloadManager dm = dms[i];
              if (gm.isMoveableUp(dm)) {
                gm.moveUp(dm);
              }
            }
          }
        }
      }

      // @see com.aelitis.azureus.ui.swt.toolbar.ToolBarItem#triggerToolBarItemHold()
      public boolean triggerToolBarItemHold() {
        return moveTop();
      }
    };
    addToolBarItem(item, "toolbar.area.sitem", so2nd);
    addSeperator(so2nd);

    // ==down
    item = new ToolBarItem("down", "image.toolbar.down", "v3.iconBar.down") {
      public void triggerToolBarItem() {
        if (!AzureusCoreFactory.isCoreRunning()) {
          return;
        }

        if (!triggerBasicToolBarItem(getId())) {
          GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
          DownloadManager[] dms = SelectedContentManager.getDMSFromSelectedContent();
          if (dms != null) {
            Arrays.sort(dms, new Comparator<DownloadManager>() {
              public int compare(DownloadManager a, DownloadManager b) {
                return b.getPosition() - a.getPosition();
              }
            });
            for (int i = 0; i < dms.length; i++) {
              DownloadManager dm = dms[i];
              if (gm.isMoveableDown(dm)) {
                gm.moveDown(dm);
              }
            }
          }
        }
      }
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

  protected boolean moveBottom() {
    if (!AzureusCoreFactory.isCoreRunning()) {
      return false;
    }

    GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
    DownloadManager[] dms = SelectedContentManager.getDMSFromSelectedContent();
    if (dms != null) {
      gm.moveEnd(dms);
    }
    return true;
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

  protected boolean moveTop() {
    if (!AzureusCoreFactory.isCoreRunning()) {
      return false;
    }
    GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
    DownloadManager[] dms = SelectedContentManager.getDMSFromSelectedContent();
    if (dms != null) {
      gm.moveTop(dms);
    }
    return true;
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.global.GlobalManager

    String url = dlInfo.getDownloadURL();
    try {
      Matcher m = hashPattern.matcher(url);
      if (m.find()) {
        String hash = m.group(1);
        GlobalManager gm = core.getGlobalManager();
        final DownloadManager dm = gm.getDownloadManager(new HashWrapper(
            Base32.decode(hash)));
        if (dm != null) {
          if (playNow || playPrepare) {
            new AEThread2("playExisting", true) {

              public void run() {
                if (playNow) {
                  Debug.outNoStack("loadTorrent already exists.. playing",
                      false);

                  TorrentListViewsUtils.playOrStream(dm, -1);
                } else {
                  Debug.outNoStack("loadTorrent already exists.. preparing",
                      false);

                  PlayUtils.prepareForPlay(dm);
                }
              }

            }.start();
          } else {
            new MessageBoxShell(SWT.OK,
                MSG_ALREADY_EXISTS, new String[] {
                  " ",
                  dm.getDisplayName(),
                  MessageText.getString(MSG_ALREADY_EXISTS_NAME),
                }).open(null);
          }
          return;
        }
      }

      // If it's going to our URLs, add some extra authenication
      if (UrlFilter.getInstance().urlCanRPC(url)) {
        ContentNetwork cn = null;
        if (dlInfo instanceof DownloadUrlInfoContentNetwork) {
          cn = ((DownloadUrlInfoContentNetwork) dlInfo).getContentNetwork();
        }
        if (cn == null) {
          cn = ConstantsVuze.getDefaultContentNetwork();
        }
        url = cn.appendURLSuffix(url, false, true);
      }

      UIFunctionsSWT uiFunctions = (UIFunctionsSWT) UIFunctionsManager.getUIFunctions();
      if (uiFunctions != null) {
        if (!COConfigurationManager.getBooleanParameter("add_torrents_silently")) {
          if (bringToFront) {
            uiFunctions.bringToFront();
          }
        }

        Shell shell = uiFunctions.getMainShell();
        if (shell != null) {
          new FileDownloadWindow(shell, url, dlInfo.getReferer(),
              dlInfo.getRequestProperties(),
              new TorrentDownloaderCallBackInterface() {

                public void TorrentDownloaderEvent(int state,
                    TorrentDownloader inf) {
                  if (state == TorrentDownloader.STATE_FINISHED) {

                    File file = inf.getFile();
                    file.deleteOnExit();

                    // Do a quick check to see if it's a torrent
                    if (!TorrentUtil.isFileTorrent(file, Utils.findAnyShell(),
                        file.getName())) {
                      return;
                    }

                    TOTorrent torrent;
                    try {
                      torrent = TorrentUtils.readFromFile(file, false);
                    } catch (TOTorrentException e) {
                      Debug.out(e);
                      return;
                    }
                    // Security: Only allow torrents from whitelisted trackers
                    if (playNow
                        && !PlatformTorrentUtils.isPlatformTracker(torrent)) {
                      Debug.out("stopped loading torrent because it's not in whitelist");
                      return;
                    }

                    HashWrapper hw;
                    try {
                      hw = torrent.getHashWrapper();
                    } catch (TOTorrentException e1) {
                      Debug.out(e1);
                      return;
                    }

                    GlobalManager gm = core.getGlobalManager();

                    if (playNow || playPrepare) {
                      DownloadManager existingDM = gm.getDownloadManager(hw);
                      if (existingDM != null) {
                        if (playNow) {
                          TorrentListViewsUtils.playOrStream(existingDM, -1);
                        } else {
                          PlayUtils.prepareForPlay(existingDM);
                        }
                        return;
                      }
                    }

                    final HashWrapper fhw = hw;

                    GlobalManagerListener l = new GlobalManagerAdapter() {
                      public void downloadManagerAdded(DownloadManager dm) {

                        try {
                          core.getGlobalManager().removeListener(this);

                          handleDMAdded(dm, playNow, playPrepare, fhw);
                        } catch (Exception e) {
                          Debug.out(e);
                        }
                      }

                    };
                    gm.addListener(l, false);

                    if (playNow || playPrepare) {
                      PlayNowList.add(hw);
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.