Compare commits

...

3 Commits

Author SHA1 Message Date
a832589dcf ...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-06-17 04:44:26 +03:00
3f841c109a cleanup + docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-06-17 04:39:51 +03:00
83623ac722 added output conflict counter -- not used yet...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2025-06-17 04:37:14 +03:00
2 changed files with 40 additions and 17 deletions

View File

@ -1837,14 +1837,16 @@ var FileSystemWriterActions = actions.Actions({
%(...)m - add text in braces if image marked %(...)m - add text in braces if image marked
%(...)b - add text in braces if image is bookmark %(...)b - add text in braces if image is bookmark
%(...)C - add text in braces if there are name conflicts.
NOTE: this will be added to all images.
%(...)c - add text in braces if there are name conflicts %(...)c - add text in braces if there are name conflicts
present, but only if the current image has a present in current index, but only if the current
conflicting name. image has a conflicting name.
%c - number in set of conflicting names (default: 0). %c - number in set of conflicting names (default: 0).
NOTE: this is not stable and can change depending NOTE: this is not stable and can change depending
on image order. on image order.
%(...)f - same as %{...}c but for conflitcs in output directory
with pre-existing files.
%f - same as %c but for conflicts in output directory with
pre-existing files.
%(...)l - image level path, level depth corresponds to ribbon %(...)l - image level path, level depth corresponds to ribbon
number counting from the bottom number counting from the bottom
@ -1888,7 +1890,6 @@ var FileSystemWriterActions = actions.Actions({
this.images[gid] || {}, this.images[gid] || {},
data) data)
name = name name = name
|| pathlib.basename( || pathlib.basename(
data.path data.path
@ -1952,6 +1953,7 @@ var FileSystemWriterActions = actions.Actions({
.replace(/%c/, (conflicts && conflicts[gid]) ? .replace(/%c/, (conflicts && conflicts[gid]) ?
conflicts[gid].indexOf(gid) conflicts[gid].indexOf(gid)
: 0) : 0)
.replace(/%f/, data.number ?? 0)
// metadata... // metadata...
// XXX // XXX
@ -1969,11 +1971,12 @@ var FileSystemWriterActions = actions.Actions({
//.replace( //.replace(
// /%\(([^)]*)\)k/, tags.indexOf('bookmark') >= 0 ? '$1' : '') // /%\(([^)]*)\)k/, tags.indexOf('bookmark') >= 0 ? '$1' : '')
// conflicts... // in conflicts...
.replace(
/%\(([^)]*)\)C/, conflicts ? '$1' : '')
.replace( .replace(
/%\(([^)]*)\)c/, (conflicts || {})[gid] ? '$1' : '') /%\(([^)]*)\)c/, (conflicts || {})[gid] ? '$1' : '')
// out conflicts...
.replace(
/%\(([^)]*)\)f/, data.number > 0 ? '$1' : '')
// level... // level...
.replace( .replace(
@ -1990,6 +1993,22 @@ var FileSystemWriterActions = actions.Actions({
+(match.length + offset == str.length ? '' : '/') }) +(match.length + offset == str.length ? '' : '/') })
+ to_ext }], + to_ext }],
formatImageNameIter: ['- File/Format image filename (iter)',
core.doc`Same as .formatImageName(..) but returns an iterator advancing
the %f value.
data.number sets the initial count for %f
`,
function*(format, name, data){
var n = data.number ?? 0
var prev, cur
while(true){
cur = this.formatImageName(format, name, {__proto__: data, number: n++})
if(cur == prev){
break }
yield cur
prev = cur } }],
// XXX should this be sync??? // XXX should this be sync???
@ -2919,9 +2938,9 @@ var FileSystemWriterUIActions = actions.Actions({
// show example generated names... // show example generated names...
make(['Filename:', make(['Filename:',
function(){ return actions.formatImageName(pattern, img) }], function(){
{ return actions.formatImageName(pattern, img) }],
open: function(){ { open: function(){
showExaples(settings['preview-name-pattern'] showExaples(settings['preview-name-pattern']
|| EXPORT_PREVIEW_NAME) }, }) || EXPORT_PREVIEW_NAME) }, })

View File

@ -6,19 +6,23 @@
FPS=${FPS:-8} FPS=${FPS:-8}
if [ $1 == "-r" ] ; then if [ "$1" == "-r" ] ; then
FPS=$2 FPS="$2"
shift 2 shift 2
fi fi
if ! [ -z "$1" ] ; then
PATTERN="$1"
else
PATTERN=${PATTERN:-'*.jpg'}
fi
PATTERN=${PATTERN:-'*.jpg'} LST=($PATTERN)
# generate name... # generate name...
LST=($PATTERN)
A=${LST[0]} A=${LST[0]}
A=${A%.jpg} A=${A%.*}
B=${LST[$(( ${#LST[@]} - 1 ))]} B=${LST[$(( ${#LST[@]} - 1 ))]}
B=${B%.jpg} B=${B%.*}
NAME=${NAME:-${A}-${B}} NAME=${NAME:-${A}-${B}}