1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-15 09:35:21 +01:00

new photo script tweaks

This commit is contained in:
Matthias Kretschmann 2020-03-04 19:54:17 +01:00
parent 480ba0335e
commit 6fe627f0fc
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -57,6 +57,7 @@ async function getExif(imagePath) {
async function createPhotoPost() { async function createPhotoPost() {
const photo = process.argv[3] const photo = process.argv[3]
try {
const exifData = await getExif(photo) const exifData = await getExif(photo)
title = exifData.iptc.object_name || exifData.iptc.title title = exifData.iptc.object_name || exifData.iptc.title
titleSlug = slugify(title, { lower: true }) titleSlug = slugify(title, { lower: true })
@ -88,6 +89,9 @@ async function createPhotoPost() {
if (err) spinner.fail(`Error creating photo post: ${err}`) if (err) spinner.fail(`Error creating photo post: ${err}`)
spinner.succeed(`New photo post '${title}' as '${fileName}.md' created.`) spinner.succeed(`New photo post '${title}' as '${fileName}.md' created.`)
}) })
} catch (error) {
console.error(error.message)
}
} }
if (isPhoto) { if (isPhoto) {