Metadata and Extended Attributes

How-to guides, frequently asked questions, not-so-obvious features, etc
Locked
User avatar
rednoah
The Source
Posts: 19130
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Metadata and Extended Attributes

Post by rednoah »

FileBot uses xattr (i.e. Extended Attributes / NTFS Alternative Streams) to store full metadata in filesystem attributes. These xattr are not to be confused with traditional tags that are embedded in the file content, but additional data streams stored in the file system for each file that are not part of the file itself. As such, xattr requires a filesystem that supports xattr, and xattr may be silently lost if files are moved to a filesystem that doesn't support xattr.


Details:
  • [xattr:net.filebot.metadata] Episode or Movie Object (as json)
  • [xattr:net.filebot.filename] Original filename
  • [basic:creationTime] Episode airdate or Movie release year (disabled by default for compatibility reasons)

Usage:
FileBot and other programs have the original filename and all episode / movie metadata available regardless how the file is named. Sure nice to have full metadata instantly / offline available should you need it.


Disable this feature via the -no-xattr command-line flag:

Code: Select all

-no-xattr
or via system properties:

Code: Select all

filebot -script fn:properties --def useExtendedFileAttributes=false

Configure FileBot to store xattr metadata in plain text files instead of filesystem xattr streams:

Code: Select all

filebot -script fn:properties --def net.filebot.xattr.store=.xattr
:idea: If you require cross-platform compatibility, then using .xattr folders and files is highly recommended. The FileBot Xattr Metadata Scanners & Plug-ins for Plex
support both native filesystem xattr and .xattr folders by default.


View or Clear Extended Attributes
with the filebot command-line tools and xattr script:

Code: Select all

filebot -script fn:xattr /path/to/files
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 19130
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

View or Clear Extended Attributes

Post by rednoah »

If Extended Attributes are enabled and supported by your file system, then FileBot will the store original file name and episode / movie metadata into Extended Attributes for future reference by FileBot or other applications.


e.g. write xattr:

Code: Select all

$ filebot -rename . --db TheTVDB -non-strict --log INFO
[MOVE] from [Alias.1x01.mp4] to [Alias - 1x01 - Truth Be Told.mp4]

e.g. read xattr:

Code: Select all

$ filebot -script fn:xattr .
Alias - 1x01 - Truth Be Told.mp4
	net.filebot.filename: Alias.1x01.mp4
	net.filebot.metadata: {"@type":"Episode","seriesName":"Alias","season":1,"episode":1,"title":"Truth Be Told","airdate":{"year":2001,"month":9,"day":30},"id":180267,"seriesInfo":{"database":"TheTVDB","order":"Airdate","language":"en","type":"TV Series","id":75930,"name":"Alias","aliasNames":["Alias - Die Agentin","Alias (2001)","זהות בדויה","Alias - Codinome Perigo","Шпионка","特務A"],"certification":"TV-14","startDate":{"year":2001,"month":9,"day":30},"genres":["Action","Adventure","Drama","Suspense"],"network":"ABC (US)","rating":8.2,"ratingCount":3316,"runtime":45,"status":"Ended"}}

e.g. read xattr with 3rd party tools:

Code: Select all

$ xattr -p net.filebot.metadata *.mp4 | jsonpp
{
  "@type": "Episode",
  "seriesName": "Alias",
  "season": 1,
  "episode": 1,
  "title": "Truth Be Told",
  "airdate": {
    "year": 2001,
    "month": 9,
    "day": 30
  },
  "id": 180267,
  "seriesInfo": {
    "database": "TheTVDB",
    "order": "Airdate",
    "language": "en",
    "type": "TV Series",
    "id": 75930,
    "name": "Alias",
    "aliasNames": [
      "Alias - Die Agentin",
      "Alias (2001)",
      "זהות בדויה",
      "Alias - Codinome Perigo",
      "Шпионка",
      "特務A"
    ],
    "certification": "TV-14",
    "startDate": {
      "year": 2001,
      "month": 9,
      "day": 30
    },
    "genres": [
      "Action",
      "Adventure",
      "Drama",
      "Suspense"
    ],
    "network": "ABC (US)",
    "rating": 8.2,
    "ratingCount": 3316,
    "runtime": 45,
    "status": "Ended"
  }
}

e.g. read xattr via our xattr.py python script:

Code: Select all

$ python xattr.py *.mp4 net.filebot.metadata
...
:idea: Please read the FAQ and How to Request Help.
Locked