add gopro restore name options

This commit is contained in:
Tykayn 2023-09-10 12:16:11 +02:00 committed by tykayn
parent 1783ce4fba
commit 16e4a8a4e8
3 changed files with 47 additions and 7 deletions

View File

@ -22,6 +22,11 @@ utiliser le setup pour mettre en place l'architecture de dossiers de rangement.
## options
* -n , dry-run, ne pas renommer
* --photos-folder, spécifie un dossier pour les photos
* --gopro-restore-name, ne garde que les descriptions de fichier et l'extension
* --remove-timestamp, enlève le timestamp en début de nom de fichier.
* --remove-free-text, enlève le texte libre entre le timestamp et les tags.
* --remove-tags, enlève les tags.
* --remove-extension, enlève l'extension finale.
# English
## This is a work in progress
@ -29,7 +34,8 @@ utiliser le setup pour mettre en place l'architecture de dossiers de rangement.
"npm start" gives you a demo of what Rangement can do, but this is not a production ready package yet.
# done
* Rename with exif data
* New file name typology as Personal Information Management defined by Karl Voit and its Phd thesis.
* Handle verbosity levels in logs
- log.trace(msg)
- log.debug(msg)
@ -40,6 +46,8 @@ utiliser le setup pour mettre en place l'architecture de dossiers de rangement.
# Roadmap
* Internationalisation of console texts
* Rename with addition of folder containing. RFF https://www.cipherbliss.com/script-rff-rename-file-folder
* Controlled vocabulary handling
* Proper testing
* Template configuration for auto dispatching of files after rename
* Handle a configuration file

View File

@ -1,4 +1,4 @@
import finder from '../utils/finder'
import finder from '../utils/finder.ts'
import { makeFileNameFromProperties } from '../old_index'
import { expect } from '@jest/globals'
@ -140,4 +140,4 @@ describe('modifications with tags', () => {
xtest('should remove with minus prefix and add tags in file name at the same time', () => {
})
})
})

View File

@ -197,16 +197,48 @@ export default class finder {
tagPlace = ' ' + rangement_instance.tagSectionSeparator + ' ' + fileProperties.tags.join(rangement_instance.tagSeparator)
}
log.debug('fileProperties.dateStampExif', fileProperties.dateStampExif)
let newName = '';
let timestampFormatted = fileProperties.dateStampExif;
/**
* restauration de typologie de nom de fichier gopro pour faciliter les assemblages.
*/
if(this.mini_arguments['gopro-restore-name']){
this.mini_arguments['remove-timestamp'] = true;
this.mini_arguments['remove-tags'] = true;
}
if(this.mini_arguments['remove-tags'] ){
tagPlace = '';
}
if(this.mini_arguments['remove-timestamp'] ){
timestampFormatted = '';
}
if(this.mini_arguments['remove-freetext'] ){
log.debug('override remove-freetext' )
rangement_instance.keepFreeText = false;
}
let extension = fileProperties.extension.trim();
if(this.mini_arguments['remove-extension'] ){
extension = '';
}
let spacer = '';
if (fileProperties.dateStampExif && fileProperties.freeText && rangement_instance.keepFreeText) {
if (timestampFormatted && fileProperties.freeText && rangement_instance.keepFreeText ) {
spacer = ' '
}
let newName = ''
+ fileProperties.dateStampExif
/**
* assemblage du schéma de nom
*/
newName += timestampFormatted
+ spacer
+ (rangement_instance.keepFreeText ? fileProperties.freeText : '')
+ tagPlace.trim()
+ fileProperties.extension.trim()
+ extension
if (rangement_instance.replaceUnderscoreWithSpaces) {
newName = newName.replace('_', ' ')