[SCRIPT] Import native filesystem xattr metadata from .xattr folder

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
rednoah
The Source
Posts: 23847
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[SCRIPT] Import native filesystem xattr metadata from .xattr folder

Post by rednoah »

Script:

Groovy: Select all

args.files.each{ f ->
	def xattr = f.dir / '.xattr' / f.name / 'net.filebot.metadata'
	if (xattr.exists()) {
		log.info xattr
		log.fine xattr.text
		f.xattr.'net.filebot.metadata' = xattr.text 
	}
}
Usage:

Shell: Select all

filebot -script /path/to/import-xattr-folder.groovy /path/to/input



EDIT:

:idea: The built-in xattr script has been enhanced to enable metadata import from / export to .xattr folders:

Shell: Select all

filebot -script fn:xattr /input --action import

e.g.

Shell: Select all

#!/bin/sh -xu
export MEDIA_FOLDER='/volume1/Media'

filebot -script fn:xattr "$MEDIA_FOLDER" --action import --log info
filebot -find "$MEDIA_FOLDER" --apply thumbnail refresh --log info
find "$MEDIA_FOLDER" -type d -name .xattr -exec rm -rv {} +
:idea: Please read the FAQ and How to Request Help.
Post Reply