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

Commit3170153

Browse files
Alderamin49lyAlderamin
and
Alderamin
authored
feat: add option to sort subtitle files in player api (#1780)
Co-authored-by: Alderamin <alderamin49ly@gmail.com>
1 parentd7334d4 commit3170153

File tree

7 files changed

+66
-15
lines changed

7 files changed

+66
-15
lines changed

‎pkg/api/deovr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ func (i DeoVRResource) getDeoScene(req *restful.Request, resp *restful.Response)
419419

420420
vardeoScriptFiles []DeoSceneScriptFile
421421
varscriptFiles []models.File
422-
scriptFiles,err=scene.GetScriptFiles()
422+
scriptFiles,err=scene.GetScriptFilesSorted(config.Config.Interfaces.Players.ScriptSortSeq)
423423
iferr!=nil {
424424
log.Error(err)
425425
return

‎pkg/api/heresphere.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ func (i HeresphereResource) getHeresphereScene(req *restful.Request, resp *restf
567567

568568
varheresphereSubtitlesFiles []HeresphereSubtitles
569569
varsubtitlesFiles []models.File
570-
subtitlesFiles,err=scene.GetSubtitlesFiles()
570+
subtitlesFiles,err=scene.GetSubtitlesFilesSorted(config.Config.Interfaces.Players.SubtitleSortSeq)
571571
iferr!=nil {
572572
log.Error(err)
573573
return

‎pkg/api/options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ type RequestSaveOptionsDeoVR struct {
102102
MultitrackCuepointsbool`json:"multitrack_cuepoints"`
103103
VideoSortSeqstring`json:"video_sort_seq"`
104104
ScriptSortSeqstring`json:"script_sort_seq"`
105+
SubtitleSortSeqstring`json:"subtitle_sort_seq"`
105106
MultitrackCastCuepointsbool`json:"multitrack_cast_cuepoints"`
106107
RetainNonHSPCuepointsbool`json:"retain_non_hsp_cuepoints"`
107108
}
@@ -536,6 +537,7 @@ func (i ConfigResource) saveOptionsDeoVR(req *restful.Request, resp *restful.Res
536537
config.Config.Interfaces.Heresphere.MultitrackCuepoints=r.MultitrackCuepoints
537538
config.Config.Interfaces.Players.VideoSortSeq=r.VideoSortSeq
538539
config.Config.Interfaces.Players.ScriptSortSeq=r.ScriptSortSeq
540+
config.Config.Interfaces.Players.SubtitleSortSeq=r.SubtitleSortSeq
539541
config.Config.Interfaces.Heresphere.MultitrackCastCuepoints=r.MultitrackCastCuepoints
540542
config.Config.Interfaces.Heresphere.RetainNonHSPCuepoints=r.RetainNonHSPCuepoints
541543
ifr.Password!=config.Config.Interfaces.DeoVR.Password&&r.Password!="" {

‎pkg/config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ type ObjectConfig struct {
9797
RetainNonHSPCuepointsbool`default:"true" json:"retain_non_hsp_cuepoints"`
9898
}`json:"heresphere"`
9999
Playersstruct {
100-
VideoSortSeqstring`default:"" json:"video_sort_seq"`
101-
ScriptSortSeqstring`default:"" json:"script_sort_seq"`
100+
VideoSortSeqstring`default:"" json:"video_sort_seq"`
101+
ScriptSortSeqstring`default:"" json:"script_sort_seq"`
102+
SubtitleSortSeqstring`default:"" json:"subtitle_sort_seq"`
102103
}`json:"players"`
103104
}`json:"interfaces"`
104105
Librarystruct {

‎pkg/models/model_scene.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,15 @@ func (o *Scene) GetHSPFiles() ([]File, error) {
280280
returnfiles,nil
281281
}
282282

283-
func (o*Scene)GetSubtitlesFiles() ([]File,error) {
283+
func (o*Scene)GetSubtitlesFilesSorted(sortstring) ([]File,error) {
284284
commonDb,_:=GetCommonDB()
285285

286286
varfiles []File
287-
commonDb.Preload("Volume").Where("scene_id = ? AND type = ?",o.ID,"subtitles").Find(&files)
287+
ifsort=="" {
288+
commonDb.Preload("Volume").Where("scene_id = ? AND type = ?",o.ID,"subtitles").Find(&files)
289+
}else {
290+
commonDb.Preload("Volume").Where("scene_id = ? AND type = ?",o.ID,"subtitles").Order(sort).Find(&files)
291+
}
288292

289293
returnfiles,nil
290294
}

‎ui/src/store/optionsDeoVR.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const state = {
2626
},
2727
players:{
2828
video_sort_seq:'',
29-
script_sort_seq:''
29+
script_sort_seq:'',
30+
subtitle_sort_seq:''
3031
}
3132
}
3233

@@ -56,6 +57,7 @@ const actions = {
5657
state.heresphere.multitrack_cuepoints=data.config.interfaces.heresphere.multitrack_cuepoints
5758
state.players.video_sort_seq=data.config.interfaces.players.video_sort_seq
5859
state.players.script_sort_seq=data.config.interfaces.players.script_sort_seq
60+
state.players.subtitle_sort_seq=data.config.interfaces.players.subtitle_sort_seq
5961
state.heresphere.multitrack_cast_cuepoints=data.config.interfaces.heresphere.multitrack_cast_cuepoints
6062
state.heresphere.retain_non_hsp_cuepoints=data.config.interfaces.heresphere.retain_non_hsp_cuepoints
6163
state.loading=false

‎ui/src/views/options/sections/InterfaceDeoVR.vue

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,31 @@
110110
</b-dropdown>
111111
</b-field>
112112
</b-tooltip>
113+
<b-tooltiplabel="Specify fields if you wish to control the sequence of the scene's subtitle files"multilined:delay="750" >
114+
<b-fieldlabel="Subtitle File Sorting">
115+
<b-inputv-model="subtitleSequence"disabled></b-input>
116+
</b-field>
117+
<b-field>
118+
<b-buttonlabel="Add Field"@click="addVideoField('subtitle')" />
119+
<b-buttonlabel="Clear Fields"@click="subtitleSequence=''" />
120+
<b-dropdownv-model="selectedSubtitleField"aria-role="list">
121+
<template #trigger>
122+
<b-button:label="selectedSubtitleField"icon-right="menu-down" />
123+
</template>
124+
<b-dropdown-itemaria-role="listitem"value='Filename'>Filename</b-dropdown-item>
125+
<b-dropdown-itemaria-role="listitem"value='Added'>Added</b-dropdown-item>
126+
<b-dropdown-itemaria-role="listitem"value='Updated'>Updated</b-dropdown-item>
127+
<b-dropdown-itemaria-role="listitem"value='Selected'>Selected</b-dropdown-item>
128+
</b-dropdown>
129+
<b-dropdownv-model="selectedSubtitleSequence"aria-role="list">
130+
<template #trigger>
131+
<b-button:label="selectedSubtitleSequence"icon-right="menu-down" />
132+
</template>
133+
<b-dropdown-itemaria-role="listitem"value='Ascending'>Ascending</b-dropdown-item>
134+
<b-dropdown-itemaria-role="listitem"value='Descending'>Descending</b-dropdown-item>
135+
</b-dropdown>
136+
</b-field>
137+
</b-tooltip>
113138
</div>
114139
</div>
115140
</section>
@@ -248,7 +273,9 @@ export default {
248273
selectedVideoField:'Filename',
249274
selectedVideoSequence:'Ascending',
250275
selectedScriptField:'Filename',
251-
selectedScriptSequence:'Ascending'
276+
selectedScriptSequence:'Ascending',
277+
selectedSubtitleField:'Filename',
278+
selectedSubtitleSequence:'Ascending'
252279
}
253280
},
254281
methods: {
@@ -269,8 +296,10 @@ export default {
269296
addVideoField(type) {
270297
let dbfield=''
271298
let field=this.selectedVideoField
272-
if (type!='video'){
299+
if (type=='script') {
273300
field=this.selectedScriptField
301+
}elseif (type=='subtitle') {
302+
field=this.selectedSubtitleField
274303
}
275304
276305
switch (field) {
@@ -301,21 +330,26 @@ export default {
301330
default:
302331
dbfield=field.toLowerCase()
303332
}
304-
305-
if (type=='video'){
333+
334+
if (type=='video') {
306335
if (this.selectedVideoSequence=='Ascending') {
307336
this.videoSequence=[this.videoSequence, dbfield ].filter(Boolean).join(',')
308-
}else{
337+
}else{
309338
this.videoSequence=[this.videoSequence, dbfield+' desc' ].filter(Boolean).join(',')
310339
}
311-
}else{
340+
}elseif (type=='script'){
312341
if (this.selectedScriptSequence=='Ascending') {
313342
this.scriptSequence=[this.scriptSequence, dbfield ].filter(Boolean).join(',')
314-
}else{
343+
}else{
315344
this.scriptSequence=[this.scriptSequence, dbfield+' desc' ].filter(Boolean).join(',')
316345
}
346+
}else {
347+
if (this.selectedSubtitleSequence=='Ascending') {
348+
this.subtitleSequence=[this.subtitleSequence, dbfield ].filter(Boolean).join(',')
349+
}else {
350+
this.subtitleSequence=[this.subtitleSequence, dbfield+' desc' ].filter(Boolean).join(',')
351+
}
317352
}
318-
319353
}
320354
},
321355
computed: {
@@ -460,6 +494,14 @@ export default {
460494
this.$store.state.optionsDeoVR.players.script_sort_seq= value
461495
},
462496
},
497+
subtitleSequence: {
498+
get () {
499+
returnthis.$store.state.optionsDeoVR.players.subtitle_sort_seq
500+
},
501+
set (value) {
502+
this.$store.state.optionsDeoVR.players.subtitle_sort_seq= value
503+
},
504+
},
463505
multiTrackCastCuepoints: {
464506
get () {
465507
returnthis.$store.state.optionsDeoVR.heresphere.multitrack_cast_cuepoints

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp