[Script] Copy Xattr Metadata from Video Files to Companion Files
Posted: 11 Aug 2024, 07:43
Find video files that have xattr metadata and then copy that xattr metadata to all the companion files (e.g. subtitle files) in the same folder that share the same file name:
--filter expression to select video files that have xattr metadata:
--apply script to copy xattr metadata to derived-by-name companion files:
Alternatively, the same can be accomplished with filebot -script and a standalone custom script:
Shell: Select all
filebot -find /path/to/input --filter 'f.video && f.metadata' --apply '{ source, target -> target.dir.listFiles{ it.isDerived(f) }*.metadata = target.metadata }'
--filter expression to select video files that have xattr metadata:
Groovy: Select all
f.video && f.metadata
--apply script to copy xattr metadata to derived-by-name companion files:
Groovy: Select all
{ source, target ->
target.dir.listFiles{ it.isDerived(f) }*.metadata = target.metadata
}
Alternatively, the same can be accomplished with filebot -script and a standalone custom script:
Shell: Select all
filebot /path/to/input -script /path/to/copy-metadata.groovy
Groovy: Select all
args.files.each{ f ->
if (f.video && f.metadata) {
f.dir.listFiles{ it.isDerived(f) }*.metadata = f.metadata
}
}