Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
17 changes: 13 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -77,11 +80,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
}

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
}

bad_value(key, value)
}
}

Expand Down