Show file details in overview dialog (#126)

When clicking the overview for an item, the dialog now shows details
about each file/media source including video, audio, & subtitle
information.

It only shows the full file path if the user is an administrator.
This commit is contained in:
damontecres 2025-10-31 12:27:30 -04:00 committed by GitHub
parent ba09ac09e4
commit 1508fa1ea3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 143 additions and 19 deletions

View file

@ -140,3 +140,27 @@ fun abbreviateNumber(number: Int): String {
}
return String.format(Locale.getDefault(), "%.1f%s", count, abbrevSuffixes[unit])
}
val byteSuffixes = listOf("B", "KB", "MB", "GB", "TB")
val byteRateSuffixes = listOf("bps", "kbps", "mbps", "gbps", "tbps")
/**
* Format bytes
*/
fun formatBytes(
bytes: Int,
suffixes: List<String> = byteSuffixes,
) = formatBytes(bytes.toLong(), suffixes)
fun formatBytes(
bytes: Long,
suffixes: List<String> = byteSuffixes,
): String {
var unit = 0
var count = bytes.toDouble()
while (count >= 1024 && unit + 1 < suffixes.size) {
count /= 1024
unit++
}
return String.format(Locale.getDefault(), "%.2f%s", count, suffixes[unit])
}