Skip to content

Commit 630fed9

Browse files
committed
设置判断移动到后端
1 parent f4e6ed2 commit 630fed9

14 files changed

Lines changed: 43 additions & 163 deletions

File tree

‎MaiChartManager/Config.cs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ namespace MaiChartManager;
44

55
public enum MovieCodec
66
{
7-
PreferH264 = 0,
8-
ForceH264 = 1,
9-
ForceVP9 = 2
7+
ForceH264 = 0,
8+
ForceVP9 = 1
109
}
1110

1211
public class Config

‎MaiChartManager/Controllers/Music/MovieConvertController.cs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public enum SetMovieEventType
1616

1717
[HttpPut]
1818
[DisableRequestSizeLimit]
19-
public async Task SetMovie(int id, [FromForm] double padding, IFormFile file, [FromForm] bool noScale, [FromForm] bool h264, [FromForm] bool yuv420p, string assetDir)
19+
public async Task SetMovie(int id, [FromForm] double padding, IFormFile file, string assetDir)
2020
{
2121
id %= 10000;
2222

@@ -46,16 +46,16 @@ public async Task SetMovie(int id, [FromForm] double padding, IFormFile file, [F
4646
}
4747

4848
// 目标路径
49-
var targetPath = Path.Combine(StaticSettings.StreamingAssets, assetDir, $@"MovieData\{id:000000}.{(h264 ? "mp4" : "dat")}");
49+
var targetPath = Path.Combine(StaticSettings.StreamingAssets, assetDir, $@"MovieData\{id:000000}.{(StaticSettings.Config.MovieCodec == MovieCodec.ForceH264 ? "mp4" : "dat")}");
5050

5151
// 使用工具类转换视频
5252
await VideoConvert.ConvertVideo(new VideoConvert.VideoConvertOptions
5353
{
5454
InputPath = srcFilePath,
5555
OutputPath = targetPath,
56-
NoScale = noScale,
57-
UseH264 = h264,
58-
UseYuv420p = yuv420p,
56+
NoScale = StaticSettings.Config.NoScale,
57+
UseH264 = StaticSettings.Config.MovieCodec == MovieCodec.ForceH264,
58+
UseYuv420p = StaticSettings.Config.Yuv420p,
5959
Padding = padding,
6060
ContentType = file.ContentType,
6161
OnProgress = async percent =>

‎MaiChartManager/Controllers/Tools/VideoConvertToolController.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public enum VideoConvertEventType
1515
}
1616

1717
[HttpPost]
18-
public async Task VideoConvertTool([FromQuery] bool noScale, [FromQuery] bool yuv420p)
18+
public async Task VideoConvertTool()
1919
{
2020
Response.Headers.Append("Content-Type", "text/event-stream");
2121

@@ -64,8 +64,8 @@ await VideoConvert.ConvertUsmToMp4(
6464
await VideoConvert.ConvertVideoToUsm(
6565
inputFile,
6666
outputDatPath,
67-
noScale,
68-
yuv420p,
67+
noScale: StaticSettings.Config.NoScale,
68+
yuv420p: StaticSettings.Config.Yuv420p,
6969
async percent =>
7070
{
7171
await Response.WriteAsync($"event: {VideoConvertEventType.Progress}\ndata: {percent}\n\n");

‎MaiChartManager/Front/src/client/apiGen.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export enum PubKeyId {
3838
}
3939

4040
export enum MovieCodec {
41-
PreferH264 = "PreferH264",
4241
ForceH264 = "ForceH264",
4342
ForceVP9 = "ForceVP9",
4443
}

‎MaiChartManager/Front/src/locales/en.yaml‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,8 @@ chart:
246246
present)
247247
248248
May cause first note to appear at odd timing, e.g. immediately at start
249-
ignoreLevel: Ignore constant, exclude from B50 calculation
250-
disableBga: Don't import BGA even if present
251-
noScale: Don't scale BGA to 1080 width, this option will be remembered
252-
pvCodec: PV Codec
253-
yuv420p: Use YUV420P color space when converting USM
254-
codecPreferH264: Prefer H264
255-
codecForceH264: Force H264
256-
codecForceVP9: Force VP9 USM
249+
codecForceH264: H264
250+
codecForceVP9: VP9 USM
257251
assignId: Assign ID for new imported songs
258252
currentProcessing: Currently processing
259253
folderHint: >-
@@ -442,10 +436,6 @@ tools:
442436
convertFailed: Conversion failed
443437
videoConvertError: Video conversion error
444438
videoOptions:
445-
title: Video Conversion Options
446-
onlyForUsm: The following options only apply to converting to USM from common formats
447-
noScale: Don't scale video to 1080 width
448-
useYuv420p: Use YUV420P color space
449439
processing: Still processing, please wait...
450440
error:
451441
title: Error

‎MaiChartManager/Front/src/locales/zh-TW.yaml‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,8 @@ chart:
228228
shiftNoMoveDesc: |-
229229
完全不修改譜面,從音訊中刪除 &first 的長度(如果有)
230230
可能會導致第一個音符出現的時機比較奇怪,比如說剛開始就有音符
231-
ignoreLevel: 忽略定數,不參與 B50 計算
232-
disableBga: 有 BGA 也不要匯入
233-
noScale: 不要縮放 BGA 到 1080 寬度,此選項會記住
234-
pvCodec: PV 編碼
235-
yuv420p: 轉換 USM 時使用 YUV420P 色彩空間
236-
codecPreferH264: 優先 H264
237-
codecForceH264: 強制 H264
238-
codecForceVP9: 強制 VP9 USM
231+
codecForceH264: H264
232+
codecForceVP9: VP9 USM
239233
assignId: 為新匯入的歌曲指定 ID
240234
currentProcessing: 目前正在處理的項目
241235
folderHint: 包含以下檔案的資料夾,或者,一個包含一些這樣的資料夾的資料夾
@@ -403,10 +397,6 @@ tools:
403397
convertFailed: 轉換失敗
404398
videoConvertError: 影片轉換出錯
405399
videoOptions:
406-
title: 影片轉換選項
407-
onlyForUsm: 以下選項僅對通用格式轉換為 USM 生效
408-
noScale: 不要縮放影片到 1080 寬度
409-
useYuv420p: 使用 YUV420P 色彩空間
410400
processing: 還在處理,別急…
411401
error:
412402
title: 錯誤

‎MaiChartManager/Front/src/locales/zh.yaml‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,8 @@ chart:
228228
shiftNoMoveDesc: |-
229229
完全不修改谱面,从音频中删除 &first 的长度(如果有)
230230
可能会导致第一个音符出现的时机比较奇怪,比如说刚开始就有音符
231-
ignoreLevel: 忽略定数,不参与 B50 计算
232-
disableBga: 有 BGA 也不要导入
233-
noScale: 不要缩放 BGA 到 1080 宽度,此选项会记住
234-
pvCodec: PV 编码
235-
yuv420p: 转换 USM 时使用 YUV420P 颜色空间
236-
codecPreferH264: 优先 H264
237-
codecForceH264: 强制 H264
238-
codecForceVP9: 强制 VP9 USM
231+
codecForceH264: H264
232+
codecForceVP9: VP9 USM
239233
assignId: 为新导入的歌曲指定 ID
240234
currentProcessing: 当前正在处理的项目
241235
folderHint: 包含以下文件的文件夹,或者,一个包含一些这样的文件夹的文件夹
@@ -404,10 +398,6 @@ tools:
404398
convertFailed: 转换失败
405399
videoConvertError: 视频转换出错
406400
videoOptions:
407-
title: 视频转换选项
408-
onlyForUsm: 以下选项仅对通用格式转换为 USM 生效
409-
noScale: 不要缩放视频到 1080 宽度
410-
useYuv420p: 使用 YUV420P 颜色空间
411401
processing: 还在处理,别急…
412402
error:
413403
title: 错误

‎MaiChartManager/Front/src/store/refs.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useStorage, useWindowFocus, whenever } from "@vueuse/core";
77
import { locale } from "@/locales";
88
import { updateAquaMaiConfig } from "@/views/ModManager/refs";
99
import { updateSettings } from "@/store/settings";
10+
import { GetGetConfigTypeEnum } from "@/client/aquaMaiVersionConfigApiGen";
1011

1112
export const error = ref();
1213
export const errorId = ref<string>();
@@ -63,7 +64,7 @@ export const disableSync = ref(false);
6364

6465
export { aquaMaiConfig } from "@/views/ModManager/refs";
6566
export const modUpdateInfo = ref<Awaited<ReturnType<typeof aquaMaiVersionConfig.getGetConfig>>['data']>([{
66-
type: 'builtin',
67+
type: GetGetConfigTypeEnum.Builtin,
6768
}])
6869

6970
export const saveMusicIfNeeded = async (id: number) => {

‎MaiChartManager/Front/src/views/Charts/ImportCreateChartButton/ImportChartButton/ErrorDisplayIdInput.tsx‎

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { computed, defineComponent, effect, PropType, watch } from "vue";
2-
import { Button, CheckBox, Modal, NumberInput, Select } from "@munet/ui";
3-
import { ImportChartMessage, MessageLevel, MovieCodec, ShiftMethod } from "@/client/apiGen";
2+
import { Button, Modal, NumberInput } from "@munet/ui";
3+
import { ImportChartMessage, MessageLevel, ShiftMethod } from "@/client/apiGen";
44
import { ImportChartMessageEx, ImportMeta, SavedOptions, TempOptions } from "./types";
55
import noJacket from '@/assets/noJacket.webp';
66
import { addVersionList, genreList, showNeedPurchaseDialog } from "@/store/refs";
7-
import { appSettings } from "@/store/settings";
87
import GenreInput from "@/components/GenreInput";
98
import VersionInput from "@/components/VersionInput";
109
import { UTAGE_GENRE } from "@/consts";
@@ -63,34 +62,10 @@ export default defineComponent({
6362
<div class="ml-1 text-sm">{t('music.edit.version')}</div>
6463
<VersionInput v-model:value={props.savedOptions.version}/>
6564
</div>
66-
<CheckBox v-model:value={appSettings.value.ignoreLevel}>
67-
{t('chart.import.option.ignoreLevel')}
68-
</CheckBox>
69-
<CheckBox v-model:value={appSettings.value.disableBga}>
70-
{t('chart.import.option.disableBga')}
71-
</CheckBox>
7265
<details>
7366
<summary class="cursor-pointer">{t('chart.import.option.advancedOptions')}</summary>
7467
<div class="flex flex-col gap-2 mt-2">
7568
<ShiftModeSelector tempOptions={props.tempOptions}></ShiftModeSelector>
76-
<CheckBox v-model:value={appSettings.value.noScale}>
77-
{t('chart.import.option.noScale')}
78-
</CheckBox>
79-
<div>
80-
<div class="ml-1 text-sm">{t('chart.import.option.pvCodec')}</div>
81-
<div class="flex flex-col gap-2 w-full">
82-
<div class="flex gap-2 h-34px items-center">
83-
<Select v-model:value={appSettings.value.movieCodec} options={[
84-
{label: t('chart.import.option.codecPreferH264'), value: MovieCodec.PreferH264},
85-
{label: t('chart.import.option.codecForceH264'), value: MovieCodec.ForceH264},
86-
{label: t('chart.import.option.codecForceVP9'), value: MovieCodec.ForceVp9},
87-
]}/>
88-
</div>
89-
</div>
90-
</div>
91-
<CheckBox v-model:value={appSettings.value.yuv420p}>
92-
{t('chart.import.option.yuv420p')}
93-
</CheckBox>
9469
</div>
9570
</details>
9671
</>}

‎MaiChartManager/Front/src/views/Charts/ImportCreateChartButton/ImportChartButton/index.tsx‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { defineComponent, ref } from "vue";
22
import { Button } from "@munet/ui";
33
import SelectFileTypeTip from "./SelectFileTypeTip";
4-
import { LicenseStatus, MessageLevel, MovieCodec, ShiftMethod } from "@/client/apiGen";
4+
import { LicenseStatus, MessageLevel, ShiftMethod } from "@/client/apiGen";
55
import CheckingModal from "./CheckingModal";
66
import api, { getUrl } from "@/client/api";
7-
import { aquaMaiConfig, globalCapture, musicList, selectedADir, selectMusicId, updateMusicList, version as appVersion } from "@/store/refs";
7+
import { globalCapture, musicList, selectedADir, selectMusicId, updateMusicList, version as appVersion } from "@/store/refs";
88
import { appSettings } from "@/store/settings";
99
import ErrorDisplayIdInput from "./ErrorDisplayIdInput";
1010
import ImportStepDisplay from "./ImportStepDisplay";
@@ -92,21 +92,11 @@ export default defineComponent({
9292
return !reject;
9393
}
9494

95-
const shouldUseH264 = () => {
96-
if (appSettings.value.movieCodec === MovieCodec.ForceH264) return true;
97-
if (appSettings.value.movieCodec === MovieCodec.ForceVp9) return false;
98-
return aquaMaiConfig.value?.sectionStates?.['GameSystem.Assets.MovieLoader']?.enabled && aquaMaiConfig.value?.entryStates?.['GameSystem.Assets.MovieLoader.LoadMp4Movie']?.value;
99-
}
100-
10195
const uploadMovie = (id: number, movie: File, offset: number) => new Promise<void>((resolve, reject) => {
10296
currentMovieProgress.value = 0;
10397
const body = new FormData();
104-
const h264 = shouldUseH264();
105-
console.log('use h264', h264);
106-
body.append('h264', h264.toString());
10798
body.append('padding', offset.toString());
108-
body.append('noScale', appSettings.value.noScale!.toString());
109-
body.append('yuv420p', appSettings.value.yuv420p!.toString());
99+
body.append('file', movie);
110100
body.append('file', movie);
111101
const controller = new AbortController();
112102
fetchEventSource(getUrl(`SetMovieApi/${selectedADir.value}/${id}`), {

0 commit comments

Comments
 (0)