Пример #1
0
  private void showMedia(ServerMediaFile toShow)
      throws MediaDoesNotExsistException, MediaListsEmptyException, PriorityDoesNotExistException {
    if (this.currentFile != null) {
      this.currentFile.setCurrent(false);
    }
    this.currentFile = toShow;
    toShow.setCurrent(true).increaseShowCount();

    if (toShow instanceof VideoFile) {
      this.serverGUI.setVideoFinishedListener(
          new VideoFinishListener() {

            @Override
            public void videoFinished()
                throws MediaDoesNotExsistException, MediaListsEmptyException,
                    PriorityDoesNotExistException {
              if (MessageProxyServer.this.automodeEnabled) {
                showNextMediaFile();
              }
            }
          });
    } else {
      updateAutoModeTimer();
    }

    try {
      this.serverGUI.showMediaFileInMainComponent(this.currentFile);
    } catch (IOException e) {
      log.log(Level.WARNING, "Media file could not be shown.", e);
      return;
    }
    broadcastMessage(new Message(OpCode.STC_SHOW_MEDIA_FILE_ACK, toShow.getId()));
  }
Пример #2
0
  private void editMediaFile(Message msg)
      throws MediaDoesNotExsistException, FileNotFoundException, IOException, URISyntaxException {
    ClientMediaFile editedFile = (ClientMediaFile) msg.getData().get(0);
    ServerMediaFile correlatedServerFile = this.mediaModel.getMediaFileById(editedFile.getId());
    correlatedServerFile.setName(editedFile.getName());
    correlatedServerFile.setPriority(editedFile.getPriorityID());
    broadcastMessage(
        new Message(OpCode.STC_EDIT_MEDIA_FILE_ACK, new ClientMediaFile(correlatedServerFile)));

    this.prefsModel.serializeMediaDatabase();
  }
Пример #3
0
  private void showNextMediaFile()
      throws MediaDoesNotExsistException, MediaListsEmptyException, PriorityDoesNotExistException {
    boolean fileFromPrivateQueue = false;
    if (!this.mediaModel.getMediaPrivateQueue().isEmpty()) {
      fileFromPrivateQueue = true;
    }
    ServerMediaFile fileToShow = this.mediaModel.getNext();

    showMedia(fileToShow);

    if (fileFromPrivateQueue) {
      broadcastMessage(
          new Message(OpCode.STC_DEQUEUE_MEDIAFILE_ACK, new DequeueData(0, fileToShow.getId())));
    }
  }