sidneys / ffmpeg-progressbar-cli

A colored progress bar for FFmpeg.

Home Page:https://npmjs.com/package/ffmpeg-progressbar-cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filename is too short

vasyl-shumskyi opened this issue · comments

Hello,

Thanks for the great wrapper! Works flawlessly.

Please consider making filename longer, because it is truncated too much which makes unclear what file is processed.

Screen Shot 2020-01-17 at 17 42 58

I tried to increase targetLength from 10 to larger number in
https://github.com/sidneys/ffmpeg-progressbar-cli/blob/master/lib/formatter.js#L36

But it didn't help

As a workaround for showing full filename I just commented out all filename length checker. And it seems to work now.

    if (fileNameLength > targetLength) {
        if (fileExtensionLength < (targetLength - 2)) {
            // Name too long: ellipse title, leave extension as-is
            // filetit….extension
            fileName = `${ellipsize(fileTitle, targetLength - fileExtensionLength, { ellipse: ellipseCharacter })}${fileExtension}`
        } else {
            // Name too long, extension too long: Ellipse title, hide extension
            // filetit…
            fileName = `${ellipsize(fileTitle, targetLength, { ellipse: ellipseCharacter })}`
        }
    } else if (fileNameLength < targetLength) {
        if (fileNameLength >= (targetLength - 1)) {
            // Name too short by less than 2 characters: pad title left
            //   filetitle.extension
            fileName = `${fileTitle}${fileExtension}`.padStart(targetLength, ' ')
        } else {
            // Name too short by more than 2 characters: Prefix ellipsed directory tree
            // …ocuments/filetitle.extension
            fileName = `${ellipseCharacter}${filePath.substr(filePath.length - targetLength + 1, filePath.length - 1)}`
        }
    } else {
        // File name has perfect length
        fileName = `${fileTitle}${fileExtension}`
    }

Same thing to me: long file names are cut, also if there is space left on screen
Screenshot: https://imgur.com/eUcOZWn