mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 20:16:36 +08:00
优化360播放
This commit is contained in:
@@ -78,6 +78,23 @@ check('VR180 的 1:2 画幅为上下并排', vr180Ou.profile.stereo === 'ou')
|
||||
const topBottom = detectVr360Profile({ path: '/media/vr/vr360-top-bottom.mp4' })
|
||||
check('top-bottom 关键词为上下并排', topBottom.profile.stereo === 'ou')
|
||||
|
||||
// 回归:真实媒体库里出现过的误判(单词里含 vr、分辨率写法含 360)。
|
||||
const valvrave = detectVr360Profile({
|
||||
title: '革命机Valvrave',
|
||||
path: '/media/anime/2013/[革命机] Valvrave the Liberator (2013)/01.mkv',
|
||||
})
|
||||
check('单词里的 vr 不误判(Valvrave)', !valvrave.confident)
|
||||
check('误判时仍给出可用的默认配置', profileOf(valvrave.profile) === 'equirect360/mono')
|
||||
|
||||
const resolution360p = detectVr360Profile({ path: '/media/movie/movie-360p.mp4', width: 640, height: 360 })
|
||||
check('360p 分辨率写法不误判', !resolution360p.confident)
|
||||
|
||||
const titleWithVrWord = detectVr360Profile({ title: '某动画 VR 特别篇', path: '/media/anime/01.mkv' })
|
||||
check('标题里的独立 VR 词元可识别', titleWithVrWord.confident)
|
||||
|
||||
const ipvr = detectVr360Profile({ path: '/media/云下载/ipvr00192pl/ipvr00192.part2.mp4' })
|
||||
check('编号形态 ipvr00192 可识别', ipvr.confident && ipvr.profile.projection === 'equirect180')
|
||||
|
||||
// ---------- 立体裁切与偏好归一化 ----------
|
||||
|
||||
check('单眼不裁切', closeAll(vr360FrameUv('mono').scale, [1, 1]))
|
||||
|
||||
+13
-5
@@ -93,16 +93,22 @@ export type Vr360Detection = {
|
||||
}
|
||||
|
||||
// 关键词分两类:明确的关键词按子串匹配("vr360" 里也含 "360"),
|
||||
// 容易误伤的两字母缩写按独立词元匹配(避免 "1ou" / "sivr" 之类误判)。
|
||||
const PANORAMA_SUBSTRINGS = ['360', 'equirect', 'insta360', 'pano', 'vuze', 'theta', '全景']
|
||||
// 容易误伤的两字母缩写按作品编号形态匹配。
|
||||
const PANORAMA_SUBSTRINGS = ['equirect', 'insta360', 'pano', 'vuze', 'theta', '全景']
|
||||
const FISHEYE_SUBSTRINGS = ['fisheye', '鱼眼']
|
||||
const VR180_SUBSTRINGS = ['vr180', '180vr', '180°', '180度', '半景']
|
||||
const SBS_SUBSTRINGS = ['side-by-side', 'sidebyside', 'side_by_side', '左右']
|
||||
const OU_SUBSTRINGS = ['over-under', 'top-bottom', 'topbottom', '上下']
|
||||
const VR_TOKENS = ['vr']
|
||||
const SBS_TOKENS = ['sbs', 'hsbs', 'lr']
|
||||
const OU_TOKENS = ['ou', 'tb', 'vou', 'tou']
|
||||
|
||||
// 「VR」必须落在作品编号形态上,不能只是单词里的字母组合:
|
||||
// vr180 / vr00192(后面跟数字)、sivr-270 / kmvr.mkv(跟在字母后并以非字母数字收尾)。
|
||||
// 这样 "Valvrave"、"VRoid" 这类单词不会被误判成 VR 素材。
|
||||
const VR_NAME_PATTERN = /vr[0-9]|[a-z]vr(?![a-z0-9])/
|
||||
// 「360」需要排除 "360p" 之类的分辨率写法和 "1360" 之类的数字片段。
|
||||
const PANORAMA_360_PATTERN = /(?<![0-9])360(?![0-9p])/
|
||||
|
||||
function detectText(input: Vr360DetectInput): string {
|
||||
return [input.path, input.relativePath, input.originalName, input.title]
|
||||
.filter((value): value is string => Boolean(value))
|
||||
@@ -152,8 +158,10 @@ export function detectVr360Profile(input: Vr360DetectInput): Vr360Detection {
|
||||
|
||||
const fisheye = hasSubstring(text, FISHEYE_SUBSTRINGS)
|
||||
const vr180 = hasSubstring(text, VR180_SUBSTRINGS)
|
||||
const panorama = hasSubstring(text, PANORAMA_SUBSTRINGS)
|
||||
const vrToken = hasToken(tokens, VR_TOKENS) || nameText.includes('vr')
|
||||
const panorama =
|
||||
hasSubstring(text, PANORAMA_SUBSTRINGS) || PANORAMA_360_PATTERN.test(text)
|
||||
// 标题里只认独立的 "vr" 词元;文件名/路径里允许作品编号形态。
|
||||
const vrToken = tokens.has('vr') || VR_NAME_PATTERN.test(nameText)
|
||||
const confident = fisheye || vr180 || panorama || vrToken
|
||||
|
||||
let projection: Vr360Projection = DEFAULT_VR360_PROFILE.projection
|
||||
|
||||
Reference in New Issue
Block a user