Class SoundFileInfo

java.lang.Object
de.mrjulsen.dragnsounds.core.filesystem.SoundFileInfo
All Implemented Interfaces:
de.mrjulsen.mcdragonlib.data.INBTSerializable

public class SoundFileInfo extends Object implements de.mrjulsen.mcdragonlib.data.INBTSerializable
A collection of read-only properties about the file.
  • Field Details

  • Constructor Details

    • SoundFileInfo

      public SoundFileInfo(long duration, long fileSize, UUID ownerId, long uploadTimestamp, int channels, String title, String artist, String year, String album, String genre)
  • Method Details

    • getDuration

      public long getDuration()
      A shortcut to get the playback duration of the sound file. Use this method instead of other methods to calculate it, since it has higher performance. The value changes automatically when the file hash changes.
      Returns:
      The playback duration in seconds.
    • getSize

      public long getSize()
      A shortcut to get the size of the sound file. Use this method instead of other methods to calculate it, since it has higher performance. The value changes automatically when the file hash changes.
      Returns:
      The size of the file in bytes.
    • getOwnerId

      public UUID getOwnerId()
      Returns:
      The UUID of the player which has uploaded this file.
    • getUploadTimeMillis

      public long getUploadTimeMillis()
      Returns:
      The timestamp in millis when the player has uploaded this file.
    • getUploadDate

      public Date getUploadDate()
      Returns:
      A formatted representation of the time when the player has uploaded this file.
    • getUploadTimeFormatted

      public String getUploadTimeFormatted()
      Returns:
      A formatted representation of the time when the player has uploaded this file.
    • getOriginalTitle

      public String getOriginalTitle()
      Returns:
      The original title of the sound file which has been uploaded.
    • getArtist

      public String getArtist()
      Returns:
      The original artist of the sound file which has been uploaded.
    • getDate

      public String getDate()
      Returns:
      The original date of the sound file which has been uploaded.
    • getGenre

      public String getGenre()
      Returns:
      The original genre of the sound file which has been uploaded.
    • getAlbum

      public String getAlbum()
      Returns:
      The original album of the sound file which has been uploaded.
    • getChannels

      public int getChannels()
      Returns:
      The amount of audio channels in this file.
    • fromNbt

      public static SoundFileInfo fromNbt(net.minecraft.nbt.CompoundTag nbt)
    • serializeNbt

      public net.minecraft.nbt.CompoundTag serializeNbt()
      Specified by:
      serializeNbt in interface de.mrjulsen.mcdragonlib.data.INBTSerializable
    • deserializeNbt

      public void deserializeNbt(net.minecraft.nbt.CompoundTag nbt)
      Specified by:
      deserializeNbt in interface de.mrjulsen.mcdragonlib.data.INBTSerializable
    • empty

      public static SoundFileInfo empty()
    • of

      public static SoundFileInfo of(File file, UUID owner, long timestamp, int initialChannels, long initialDuration)