From c75204ce72e4a3e4482b8a601f034454bd8d0c41 Mon Sep 17 00:00:00 2001 From: Abraham Makovetsky Date: Tue, 25 Jun 2019 09:24:40 +0300 Subject: [PATCH 1/4] added handling for the case of `("H.264",AAC)` --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 2e97163..f065ebe 100644 --- a/index.js +++ b/index.js @@ -69,6 +69,12 @@ function to_js_type(key) { return value.slice(1, -1) } + // handle cases like `("H.264",AAC)` where AAC doesn't + // get wrapped with double-quotes + if (/[a-zA-Z]+/.test(value)) { + return value; + } + const as_num = +value if(!isNaN(as_num)) { From d47a9175a4e2d60e081349968d620108309a2464 Mon Sep 17 00:00:00 2001 From: Abraham Makovetsky Date: Tue, 25 Jun 2019 09:28:34 +0300 Subject: [PATCH 2/4] giving date type a chance before looking for chars in str --- index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index f065ebe..d34d181 100644 --- a/index.js +++ b/index.js @@ -69,12 +69,6 @@ function to_js_type(key) { return value.slice(1, -1) } - // handle cases like `("H.264",AAC)` where AAC doesn't - // get wrapped with double-quotes - if (/[a-zA-Z]+/.test(value)) { - return value; - } - const as_num = +value if(!isNaN(as_num)) { @@ -83,11 +77,17 @@ function to_js_type(key) { const as_date = new Date(value) - if(isNaN(as_date.getTime())) { - bad_value(key, value) + if(!isNaN(as_date.getTime())) { + return as_date + } + + // handle cases like `("H.264",AAC)` where AAC doesn't + // get wrapped with double-quotes + if (/[a-zA-Z]+/.test(value)) { + return value } - return as_date + bad_value(key, value) } } From 2a1f087519542304a5abc74bf6c02ea0eb3f883a Mon Sep 17 00:00:00 2001 From: Abraham Makovetsky Date: Wed, 26 Jun 2019 11:48:56 +0300 Subject: [PATCH 3/4] added jetbrain generated files to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index da23d0d..52eedce 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ build/Release # Deployed apps should consider commenting this line out: # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git node_modules + +# jetbrain related directories/files +.idea/ From 1cdde39efa7a9c801d3b407bc533b7629b18de11 Mon Sep 17 00:00:00 2001 From: Abraham Makovetsky Date: Wed, 26 Jun 2019 11:49:46 +0300 Subject: [PATCH 4/4] now also handling parentheses in filenames --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d34d181..06943f7 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,10 @@ function mdls(file, args, ready) { if (typeof args !== 'string') { ready = args; } - file = path.resolve(file).replace(/ /g, '\\ ') + file = path.resolve(file) + .replace(/ /g, '\\ ') + .replace(/\(/g, '\\(') + .replace(/\)/g, '\\)') return new Promise((resolve, reject) => { exec('mdls ' + (args ? args + ' ' : '') + file, function(err, raw_data) {