[SNIPPET] Sort into A-Z folders
Posted: 31 Aug 2013, 08:01
Here's some formats that can help you sort movies or episodes into alphabetically sorted folders by the first letter of the movie collection or series name.
Sort Movies and TV Shows into A-Z folders:
e.g. The built-in {az} binding works for both Movie and Episode objects:
e.g. Use the {az} binding to sort files into custom letter ranges, e.g. A-F, G-Q, R-Z and # for numbers and symbols:
Note that{az} is based on the movie {collection} and not necessarily on the movie name. {n[0]} will give you the first letter of the movie name.
e.g. O/Oz Collection/The Wizard of Oz
e.g. T/The Wizard of Oz
e.g. W/The Wizard of Oz
You can use Conditional Structures (if-then-else) to generate different file paths for different movies.
e.g. Use A-Z folders for movie names that start with A-Z and 0-9 for everything else:
Sort Movies and TV Shows into A-Z folders:
- F/Firefly/Season 1/Firefly - S01E01 - The Train Job
- S/Serenity (2005)/Serenity (2005)
e.g. The built-in {az} binding works for both Movie and Episode objects:
Format: Select all
{ az }/{ plex.tail }
e.g. Use the {az} binding to sort files into custom letter ranges, e.g. A-F, G-Q, R-Z and # for numbers and symbols:
Format: Select all
{
switch(az) {
case 'A'..'F': return 'A-F'
case 'G'..'Q': return 'G-Q'
case 'R'..'Z': return 'R-Z'
default: return '#'
}
}

e.g. O/Oz Collection/The Wizard of Oz
Format: Select all
{ az }/{ collection }/{ n }
Format: Select all
{ n[0] }/{ n }
Format: Select all
{ n.sortName()[0] }/{ n }

e.g. Use A-Z folders for movie names that start with A-Z and 0-9 for everything else:
Format: Select all
{ n.sortName() =~ /^(?i)[a-z]/ ? n.sortName()[0] : '0-9' }/{ plex.name }