Examples of MPD


Examples of org.a0z.mpd.MPD

   * @throws MPDServerException
   */
  private MPD getInstance() throws MPDServerException, UnknownHostException {
    if (mpdPlayer == null) {
      try {
        mpdPlayer = new MPD(PropertyHelper.getInstance().getMPDHost(), PropertyHelper.getInstance().getMPDPort());
      } catch (Exception e) {
        throw new MPDServerException("Unabled to load MPD config from settings: " + e.getMessage(), e);
      }
    }
    return mpdPlayer;
View Full Code Here

Examples of org.bff.javampd.MPD

  private void executePlayerCommand(String playerCommandLine, Object commandParams) {
    String[] commandParts = playerCommandLine.split(":");
    String playerId = commandParts[0];
    String playerCommand = commandParts[1];

    MPD daemon = findMPDInstance(playerId);
    if (daemon == null) {
      // we give that player another chance -> try to reconnect
      reconnect(playerId);
    }
   
    if (daemon != null) {
      PlayerCommandTypeMapping pCommand = null;     
      try {
        pCommand = PlayerCommandTypeMapping.fromString(playerCommand);
        MPDPlayer player = daemon.getMPDPlayer();
       
        switch (pCommand) {
          case PAUSE: player.pause(); break;
          case PLAY: player.play(); break;
          case STOP: player.stop(); break;
          case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break;
          case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break;
          case NEXT: player.playNext(); break;
          case PREV: player.playPrev(); break;
          case ENABLE:
          case DISABLE:
            Integer outputId = Integer.valueOf((String) commandParams);
            MPDAdmin admin = daemon.getMPDAdmin();
            MPDOutput output = new MPDOutput(outputId - 1); // internally mpd uses 0-based indexing
            if (pCommand == PlayerCommandTypeMapping.ENABLE) {
              admin.enableOutput(output);
            } else {
              admin.disableOutput(output);
View Full Code Here

Examples of org.bff.javampd.MPD

      }
    }   
  }
 
  private void determinePlayStateChange(String playerId) {   
    MPD daemon = findMPDInstance(playerId);
    if (daemon == null) {
      // we give that player another chance -> try to reconnect
      reconnect(playerId);
    }
    if (daemon != null) {
      try {
        MPDPlayer player = daemon.getMPDPlayer();
       
        // get the song object here
        PlayerStatus ps = player.getStatus();
       
        PlayerStatus curPs = playerStatusCache.get(playerId);
View Full Code Here

Examples of org.bff.javampd.MPD

      logger.warn("didn't find player configuration instance for playerId '{}'", playerId);
    }       
  }
 
  private void determineSongChange(String playerId) {
    MPD daemon = findMPDInstance(playerId);
    if (daemon == null) {
      // we give that player another chance -> try to reconnect
      reconnect(playerId);
    }
    if (daemon != null) {
      try {
        MPDPlayer player = daemon.getMPDPlayer();
       
        // get the song object here
        MPDSong curSong = player.getCurrentSong();       
       
        MPDSong curSongCache = songInfoCache.get(playerId);
View Full Code Here

Examples of org.bff.javampd.MPD

    try {
       
        config = playerConfigCache.get(playerId);
        if (config != null && config.instance == null) {
         
          MPD mpd = new MPD(config.host, config.port, config.password, CONNECTION_TIMEOUT);
         
            MPDStandAloneMonitor mpdStandAloneMonitor = new MPDStandAloneMonitor(mpd, 500);
              mpdStandAloneMonitor.addVolumeChangeListener(this);
              mpdStandAloneMonitor.addPlayerChangeListener(this);
              mpdStandAloneMonitor.addTrackPositionChangeListener(this);             
View Full Code Here

Examples of org.bff.javampd.MPD

      MpdPlayerConfig playerConfig = playerConfigCache.get(playerId);
      MPDStandAloneMonitor monitor = playerConfig.monitor;
      if (monitor != null) {
        monitor.stop();
      }
          MPD mpd = playerConfig.instance;
          if (mpd != null) {
            mpd.close();
          }
    } catch (MPDConnectionException ce) {
      logger.warn("couldn't disconnect player {}", playerId);
    } catch (MPDResponseException re) {
      logger.warn("received response error {}", re.getLocalizedMessage());
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.