duration criteria better

This commit is contained in:
Evert Prants 2018-11-07 18:54:31 +02:00
parent c6f2b8feed
commit 790516e385
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -87,12 +87,14 @@ async function getInfos (file) {
let parsed = JSON.parse(formatData.stdout) let parsed = JSON.parse(formatData.stdout)
if (!parsed || !parsed.format || !parsed.format.duration) throw new Error('Failed to parse metadata!') if (!parsed || !parsed.format || !parsed.format.duration) throw new Error('Failed to parse metadata!')
parsed = parsed.format parsed = parsed.format
let data = { let data = {
file, file,
duration: parseFloat(parsed.duration) duration: parseFloat(parsed.duration)
} }
if (Math.floor(data.duration) === 0) throw new Error('Invalid file type!')
if (parsed.tags) { if (parsed.tags) {
for (let k in parsed.tags) { for (let k in parsed.tags) {
let tagtype = k.toLowerCase() let tagtype = k.toLowerCase()