@ -1,9 +1,9 @@
import i18n from 'i18next' ;
import lodashTemplate from 'lodash/template' ;
import { isMac , isWindows , hasDuplicates , filenamify , getOutFileExtension , getNumDigits } from '../util' ;
import { isMac , isWindows , hasDuplicates , filenamify , getOutFileExtension } from '../util' ;
import isDev from '../isDev' ;
import { getSegmentTags } from '../segments' ;
import { getSegmentTags , formatSegNum } from '../segments' ;
const { parse : parsePath , sep : pathSep , join : pathJoin , normalize : pathNormalize } = window . require ( 'path' ) ;
@ -85,15 +85,10 @@ function interpolateSegmentFileName({ template, inputFileNameWithoutExt, segSuff
return compiled ( data ) ;
}
function formatSegNum ( segIndex , segments ) {
const numDigits = getNumDigits ( segments ) ;
return ` ${ segIndex + 1 } ` . padStart ( numDigits , '0' ) ;
}
export function generateOutSegFileNames ( { segments , template , forceSafeOutputFileName , formatTimecode , isCustomFormatSelected , fileFormat , filePath , safeOutputFileName , maxLabelLength } ) {
return segments . map ( ( segment , i ) => {
const { start , end , name = '' } = segment ;
const segNum = formatSegNum ( i , segments );
const segNum = formatSegNum ( i , segments . length ) ;
// Fields that did not come from the source file's name must be sanitized, because they may contain characters that are not supported by the target operating/file system
// however we disable this when the user has chosen to (safeOutputFileName === false)