[DOCS] {hd} video definition class binding

All about user-defined episode / movie / file name format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 23469
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[DOCS] {hd} video definition class binding

Post by rednoah »

The {hd} binding will give you access to the video definition class:
  • SD for low definition video files (e.g. 480p or 576p)
  • HD for high definition video files (e.g. 720p)
  • FHD for full high definition video files (e.g. 1080p)
  • QHD for full quad definition video files (e.g. 1440p)
  • UHD for 4K and ultra high definition video files (e.g. 2160p or 4320p)

e.g. sort movie files into 4K and non-4K movie folders:

Format: Select all

{ hd =~ /UHD/ ? 'Movies 4K' : 'Movies' }/{ ~plex }

e.g. sort movie files into HD and non-HD movie folders:

Format: Select all

{ hd =~ /HD/ ? 'Movies HD' : 'Movies SD' }/{ ~plex }

e.g. sort movie files into SD / HD / UHD folders:

Format: Select all

Movies/{ hd ==~ /UHD|QHD/ ? 'UHD' : hd ==~ /FHD|HD/ ? 'HD' : 'SD' }/{ ~plex }

:arrow: Please read [SNIPPET] Guess source media based on resolution, bitrate and file size for more advanced usage examples.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23469
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

How does the {hd} binding work?

Post by rednoah »

FileBot 5.* implements {hd} like so:

Groovy: Select all

if (width > 2560 || height > 1440) return "UHD"
if (width > 1920 || height > 1080) return "QHD"
if (width > 1280 || height > 720) return "FHD"
if (width > 1024 || height > 576) return "HD"
return "SD"

FileBot 4.* implements {hd} like so:

Groovy: Select all

if (width >= 3840 || height >= 2160) return "UHD"
if (width >= 1280 || height >= 720) return "HD"
return "SD"

:arrow: See MediaBindingBean::getVideoDefinitionCategory for implementation details.
:idea: Please read the FAQ and How to Request Help.
Post Reply