Skip to content

Commit 9cc728b

Browse files
Added codec badges to details screen
1 parent 2b1617a commit 9cc728b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

frontend/src/components/details.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,9 +1038,19 @@ var Details = {
10381038
if (video.VideoDoViTitle || (video.Title && video.Title.indexOf('Dolby Vision') !== -1)) {
10391039
badges.push('<span class="moonfin-badge moonfin-badge-dv">DV</span>');
10401040
}
1041+
1042+
var videoCodecLabel = this.getCodecBadgeLabel(video.Codec, 'Video');
1043+
if (videoCodecLabel) {
1044+
badges.push('<span class="moonfin-badge moonfin-badge-codec">' + videoCodecLabel + '</span>');
1045+
}
10411046
}
10421047

10431048
if (audio) {
1049+
var audioCodecLabel = this.getCodecBadgeLabel(audio.Codec, 'Audio');
1050+
if (audioCodecLabel) {
1051+
badges.push('<span class="moonfin-badge moonfin-badge-codec">' + audioCodecLabel + '</span>');
1052+
}
1053+
10441054
if ((audio.DisplayTitle && audio.DisplayTitle.indexOf('Atmos') !== -1) || (audio.Profile && audio.Profile.indexOf('Atmos') !== -1)) {
10451055
badges.push('<span class="moonfin-badge moonfin-badge-atmos">ATMOS</span>');
10461056
} else if ((audio.DisplayTitle && audio.DisplayTitle.indexOf('DTS:X') !== -1) || (audio.Profile && audio.Profile.indexOf('DTS:X') !== -1)) {
@@ -1054,6 +1064,24 @@ var Details = {
10541064
return badges;
10551065
},
10561066

1067+
getCodecBadgeLabel: function(codec, streamType) {
1068+
if (!codec) return '';
1069+
1070+
var normalized = String(codec).toUpperCase();
1071+
1072+
if (streamType === 'Video') {
1073+
if (normalized === 'H264' || normalized === 'AVC') return 'H.264';
1074+
if (normalized === 'H265' || normalized === 'HEVC') return 'HEVC';
1075+
}
1076+
1077+
if (streamType === 'Audio') {
1078+
if (normalized === 'EAC3') return 'E-AC3';
1079+
if (normalized === 'TRUEHD') return 'TRUEHD';
1080+
}
1081+
1082+
return normalized;
1083+
},
1084+
10571085
formatRuntime: function(ticks) {
10581086
var minutes = Math.floor(ticks / 600000000);
10591087
if (minutes < 60) return minutes + 'm';

frontend/src/styles/details.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ body.moonfin-navbar-active .moonfin-details-back {
248248
color: #fff;
249249
}
250250

251+
.moonfin-badge-codec {
252+
background: rgba(255, 255, 255, 0.14);
253+
color: #fff;
254+
border: 1px solid rgba(255, 255, 255, 0.2);
255+
}
256+
251257
.moonfin-tagline {
252258
font-style: italic;
253259
color: rgba(255, 255, 255, 0.6);

0 commit comments

Comments
 (0)