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
%(...)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
present, but only if the current image has a
conflicting name.
present in current index, but only if the current
image has a conflicting name.
%c - number in set of conflicting names (default: 0).
NOTE: this is not stable and can change depending
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
number counting from the bottom
@ -1888,7 +1890,6 @@ var FileSystemWriterActions = actions.Actions({
this.images[gid] || {},
data)
name = name
|| pathlib.basename(
data.path
@ -1952,6 +1953,7 @@ var FileSystemWriterActions = actions.Actions({
.replace(/%c/, (conflicts && conflicts[gid]) ?
conflicts[gid].indexOf(gid)
: 0)
.replace(/%f/, data.number ?? 0)
// metadata...
// XXX
@ -1969,11 +1971,12 @@ var FileSystemWriterActions = actions.Actions({
//.replace(
// /%\(([^)]*)\)k/, tags.indexOf('bookmark') >= 0 ? '$1' : '')
// conflicts...
.replace(
/%\(([^)]*)\)C/, conflicts ? '$1' : '')
// in conflicts...
.replace(
/%\(([^)]*)\)c/, (conflicts || {})[gid] ? '$1' : '')
// out conflicts...
.replace(
/%\(([^)]*)\)f/, data.number > 0 ? '$1' : '')
// level...
.replace(
@ -1990,6 +1993,22 @@ var FileSystemWriterActions = actions.Actions({
+(match.length + offset == str.length ? '' : '/') })
+ 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???
@ -2919,9 +2938,9 @@ var FileSystemWriterUIActions = actions.Actions({
// show example generated names...
make(['Filename:',
function(){ return actions.formatImageName(pattern, img) }],
{
open: function(){
function(){
return actions.formatImageName(pattern, img) }],
{ open: function(){
showExaples(settings['preview-name-pattern']
|| EXPORT_PREVIEW_NAME) }, })

View File

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