-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import all OS X tags attached to video files #370
base: main
Are you sure you want to change the base?
Changes from 3 commits
88a0a07
dbdcfe3
7959f56
c27a488
300fca5
eb64e8f
cb0b5de
9643b1f
65b5dd7
c6b3253
e1aaba0
39149be
5366071
93914fb
f561028
a521cf7
4bfdd78
00558d0
0e8d393
9bd3c38
600d2fd
3b94ae4
698bb51
418f98f
fa3d15f
640ae0d
7aa7b7b
47443af
63e7c36
2ee41ab
c77bc85
3e87d04
e926e98
1562038
8cf4a1a
96b86a6
98c2a22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,14 @@ | |
* There should be no side-effects of running any of them | ||
* They should depend only on their inputs and behave exactly | ||
* the same way each time they run no matter the outside state | ||
* | ||
* !!!!!!!!!!!! WARNING !!!!!!!!!!!!!!! | ||
* DANGEROUSLY DEPENDS ON `codeRunningOnMac` when extracting metadata | ||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
*/ | ||
|
||
const codeRunningOnMac: boolean = process.platform === 'darwin'; // <---- MAKES MANY FUNCTIONS NOT PURE !!!! | ||
|
||
import * as path from 'path'; | ||
|
||
const fs = require('fs'); | ||
|
@@ -14,6 +20,8 @@ const hasher = require('crypto').createHash; | |
|
||
const exec = require('child_process').exec; | ||
|
||
const tag = require('osx-tag'); | ||
|
||
const ffprobePath = require('@ffprobe-installer/ffprobe').path.replace('app.asar', 'app.asar.unpacked'); | ||
|
||
import { acceptableFiles } from './main-filenames'; | ||
|
@@ -490,7 +498,24 @@ function extractMetadataForThisONEFile( | |
imageElement.width = origWidth; | ||
imageElement.screens = computeNumberOfScreenshots(screenshotSettings, duration); | ||
|
||
extractMetaCallback(imageElement); | ||
// !!!! WARNING !!!!!! NOT A PURE FUNCTION ANY MORE !!!!!!!!!!!!!!! | ||
if (codeRunningOnMac) { | ||
tag.getTags(filePath, (tagErr: any, tags: string[]) => { | ||
if (tagErr) { | ||
console.log('tags error!!!'); | ||
extractMetaCallback(imageElement); | ||
} | ||
console.log('tags found:'); | ||
console.log(tags); | ||
if (tags.length) { | ||
imageElement.tags = tags; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch! 👀 This code is WIP placeholder just to test out the library. Thank you for adding the note -- I'll definitely not forget to fix it before merging 🤝 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm planning on adding my |
||
} | ||
extractMetaCallback(imageElement); | ||
}); | ||
} else { | ||
extractMetaCallback(imageElement); | ||
} | ||
|
||
} | ||
}); | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard this require, or try catch it 😄