Class Track

java.lang.Object
lol.trq.orpheus.Track

public final class Track extends Object
A piece of media. Every field may be missing: text is empty, numbers are -1 or 0, id and uri are null. Text from outside is trimmed and length-capped on construction.
  • Field Details

    • NONE

      public static final Track NONE
  • Constructor Details

    • Track

      public Track(String id, String title, List<String> artists, String album, String albumArtist, long durationMillis, int trackNumber, String uri, MediaKind kind)
      Parameters:
      id - the source's own identifier, or null; never required
      title - the title
      artists - the performing artists, possibly empty
      album - the album title
      albumArtist - the album artist
      durationMillis - the length, or -1 when unknown
      trackNumber - the position on the album, or 0 when unknown
      uri - a location the source can play, or null
      kind - what the source says this is
  • Method Details

    • of

      public static Track of(String title, String artist)
    • withDuration

      public Track withDuration(long millis)
    • id

      public String id()
    • title

      public String title()
    • artists

      public List<String> artists()
    • artistLine

      public String artistLine()
      The artists joined with ", ". Computed once.
    • album

      public String album()
    • albumArtist

      public String albumArtist()
    • durationMillis

      public long durationMillis()
    • trackNumber

      public int trackNumber()
    • uri

      public String uri()
    • kind

      public MediaKind kind()
    • isEmpty

      public boolean isEmpty()
    • sameSong

      public boolean sameSong(Track other)
      Whether two descriptions are the same song. Titles must match after clean-up, at least one artist must match when both sides name any, and the lengths must be within two seconds when both are known. Identifiers are not compared: different sources use different ones.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object