Fix chapters extract

This commit is contained in:
Chocobozzz 2023-08-30 19:24:01 +02:00
parent 76dbe843d1
commit 6495764268
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ function isLastWeek (d: Date) {
// ---------------------------------------------------------------------------
export const timecodeRegexString = `((\\d+)[h:])?((\\d+)[m:])?((\\d+)s?)?`
export const timecodeRegexString = `((\\d+)[h:])?((\\d+)[m:])?((\\d+)s?)`
function timeToInt (time: number | string) {
if (!time) return 0
@ -53,7 +53,6 @@ function timeToInt (time: number | string) {
const reg = new RegExp(`^${timecodeRegexString}$`)
const matches = time.match(reg)
if (!matches) return 0
const hours = parseInt(matches[2] || '0', 10)

View File

@ -206,6 +206,7 @@ describe('Extract chapters', function () {
expect(parseChapters('my super description\nno?')).to.deep.equal([])
expect(parseChapters('m00:00 super description\nno?')).to.deep.equal([])
expect(parseChapters('00:00super description\nno?')).to.deep.equal([])
expect(parseChapters('my super description\n'.repeat(10) + ' * list1\n * list 2\n * list 3')).to.deep.equal([])
})
it('Should extract chapters', function () {