Add media file size to Playback Data (#439)

* Add media file size to Playback Data

* change file units to base-2 and fix output

will also remove any trailing zeros from decimal.

* Fix file size unit

* add i18n files and strings to dialog, fix conflict
This commit is contained in:
Tyler W 2019-09-11 20:40:21 +00:00 committed by Anthony Lavado
parent 2240edce26
commit 4f084bad1c
2 changed files with 49 additions and 18 deletions

View File

@ -132,7 +132,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
if (videoCodec) {
sessionStats.push({
label: 'Video codec:',
label: globalize.translate("LabelVideoCodec"),
value: session.TranscodingInfo.IsVideoDirect ? (videoCodec.toUpperCase() + ' (direct)') : videoCodec.toUpperCase()
});
}
@ -140,7 +140,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
if (audioCodec) {
sessionStats.push({
label: 'Audio codec:',
label: globalize.translate("LabelAudioCodec"),
value: session.TranscodingInfo.IsAudioDirect ? (audioCodec.toUpperCase() + ' (direct)') : audioCodec.toUpperCase()
});
}
@ -157,28 +157,28 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
if (totalBitrate) {
sessionStats.push({
label: 'Bitrate:',
label: globalize.translate("LabelBitrate"),
value: getDisplayBitrate(totalBitrate)
});
}
if (session.TranscodingInfo.CompletionPercentage) {
sessionStats.push({
label: 'Transcoding progress:',
label: globalize.translate("LabelTranscodingProgress"),
value: session.TranscodingInfo.CompletionPercentage.toFixed(1) + '%'
});
}
if (session.TranscodingInfo.Framerate) {
sessionStats.push({
label: 'Transcoding framerate:',
label: globalize.translate("LabelTranscodingFramerate"),
value: session.TranscodingInfo.Framerate + ' fps'
});
}
if (session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length) {
sessionStats.push({
label: 'Reason for transcoding:',
label: globalize.translate("LabelReasonForTranscoding"),
value: session.TranscodingInfo.TranscodeReasons.map(translateReason).join('<br/>')
});
}
@ -196,24 +196,42 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
}
}
function getReadableSize(size) {
if (size >= 1073741824) {
return parseFloat((size / 1073741824).toFixed(1)) + ' GiB';
} else if (size >= 1048576) {
return parseFloat((size / 1048576).toFixed(1)) + ' MiB';
} else {
return Math.floor(size / 1024) + ' KiB';
}
}
function getMediaSourceStats(session, player, displayPlayMethod) {
var sessionStats = [];
var mediaSource = playbackManager.currentMediaSource(player) || {};
var totalBitrate = mediaSource.Bitrate;
var mediaFileSize = mediaSource.Size;
if (mediaSource.Container) {
sessionStats.push({
label: 'Container:',
label: globalize.translate("LabelProfileContainer"),
value: mediaSource.Container
});
}
if (mediaFileSize) {
sessionStats.push({
label: globalize.translate("LabelSize"),
value: getReadableSize(mediaFileSize)
});
}
if (totalBitrate) {
sessionStats.push({
label: 'Bitrate:',
label: globalize.translate("LabelBitrate"),
value: getDisplayBitrate(totalBitrate)
});
}
@ -249,14 +267,14 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
if (videoInfos.length) {
sessionStats.push({
label: 'Video codec:',
label: globalize.translate("LabelVideoCodec"),
value: videoInfos.join(' ')
});
}
if (videoStream.BitRate) {
sessionStats.push({
label: 'Video bitrate:',
label: globalize.translate("LabelVideoBitrate"),
value: getDisplayBitrate(videoStream.BitRate)
});
}
@ -273,35 +291,35 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
if (audioInfos.length) {
sessionStats.push({
label: 'Audio codec:',
label: globalize.translate("LabelAudioCodec"),
value: audioInfos.join(' ')
});
}
if (audioStream.BitRate) {
sessionStats.push({
label: 'Audio bitrate:',
label: globalize.translate("LabelAudioBitrate"),
value: getDisplayBitrate(audioStream.BitRate)
});
}
if (audioChannels) {
sessionStats.push({
label: 'Audio channels:',
label: globalize.translate("LabelAudioChannels"),
value: audioChannels
});
}
if (audioStream.SampleRate) {
sessionStats.push({
label: 'Audio sample rate:',
label: globalize.translate("LabelAudioSampleRate"),
value: audioStream.SampleRate + ' Hz'
});
}
if (audioStream.BitDepth) {
sessionStats.push({
label: 'Audio bit depth:',
label: globalize.translate("LabelAudioBitDepth"),
value: audioStream.BitDepth
});
}
@ -328,12 +346,12 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'playMeth
};
baseCategory.stats.unshift({
label: 'Play method:',
label: globalize.translate("LabelPlayMethod"),
value: displayPlayMethod
});
baseCategory.stats.unshift({
label: 'Player:',
label: globalize.translate("LabelPlayer"),
value: player.name
});

