find tags and extension of file
This commit is contained in:
parent
2a2ece88a7
commit
dabebeb6fa
|
@ -24,10 +24,11 @@ function convertDateToTimeInFileName (inputDate) {
|
||||||
return inputDate.replace(' ', 'T')
|
return inputDate.replace(' ', 'T')
|
||||||
}
|
}
|
||||||
|
|
||||||
function findFormattedDate(inputString){
|
function findFormattedDate (inputString) {
|
||||||
|
|
||||||
return inputString.match(/^[0-9]{4}-?[0-9]{2}-?[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/)
|
return inputString.match(/^[0-9]{4}-?[0-9]{2}-?[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExifCreationDate (filepath) {
|
function getExifCreationDate (filepath) {
|
||||||
|
|
||||||
console.log('filepath', filepath)
|
console.log('filepath', filepath)
|
||||||
|
@ -77,15 +78,34 @@ function getExifCreationDate (filepath) {
|
||||||
|
|
||||||
const tagSeparator = ' '
|
const tagSeparator = ' '
|
||||||
const tagSectionSeparator = '--'
|
const tagSectionSeparator = '--'
|
||||||
function findTagSectionInString(inputString){
|
let fileSectionsName;
|
||||||
|
|
||||||
|
function findTagSectionInString (inputString) {
|
||||||
let listOfTags = []
|
let listOfTags = []
|
||||||
if(inputString.includes(tagSectionSeparator)){
|
// remove extension
|
||||||
let boom = inputString.splice(tagSectionSeparator)
|
let extensionFile = inputString.match(/\.\w{3,4}$/i)
|
||||||
if(boom.length){
|
|
||||||
listOfTags = [...boom.splice(tagSeparator)]
|
extensionFile = extensionFile[0]
|
||||||
|
|
||||||
|
inputString = inputString.replace(extensionFile, '')
|
||||||
|
|
||||||
|
console.log('extensionFile', extensionFile)
|
||||||
|
if (inputString.includes(tagSectionSeparator)) {
|
||||||
|
console.log('inputString', inputString)
|
||||||
|
if (inputString.length) {
|
||||||
|
|
||||||
|
let boom = inputString.split(tagSectionSeparator)
|
||||||
|
console.log('boom', boom)
|
||||||
|
if (boom.length) {
|
||||||
|
fileSectionsName = boom.splice(tagSeparator);
|
||||||
|
listOfTags = [... fileSectionsName[1].trim().split(tagSeparator)]
|
||||||
|
console.log('listOfTags', listOfTags)
|
||||||
|
}else{
|
||||||
|
console.log('no boom', boom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return listOfTags;
|
}
|
||||||
|
return listOfTags
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,6 +155,5 @@ const patternsFiles = {
|
||||||
'screenshot': '^Screenshot', // Screenshot 2023-06-15 at 15-26-04 Instance Panoramax OSM-FR.png
|
'screenshot': '^Screenshot', // Screenshot 2023-06-15 at 15-26-04 Instance Panoramax OSM-FR.png
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// getExifCreationDate('/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/2023-06-23T18.36.47 -- machin bidule.jpg')
|
// getExifCreationDate('/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/2023-06-23T18.36.47 -- machin bidule.jpg')
|
||||||
findTagSectionInString('2023-06-23T18.36.47 -- machin bidule.jpg')
|
findTagSectionInString('2023-06-23T18.36.47 -- machin bidule.jpg')
|
Loading…
Reference in New Issue