Examples of ItunesHost


Examples of org.cdavies.itunes.ItunesHost

    super();
        this.one2 = god;
  }

  private boolean tryLogin(SongData songData) {
      ItunesHost h = null;
     
      for (int i = 0; i < this.one2.knownIPs.size(); i++) {         
          h = (ItunesHost) this.one2.knownIPs.get(i);
          if (h.getAddress().equals(songData.server))
              break;
      }
     
      _status = new ConnectionStatus(h);
     
View Full Code Here

Examples of org.cdavies.itunes.ItunesHost

  }
 
  public void run()
  {
      One2OhMyGod.debugPrint("STARTING THE THREAD\n");
      ItunesHost h = null ;
      ConnectionStatus _status = null;

     
      while(true){
          while(this.one2.seenhosts.size() == 0 || isPaused()){               
              try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
          }
     
          h = (ItunesHost) one2.seenhosts.remove(0);
          One2OhMyGod.debugPrint("trying host: " + h.getAddress());
          _status = new ConnectionStatus(h);
     
          final String connectString =
        new String(
          "Connecting to Host: "
            + h.getName()
            + " ("
            + h.getAddress()
            + ")");

         
          one2.doStatusUpdate(connectString);
         
          try  {
              one2.connectToHost(h.getAddress(), _status);
          } catch (NoServerPermissionException e1) {
              one2.hostQueueModel.updateStatus(h.getAddress(), HostTableModel.FAILED);
          } catch (OutOfMemoryError e) {
            System.gc();
            one2.hostQueueModel.updateStatus(h.getAddress(), HostTableModel.FAILED);
          }
         
         one2.doStatusUpdate(" ");
      }
  }
View Full Code Here

Examples of org.cdavies.itunes.ItunesHost

      } catch (Exception e) {}
  }

 
    protected void playSong() {
         ItunesHost playHost = null;
       
        if(!playstop){
            stopPlaying();
            playingRow = -1;
            playstop=true;
            return;
      }
       
        final int selection = songTable.getSelectedRow();
        if (selection > 0){
          SongData songData = new SongData(null,
                    sorter.getAddressAt(selection),
                    sorter.getHostNameAt(selection),
                    Request.ITUNES_PORT,
                    sorter.getDBIDAt(selection).intValue(),
                    sorter.getSongIDAt(selection).intValue(),
                    sorter.getFormatAt(selection),
                    sorter.getSizeAt(selection),
                    sorter.getSessionIDAt(selection).intValue(),
                    null,
                    null
                    );
       
          synchronized(knownIPs){
              for (int i = 0; i < knownIPs.size(); i++) {
                  playHost = (ItunesHost) knownIPs.get(i);
                  if (playHost.getAddress().equals(songData.server))
                      break;
              }
          }

          _playStatus = new ConnectionStatus(playHost);
View Full Code Here

Examples of org.cdavies.itunes.ItunesHost

        }
    }
  }
 
  public void addHost(String name, String address){
      ItunesHost ith = new ItunesHost("", name, 1);
      ConnectionStatus _status = new ConnectionStatus(ith);
      ServerInfoRequest rq = null;
      try {
          rq = new ServerInfoRequest(address,
                  Request.ITUNES_PORT, _status);
      } catch (NoServerPermissionException e) {
          return;
      }
     
      int version;
     
      if (rq.getServerVersion() >= 3)
          version = ItunesHost.ITUNES_45;
      else if (rq.getServerVersion() >= 2)
          version = ItunesHost.ITUNES_4;
      else
          version = ItunesHost.LEGACY;
     
      ith.setVersion(version);
      ith.setAddress(address);   
    
      if(name == null || name.length() == 0){
        ith.setName(rq.getServerName());
      }
     
      boolean seenhost = false;
      //boolean isLocal = isLocalHost(address);
      boolean isLocal = false;
View Full Code Here

Examples of org.cdavies.itunes.ItunesHost

  public void removeService(Rendezvous r, String type, String name) {
    if (name.endsWith("." + type)) {
      name = name.substring(0, name.length() - (type.length() + 1));
    }

      ItunesHost ith = null;
   
    synchronized(knownIPs){
        int hostIndex =knownIPs.indexOf(new ItunesHost("", name, 1));
        if(hostIndex != -1){
            ith= (ItunesHost)knownIPs.get(knownIPs.indexOf(new ItunesHost("", name, 1)));
        }
         knownIPs.remove(new ItunesHost("", name, 1));
    }
   
    songModel.removeHost(name);
    songModel.fireTableDataChanged();
    totalCountL.setText(songModel.getRowCount() + " Songs Total");
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.