Skip to content

Commit

Permalink
fix variable scope for offset validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Apr 22, 2022
1 parent a3674bb commit b5d76bd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,23 @@ class VideoSyncCommand extends Command {
// check if one of the videos is warped
let videoWarped = false
if (!flags.noOffsetValidation) {

const offsetValidationSpinner = ora(`Checking if found offset applies to the whole video...`).start();
try {
videoWarped = ! await validateOffset(args.destination, args.source, videoOffset)
} catch (err) {
console.error(`Error while checking if found offset applies to the whole video:`, err)
}
}

// log warning about warped video
if (videoWarped && flags.confirm) {
offsetValidationSpinner.warn(`Syncing the tracks might not work well because one of the videos appears to be warped.`)
} else if (!videoWarped) {
offsetValidationSpinner.succeed(`Offset is valid.`)
} else {
offsetValidationSpinner.stop()
// log warning about warped video
if (videoWarped && flags.confirm) {
offsetValidationSpinner.warn(`Syncing the tracks might not work well because one of the videos appears to be warped.`)
} else if (!videoWarped) {
offsetValidationSpinner.succeed(`Offset is valid.`)
} else {
offsetValidationSpinner.stop()
}

}

let continueWithMerging = answers.output !== undefined && (selectedTracks.audio.length > 0 || selectedTracks.subs.length > 0)
Expand Down

0 comments on commit b5d76bd

Please sign in to comment.