Package net.pms.formats

Examples of net.pms.formats.Format


        entry.title = new File(entry.fileName).getName();
      }
      LOGGER.debug("Adding " + (pls ? "PLS " : (m3u ? "M3U " : "")) + "entry: " + entry);

      String ext = "." + FileUtil.getUrlExtension(entry.fileName);
      Format f = FormatFactory.getAssociatedFormat(ext);
      int type = f == null ? defaultContent : f.getType();

      if (! isweb && ! FileUtil.isUrl(entry.fileName)) {
        File en = new File(FilenameUtils.concat(getPlaylistfile().getParent(), entry.fileName));
        if (en.exists()) {
          addChild(type == Format.PLAYLIST ? new PlaylistFolder(en) : new RealFile(en, entry.title));
View Full Code Here


      return "[" + fileName + "," + title + "]";
    }
  }

  public static DLNAResource getPlaylist(String name, String uri, int type) {
    Format f = FormatFactory.getAssociatedFormat("." + FileUtil.getUrlExtension(uri));
    if (f != null && f.getType() == Format.PLAYLIST) {
      switch (f.getMatchedExtension()) {
        case "m3u":
        case "m3u8":
        case "pls":
          return new PlaylistFolder(name, uri, type);
        case "cue":
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isCompatible(DLNAResource resource) {
    Format format = resource.getFormat();

    if (format != null) {
      if (format.getIdentifier() == Format.Identifier.WEB) {
        return false;
      }
    }

    DLNAMediaSubtitle subtitle = resource.getMediaSubtitle();
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isCompatible(DLNAResource resource) {
    Format format = resource.getFormat();

    if (format != null) {
      if (format.getIdentifier() == Format.Identifier.WEB) {
        return false;
      }
    }

    DLNAMediaSubtitle subtitle = resource.getMediaSubtitle();
View Full Code Here

  // Returns whether or not the supplied DLNA resource matches the supplied format and format identifier
  private static boolean isType(DLNAResource resource, int matchType, Format.Identifier matchIdentifier) {
    boolean match = false;

    if (resource != null) {
      Format format = resource.getFormat();

      // the int returned by format.getType() is a bitmap, so match by checking the bit is set
      // XXX the old isCompatible implementations (incorrectly) used to match
      // with getType() == matchType
      if ((format != null) && ((format.getType() & matchType) == matchType)) {
        if (matchIdentifier == null) { // match any identifier
          match = true;
        } else { // match the specified format identifier
          Format.Identifier identifier = format.getIdentifier();
          match = identifier.equals(matchIdentifier);
        }
      }
    }
View Full Code Here

  // technically, these don't need to be synchronized as there should be
  // one thread per request/response, but it doesn't hurt to enforce the contract
  public synchronized void start(DLNAResource dlna) {
    assert this.dlna == null;
    this.dlna = dlna;
    Format ext = dlna.getFormat();
    // only trigger the start/stop events for audio and video
    if (!started && ext != null && (ext.isVideo() || ext.isAudio())) {
      dlna.startPlaying(rendererId);
      started = true;
    }
  }
View Full Code Here

   * Test edge cases for {@link FormatFactory#getAssociatedExtension(String)}.
   */
  @Test
  public final void testFormatFactoryEdgeCases() {
    // Null string
    Format result = FormatFactory.getAssociatedExtension(null);
    assertNull("Null string matches no format", result);

    // Empty string
    result = FormatFactory.getAssociatedExtension("");
    assertNull("Empty string matches no extension", result);
View Full Code Here

   *            The filename to verify.
   * @param formatName
   *            The name of the expected format.
   */
  private void testSingleFormat(final String filename, final String formatName) {
    Format result = FormatFactory.getAssociatedExtension(filename);

    if (result != null) {
      assertEquals("\"" + filename + "\" is expected to match",
          formatName, result.toString());
    } else {
      assertNull("\"" + filename + "\" is expected to match nothing", formatName);
    }
  }
View Full Code Here

TOP

Related Classes of net.pms.formats.Format

Copyright © 2018 www.massapicom. 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.