Skip to content

Commit 85f6f9f

Browse files
committed
Refactor media spec to be much compact
1 parent ddfafd8 commit 85f6f9f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

modules/filespec.groovy

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
@./releasesource.groovy
22
{
3-
def bdepth = bitdepth ? " ${bitdepth}bit" : ""
4-
"$resolution $vcf $bdepth, $ac"
3+
def aspectRatio = width / height
4+
def isVertical = width < height
5+
def is16x9 = Math.abs(aspectRatio - 16/9) < 0.1
6+
def is9x16 = Math.abs(aspectRatio - 9/16) < 0.1
7+
def resos = isVertical && is9x16 ? "${width}P" : !isVertical && is16x9 ? "${height}P" : "${width}x${height}"
8+
def bdepth = bitdepth > 8 ? " ${bitdepth}bit" : ""
9+
"$resos $vcf$bdepth, $ac"
510
}
611
{" "}
712
{af.format(
@@ -10,14 +15,14 @@
1015
6: 'DD 5.1',
1116
5: '5.0',
1217
3: '2.1',
13-
2: '2.0',
14-
1: '1.0',
18+
2: '',
19+
1: '',
1520
)}
1621
{
1722
def audioLangCount = any { audioLanguages.size() } { 0 }
18-
def substat = audioLangCount > 2 ? " MULTi-AUD" : audioLangCount > 1 ? " DUAL-AUD" : ""
23+
def substat = audioLangCount > 2 ? " M-AUD" : audioLangCount > 1 ? " D-AUD" : ""
1924
def langs_ = audioLangCount > 5 ? audioLanguages.take(5) : audioLanguages
20-
def dub = audioLanguages.any { it.ISO3B == language.ISO3B } ? "" : " DUBBED"
25+
def dub = audioLanguages.any { it.ISO3B == language.ISO3B } ? "" : " DUB"
2126
substat = audioLangCount == 1 && audioLanguages.any { it.ISO3B == "und" } ? "" : "$substat$dub"
2227
// substat ? substat + langs_.ISO2.joining(" ", " (", "").upper() + (audioLangCount > 5 ? " ...)" : ")") : ""
2328
substat
@@ -30,12 +35,12 @@
3035
].get(it,it).toUpperCase()
3136
}.unique()
3237
def textLangCount = any { text_arr.size() } { 0 }
33-
def substat = textLangCount > 2 ? ", MULTi" : textLangCount > 1 ? ", DUAL" : textLangCount == 1 ? ", SUB" : null
38+
def substat = textLangCount > 2 ? ", M-SUB" : textLangCount > 1 ? ", D-SUB" : textLangCount == 1 ? ", SUB" : null
3439
// def langs_ = textLangCount > 5 ? text_arr.take(5) : text_arr
3540
// substat ? substat + langs_.joining(" ", " (", "").upper() + (textLangCount > 6 ? " ...)" : ")") : ""
3641
substat
3742
}
38-
{"]["}{crc32.upper()}{"]"}
43+
{"]"}
3944
{
4045
if (f.subtitle) {
4146
def langcode = [

0 commit comments

Comments
 (0)