Package org.mpris

Class Metadata.Builder

java.lang.Object
org.mpris.Metadata.Builder
Enclosing class:
Metadata

public static class Metadata.Builder extends Object
Builds Metadata. Setting mpris:trackid is mandatory.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setTrackID

      public Metadata.Builder setTrackID(org.freedesktop.dbus.DBusPath trackID)
      Sets mpris:trackid
      A unique identity for this track within the context of an MPRIS object (eg: tracklist).
      Parameters:
      trackID - The value of mpris:trackid
      Returns:
      This builder
    • setLength

      public Metadata.Builder setLength(long duration)
      Sets mpris:length
      The duration of the track in microseconds.
      Parameters:
      duration - The value of mpris:length
      Returns:
      This builder
    • setArtURL

      public Metadata.Builder setArtURL(URI artURL)
      Sets mpris:artUrl
      The location of an image representing the track or album. Clients should not assume this will continue to exist when the media player stops giving out the URL.
      Parameters:
      artURL - The value of mpris:artUrl
      Returns:
      This builder
    • setAlbumName

      public Metadata.Builder setAlbumName(String albumName)
      Sets xesam:album
      The album name.
      Parameters:
      albumName - The value of xesam:album
      Returns:
      This builder
    • setAlbumArtists

      public Metadata.Builder setAlbumArtists(List<String> albumArtists)
      Sets xesam:albumArtist
      The album artist(s).
      Parameters:
      albumArtists - The value of xesam:albumArtist
      Returns:
      This builder
    • setArtists

      public Metadata.Builder setArtists(List<String> artists)
      Sets xesam:artist
      The track artist(s).
      Parameters:
      artists - The value of xesam:artist
      Returns:
      This builder
    • setAsText

      public Metadata.Builder setAsText(String text)
      Sets xesam:asText
      The track lyrics.
      Parameters:
      text - The value of xesam:asText
      Returns:
      This builder
    • setAudioBPM

      public Metadata.Builder setAudioBPM(int bpm)
      Sets xesam:audioBPM
      The speed of the music, in beats per minute.
      Parameters:
      bpm - The value of xesam:audioBPM
      Returns:
      This builder
    • setAutoRating

      public Metadata.Builder setAutoRating(double autoRating) throws IllegalArgumentException
      Sets xesam:autoRating
      An automatically-generated rating, based on things such as how often it has been played. This should be in the range 0.0 to 1.0.
      Parameters:
      autoRating - The value of xesam:autoRating
      Returns:
      This builder
      Throws:
      IllegalArgumentException
    • setComments

      public Metadata.Builder setComments(List<String> comments)
      Sets xesam:comment
      A (list of) freeform comment(s).
      Parameters:
      comments - The value of xesam:comment
      Returns:
      This builder
    • setComposers

      public Metadata.Builder setComposers(List<String> composers)
      Sets xesam:composer
      The composer(s) of the track.
      Parameters:
      composers - The value of xesam:composer
      Returns:
      This builder
    • setContentCreated

      public Metadata.Builder setContentCreated(Date date, ZoneOffset offset)
      Sets xesam:contentCreated
      When the track was created. Usually only the year component will be useful.
      Parameters:
      date - The value of xesam:contentCreated
      offset - The time zone offset of the date
      Returns:
      This builder
    • setDiscNumber

      public Metadata.Builder setDiscNumber(int discNumber)
      Sets xesam:discNumber
      The disc number on the album that this track is from.
      Parameters:
      discNumber - The value of xesam:discNumber
      Returns:
      This builder
    • setFirstUsed

      public Metadata.Builder setFirstUsed(Date date, ZoneOffset offset)
      Sets xesam:firstUsed
      When the track was first played.
      Parameters:
      date - The value of xesam:firstUsed
      offset - The time zone offset of the date
      Returns:
      This builder
    • setGenres

      public Metadata.Builder setGenres(List<String> genres)
      Sets xesam:genre
      The genre(s) of the track.
      Parameters:
      genres - The value of xesam:genre
      Returns:
      This builder
    • setLastUsed

      public Metadata.Builder setLastUsed(Date date, ZoneOffset offset)
      Sets xesam:lastUsed
      When the track was last played.
      Parameters:
      date - The value of xesam:lastUsed
      offset - The time zone offset of the date
      Returns:
      This builder
    • setLyricists

      public Metadata.Builder setLyricists(List<String> lyricists)
      Sets xesam:lyricist
      The lyricist(s) of the track.
      Parameters:
      lyricists - The value of xesam:lyricist
      Returns:
      This builder
    • setTitle

      public Metadata.Builder setTitle(String title)
      Sets xesam:title
      The track title.
      Parameters:
      title - The value of xesam:title
      Returns:
      This builder
    • setTrackNumber

      public Metadata.Builder setTrackNumber(int trackNumber)
      Sets xesam:trackNumber
      The track number on the album disc.
      Parameters:
      trackNumber - The value of xesam:trackNumber
      Returns:
      This builder
    • setURL

      public Metadata.Builder setURL(URI url)
      Sets xesam:url
      The location of the media file.
      Parameters:
      url - The value of xesam:url
      Returns:
      This builder
    • setUseCount

      public Metadata.Builder setUseCount(int useCount)
      Sets xesam:useCount
      The number of times the track has been played.
      Parameters:
      useCount - The value of xesam:useCount
      Returns:
      This builder
    • setUserRating

      public Metadata.Builder setUserRating(double userRating) throws IllegalArgumentException
      Sets xesam:userRating
      A user-specified rating. This should be in the range 0.0 to 1.0.
      Parameters:
      userRating - The value of xesam:userRating
      Returns:
      This builder
      Throws:
      IllegalArgumentException
    • build

      public Metadata build() throws IllegalArgumentException
      Returns:
      The built metadata
      Throws:
      IllegalArgumentException - If mpris:trackid was not set