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

View File

@ -551,13 +551,19 @@
"LabelArtists": "Artists:", "LabelArtists": "Artists:",
"LabelArtistsHelp": "Separate multiple using ;", "LabelArtistsHelp": "Separate multiple using ;",
"LabelAudio": "Audio:", "LabelAudio": "Audio:",
"LabelAudioBitDepth": "Audio bit depth:",
"LabelAudioBitrate": "Audio bitrate:",
"LabelAudioChannels": "Audio channels:",
"LabelAudioCodec": "Audio codec:",
"LabelAudioLanguagePreference": "Preferred audio language:", "LabelAudioLanguagePreference": "Preferred audio language:",
"LabelAudioSampleRate": "Audio sample rate:",
"LabelAuthProvider": "Authentication Provider:", "LabelAuthProvider": "Authentication Provider:",
"LabelAutomaticallyRefreshInternetMetadataEvery": "Automatically refresh metadata from the internet:", "LabelAutomaticallyRefreshInternetMetadataEvery": "Automatically refresh metadata from the internet:",
"LabelBindToLocalNetworkAddress": "Bind to local network address:", "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.", "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:", "LabelBirthDate": "Birth date:",
"LabelBirthYear": "Birth year:", "LabelBirthYear": "Birth year:",
"LabelBitrate": "Bitrate:",
"LabelBlastMessageInterval": "Alive message interval (seconds)", "LabelBlastMessageInterval": "Alive message interval (seconds)",
"LabelBlastMessageIntervalHelp": "Determines the duration in seconds between server alive messages.", "LabelBlastMessageIntervalHelp": "Determines the duration in seconds between server alive messages.",
"LabelBlockContentWithTags": "Block items with tags:", "LabelBlockContentWithTags": "Block items with tags:",
@ -755,7 +761,9 @@
"LabelPersonRoleHelp": "Example: Ice cream truck driver", "LabelPersonRoleHelp": "Example: Ice cream truck driver",
"LabelPlaceOfBirth": "Place of birth:", "LabelPlaceOfBirth": "Place of birth:",
"LabelPlayDefaultAudioTrack": "Play default audio track regardless of language", "LabelPlayDefaultAudioTrack": "Play default audio track regardless of language",
"LabelPlayer": "Player:",
"LabelPlaylist": "Playlist:", "LabelPlaylist": "Playlist:",
"LabelPlayMethod": "Play method:",
"LabelPostProcessor": "Post-processing application:", "LabelPostProcessor": "Post-processing application:",
"LabelPostProcessorArguments": "Post-processor command line arguments:", "LabelPostProcessorArguments": "Post-processor command line arguments:",
"LabelPostProcessorArgumentsHelp": "Use {path} as the path to the recording file.", "LabelPostProcessorArgumentsHelp": "Use {path} as the path to the recording file.",
@ -804,6 +812,7 @@
"LabelServerName": "Server name:", "LabelServerName": "Server name:",
"LabelServerPort": "Port:", "LabelServerPort": "Port:",
"LabelSimultaneousConnectionLimit": "Simultaneous stream limit:", "LabelSimultaneousConnectionLimit": "Simultaneous stream limit:",
"LabelSize": "Size:",
"LabelSkin": "Skin:", "LabelSkin": "Skin:",
"LabelSkipBackLength": "Skip back length:", "LabelSkipBackLength": "Skip back length:",
"LabelSkipForwardLength": "Skip forward length:", "LabelSkipForwardLength": "Skip forward length:",
@ -845,6 +854,8 @@
"LabelTranscodePath": "Transcode path:", "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.", "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:", "LabelTranscodes": "Transcodes:",
"LabelTranscodingFramerate": "Transcoding framerate:",
"LabelTranscodingProgress": "Transcoding progress:",
"LabelTranscodingThreadCount": "Transcoding thread count:", "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.", "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:", "LabelTranscodingVideoCodec": "Video codec:",
@ -872,6 +883,8 @@
"DashboardOperatingSystem": "Operating System: {0}", "DashboardOperatingSystem": "Operating System: {0}",
"DashboardArchitecture": "Architecture: {0}", "DashboardArchitecture": "Architecture: {0}",
"LabelVideo": "Video:", "LabelVideo": "Video:",
"LabelVideoBitrate": "Video bitrate:",
"LabelVideoCodec": "Video codec:",
"LabelWeb": "Web: ", "LabelWeb": "Web: ",
"LabelXDlnaCap": "X-Dlna cap:", "LabelXDlnaCap": "X-Dlna cap:",
"LabelXDlnaCapHelp": "Determines the content of the X_DLNACAP element in the urn:schemas-dlna-org:device-1-0 namespace.", "LabelXDlnaCapHelp": "Determines the content of the X_DLNACAP element in the urn:schemas-dlna-org:device-1-0 namespace.",