-
Notifications
You must be signed in to change notification settings - Fork 1
/
classifier.js
63 lines (53 loc) · 1.41 KB
/
classifier.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"use strict";
module.exports = {
classify: function(input) {
let codec = `x264`
let bitdepth = 8 // 8 bit, 10 bit...
let hdrtype = `sdr` // sdr, hdr, dv. No specific hdr10
// If we have x256/hevc content
if (input.search(/x265|h265|h\.265|h 265|hevc/i) > 0) {
codec = 'x265'
}
let resolution = 'sd'
if (input.search(/720p/i) > 0) {
resolution = '720p'
}
if (input.search(/1080p/i) > 0) {
resolution = '1080p'
}
if (input.search(/2160p/i) > 0) {
resolution = '2160p'
}
let source = 'hdtv'
if (input.search(/WEB-DL|WEB_DL|WEB\.DL/i) > 0) {
source = 'web-dl'
}
if (input.search(/WEBRIP/i) > 0) {
source = 'webrip'
}
if (input.search(/BRRIP|BDRIP|BluRay/i) > 0) {
source = 'brrip'
}
if (input.search(/DVDRip|DVD-Rip/i) > 0) {
source = 'dvdrip'
}
if (input.search(/BluRay(.*)REMUX/i) > 0) {
source = 'bluray-remux'
}
if (input.search(/BluRay(.*)\.(AVC|VC-1)/i) > 0) {
source = 'bluray-full'
}
if (input.search(/10-bit|10 bit|10bit/i) > 0) {
bitdepth = 10
}
if (input.search(/dv|dovi/i) > 0) {
hdrtype = `dv`
} else if (input.search(/hdr/i) > 0) {
hdrtype = `hdr`
}
if (hdrtype != `sdr`) {
bitdepth = 10
}
return {codec: codec, resolution: resolution, source: source, bitdepth: bitdepth, hdrtype: hdrtype}
}
};