check if the subtitle label ends with a number
This commit is contained in:
@@ -612,9 +612,10 @@ function addSubtitle (file) {
|
|||||||
state.playing.subtitles.tracks.forEach(function (trackItem) {
|
state.playing.subtitles.tracks.forEach(function (trackItem) {
|
||||||
trackItem.selected = false
|
trackItem.selected = false
|
||||||
if (trackItem.label === track.label) {
|
if (trackItem.label === track.label) {
|
||||||
track.label = Number.isNaN(track.label.slice(-1))
|
var labelParts = /([^\d]+)(\d+)$/.exec(track.label)
|
||||||
? track.label + ' 2'
|
track.label = labelParts
|
||||||
: track.label.slice(0, -1) + (parseInt(track.label.slice(-1)) + 1)
|
? labelParts[1] + (parseInt(labelParts[2]) + 1)
|
||||||
|
: track.label + ' 2'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
state.playing.subtitles.change = track.label
|
state.playing.subtitles.change = track.label
|
||||||
|
|||||||
Reference in New Issue
Block a user