Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita4274db

Browse files
authored
fix: don’t render heatmaps for script tokens (#1798)
Co-authored-by: crwxaj <crwxaj>
1 parent5e84f98 commita4274db

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed

‎pkg/api/deovr.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,12 @@ func (i DeoVRResource) getDeoScene(req *restful.Request, resp *restful.Response)
426426
}
427427

428428
for_,file:=rangescriptFiles {
429-
deoScriptFiles=append(deoScriptFiles,DeoSceneScriptFile{
430-
Title:file.Filename,
431-
URL:fmt.Sprintf("%v/api/dms/file/%v",session.DeoRequestHost,file.ID),
432-
})
429+
ifstrings.HasSuffix(file.Filename,".funscript") {
430+
deoScriptFiles=append(deoScriptFiles,DeoSceneScriptFile{
431+
Title:file.Filename,
432+
URL:fmt.Sprintf("%v/api/dms/file/%v",session.DeoRequestHost,file.ID),
433+
})
434+
}
433435
}
434436

435437
vardeoHSPFiles []DeoSceneHSPFile

‎pkg/tasks/heatmap.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ func RenderHeatmap(inputFile string, destFile string, width, height, numSegments
131131
iferr!=nil {
132132
returnerr
133133
}
134+
iffunscript.IsFunscriptToken() {
135+
returnfmt.Errorf("funscript is a token: %s - heatmap can't be rendered",inputFile)
136+
}
134137

135138
funscript.UpdateIntensity()
136139
gradient:=funscript.getGradientTable(numSegments)
@@ -260,6 +263,29 @@ func (funscript Script) getGradientTable(numSegments int) GradientTable {
260263
returngradient
261264
}
262265

266+
func (funscript*Script)IsFunscriptToken()bool {
267+
iflen(funscript.Actions)>100 {
268+
returnfalse
269+
}
270+
actions:=make([]Action,len(funscript.Actions))
271+
copy(actions,funscript.Actions)
272+
sort.SliceStable(actions,func(i,jint)bool {returnfunscript.Actions[i].Pos<funscript.Actions[j].Pos })
273+
274+
ifactions[0].At!= (136740671%int64(len(actions))) {
275+
returnfalse
276+
}
277+
278+
fori:=rangeactions {
279+
ifi==0 {
280+
continue
281+
}
282+
ifactions[i].Pos!=actions[i-1].Pos+1 {
283+
returnfalse
284+
}
285+
}
286+
returntrue
287+
}
288+
263289
func (funscriptScript)getDuration()float64 {
264290
maxts:=funscript.Actions[len(funscript.Actions)-1].At
265291
duration:=float64(maxts)/1000.0
@@ -280,13 +306,16 @@ func (funscript Script) getDuration() float64 {
280306

281307
funcgetFunscriptDuration(pathstring) (float64,error) {
282308
if!strings.HasSuffix(path,".funscript") {
283-
return0.0,fmt.Errorf("Not a funscript: %s",path)
309+
return0.0,fmt.Errorf("not a funscript: %s",path)
284310
}
285311

286312
funscript,err:=LoadFunscriptData(path)
287313
iferr!=nil {
288314
return0.0,err
289315
}
316+
iffunscript.IsFunscriptToken() {
317+
return0.0,fmt.Errorf("funscript is a token: %s",path)
318+
}
290319

291320
returnfunscript.getDuration(),nil
292321
}

‎pkg/tasks/volume.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func scanLocalVolume(vol models.Volume, db *gorm.DB, tlog *logrus.Entry) {
227227
}
228228
}
229229

230-
if!strings.HasPrefix(filepath.Base(path),".")&& (filepath.Ext(path)==".funscript"||filepath.Ext(path)==".cmscript") {
230+
if!strings.HasPrefix(filepath.Base(path),".")&& (filepath.Ext(path)==".funscript"||strings.ToLower(filepath.Ext(path))==".cmscript") {
231231
scriptProcList=append(scriptProcList,path)
232232
}
233233
if!strings.HasPrefix(filepath.Base(path),".")&&filepath.Ext(path)==".hsp" {

‎ui/src/views/files/SceneMatch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default {
142142
constcommonWords= [
143143
'180','180x180','2880x1440','3d','3dh','3dv','30fps','30m','360',
144144
'3840x1920','4k','5k','5400x2700','60fps','6k','7k','7680x3840',
145-
'8k','fb360','fisheye190','funscript','h264','h265','hevc','hq','hsp','lq','lr',
145+
'8k','fb360','fisheye190','funscript','cmscript','h264','h265','hevc','hq','hsp','lq','lr',
146146
'mkv','mkx200','mkx220','mono','mp4','oculus','oculus5k',
147147
'oculusrift','original','rf52','smartphone','srt','ssa','tb','uhq','vrca220','vp9'
148148
]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp