musikr: expose bitrate and sample rate
This commit is contained in:
parent
880967f8be
commit
50b7c24c03
6 changed files with 17 additions and 7 deletions
|
@ -265,6 +265,10 @@ interface Song : Music {
|
|||
val size: Long
|
||||
/** The duration of the audio file, in milliseconds. */
|
||||
val durationMs: Long
|
||||
/** The bitrate of the audio file, in kbps. */
|
||||
val bitrateKbps: Int
|
||||
/** The sample rate of the audio file, in Hz. */
|
||||
val sampleRateHz: Int
|
||||
/** The ReplayGain adjustment to apply during playback. */
|
||||
val replayGainAdjustment: ReplayGainAdjustment
|
||||
/** The date last modified the audio file was last modified, as a unix epoch timestamp. */
|
||||
|
|
|
@ -67,8 +67,8 @@ internal data class CachedSong(
|
|||
val dateModified: Long,
|
||||
val mimeType: String,
|
||||
val durationMs: Long,
|
||||
val bitrate: Int,
|
||||
val sampleRate: Int,
|
||||
val bitrateHz: Int,
|
||||
val sampleRateHz: Int,
|
||||
val musicBrainzId: String?,
|
||||
val name: String,
|
||||
val sortName: String?,
|
||||
|
@ -94,7 +94,7 @@ internal data class CachedSong(
|
|||
fun intoRawSong(file: DeviceFile) =
|
||||
RawSong(
|
||||
file,
|
||||
Properties(mimeType, durationMs, bitrate, sampleRate),
|
||||
Properties(mimeType, durationMs, bitrateHz, sampleRateHz),
|
||||
ParsedTags(
|
||||
musicBrainzId = musicBrainzId,
|
||||
name = name,
|
||||
|
@ -164,7 +164,7 @@ internal data class CachedSong(
|
|||
replayGainAlbumAdjustment = rawSong.tags.replayGainAlbumAdjustment,
|
||||
cover = rawSong.cover,
|
||||
mimeType = rawSong.properties.mimeType,
|
||||
bitrate = rawSong.properties.bitrate,
|
||||
sampleRate = rawSong.properties.sampleRate)
|
||||
bitrateHz = rawSong.properties.bitrateKbps,
|
||||
sampleRateHz = rawSong.properties.sampleRateHz)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,6 @@ internal data class Metadata(
|
|||
data class Properties(
|
||||
val mimeType: String,
|
||||
val durationMs: Long,
|
||||
val bitrate: Int,
|
||||
val sampleRate: Int,
|
||||
val bitrateKbps: Int,
|
||||
val sampleRateHz: Int,
|
||||
)
|
||||
|
|
|
@ -52,6 +52,8 @@ internal class SongImpl(private val handle: SongCore) : Song {
|
|||
override val format = preSong.format
|
||||
override val size = preSong.size
|
||||
override val durationMs = preSong.durationMs
|
||||
override val bitrateKbps = preSong.bitrateKbps
|
||||
override val sampleRateHz = preSong.sampleRateHz
|
||||
override val replayGainAdjustment = preSong.replayGainAdjustment
|
||||
override val lastModified = preSong.lastModified
|
||||
override val dateAdded = preSong.dateAdded
|
||||
|
|
|
@ -43,6 +43,8 @@ internal data class PreSong(
|
|||
val format: Format,
|
||||
val size: Long,
|
||||
val durationMs: Long,
|
||||
val bitrateKbps: Int,
|
||||
val sampleRateHz: Int,
|
||||
val replayGainAdjustment: ReplayGainAdjustment,
|
||||
val lastModified: Long,
|
||||
val dateAdded: Long,
|
||||
|
|
|
@ -74,6 +74,8 @@ private data object TagInterpreterImpl : TagInterpreter {
|
|||
disc = song.tags.disc?.let { Disc(it, song.tags.subtitle) },
|
||||
date = song.tags.date,
|
||||
durationMs = song.tags.durationMs,
|
||||
bitrateKbps = song.properties.bitrateKbps,
|
||||
sampleRateHz = song.properties.sampleRateHz,
|
||||
replayGainAdjustment =
|
||||
ReplayGainAdjustment(
|
||||
song.tags.replayGainTrackAdjustment,
|
||||
|
|
Loading…
Reference in a new issue