View File

@ -551,13 +551,19 @@
"LabelArtists": "Artists:",
"LabelArtistsHelp": "Separate multiple using ;",
"LabelAudio": "Audio:",
"LabelAudioBitDepth": "Audio bit depth:",
"LabelAudioBitrate": "Audio bitrate:",
"LabelAudioChannels": "Audio channels:",
"LabelAudioCodec": "Audio codec:",
"LabelAudioLanguagePreference": "Preferred audio language:",
"LabelAudioSampleRate": "Audio sample rate:",
"LabelAuthProvider": "Authentication Provider:",
"LabelAutomaticallyRefreshInternetMetadataEvery": "Automatically refresh metadata from the internet:",
"LabelBindToLocalNetworkAddress": "Bind to local network address:",
"LabelBindToLocalNetworkAddressHelp": "Optional. Override the local IP address to bind the http server to. If left empty, the server will bind to all availabile addresses. Changing this value requires restarting Jellyfin Server.",
"LabelBirthDate": "Birth date:",
"LabelBirthYear": "Birth year:",
"LabelBitrate": "Bitrate:",
"LabelBlastMessageInterval": "Alive message interval (seconds)",
"LabelBlastMessageIntervalHelp": "Determines the duration in seconds between server alive messages.",
"LabelBlockContentWithTags": "Block items with tags:",
@ -755,7 +761,9 @@
"LabelPersonRoleHelp": "Example: Ice cream truck driver",
"LabelPlaceOfBirth": "Place of birth:",
"LabelPlayDefaultAudioTrack": "Play default audio track regardless of language",
"LabelPlayer": "Player:",
"LabelPlaylist": "Playlist:",
"LabelPlayMethod": "Play method:",
"LabelPostProcessor": "Post-processing application:",
"LabelPostProcessorArguments": "Post-processor command line arguments:",
"LabelPostProcessorArgumentsHelp": "Use {path} as the path to the recording file.",
@ -804,6 +812,7 @@
"LabelServerName": "Server name:",
"LabelServerPort": "Port:",
"LabelSimultaneousConnectionLimit": "Simultaneous stream limit:",
"LabelSize": "Size:",
"LabelSkin": "Skin:",
"LabelSkipBackLength": "Skip back length:",
"LabelSkipForwardLength": "Skip forward length:",
@ -845,6 +854,8 @@
"LabelTranscodePath": "Transcode path:",
"LabelTranscodingTempPathHelp": "This folder contains working files used by the transcoder. Specify a custom path, or leave empty to use the default within the server's data folder.",
"LabelTranscodes": "Transcodes:",
"LabelTranscodingFramerate": "Transcoding framerate:",
"LabelTranscodingProgress": "Transcoding progress:",
"LabelTranscodingThreadCount": "Transcoding thread count:",
"LabelTranscodingThreadCountHelp": "Select the maximum number of threads to use when transcoding. Reducing the thread count will lower cpu usage but may not convert fast enough for a smooth playback experience.",
"LabelTranscodingVideoCodec": "Video codec:",
@ -872,6 +883,8 @@
"DashboardOperatingSystem": "Operating System: {0}",
"DashboardArchitecture": "Architecture: {0}",
"LabelVideo": "Video:",
"LabelVideoBitrate": "Video bitrate:",
"LabelVideoCodec": "Video codec:",
"LabelWeb": "Web: ",
"LabelXDlnaCap": "X-Dlna cap:",
"LabelXDlnaCapHelp": "Determines the content of the X_DLNACAP element in the urn:schemas-dlna-org:device-1-0 namespace.",