Moving movies/shows to seperate folders based on language

All about user-defined episode / movie / file name format expressions
Post Reply
skystormer
Posts: 6
Joined: 18 Jun 2023, 07:44

Moving movies/shows to seperate folders based on language

Post by skystormer »

Not sure if possible, but am not that well versed into setting custom formats. And was happy in what I achieved.
However now I wanna push it :)

Currently I use for movies:

Format: Select all

D:/Movies/hindi/{N} ({Y}) {{"{imdb-$imdbid}"}}/{N} ({Y}){{"{imdb-$imdbid}"}}{ '.' + lang.ISO2 }
The lack of a space missing in the actual file name between year and IMDB tag is intentional. (when no IMDB tag was found, it would just give an extra space in the filename)
Each time I do a different language, I change the languagefolder manually. (here that would be "hindi")
All my files are currently stored in 2 big folders.(1 for movies, 1 for shows)
And they all have the same kind of set up. Foldername is:
[AUDIOLANGUAGE] Movie/tvshow name
Example: [HINDI] Rajkumar (1964)/Rajkumar (1964).mkv

Is it possible for filebot to recognize [HINDI] as the folder I want the file to move to?
Would become:
/hindi/Rajkumar (1964)/Rajkumar (1964).mkv
Otherwise would it be possible to use imdb data to get the move structure based on audio according to IMDB? (Have to check what I will do with dubs, and a lot audio is not set correctly to the right language.)
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Moving movies/shows to seperate folders based on language

Post by rednoah »

e.g. check for [HINDI] marker in the file path:

Format: Select all

{ f.path.contains('[HINDI]') ? 'Hindi' : 'English' }

e.g. check TMDB Original Movie Language:

Format: Select all

{ language =~ /hin/ ? 'Hindi' : 'English' }
:idea: Please read the FAQ and How to Request Help.
skystormer
Posts: 6
Joined: 18 Jun 2023, 07:44

Re: Moving movies/shows to seperate folders based on language

Post by skystormer »

rednoah wrote: 02 Feb 2024, 08:39 e.g. check for [HINDI] marker in the file path:

Format: Select all

{ f.path.contains('[HINDI]') ? 'Hindi' : 'English' }

e.g. check TMDB Original Movie Language:

Format: Select all

{ language =~ /hin/ ? 'Hindi' : 'English' }
Thx for this.

Format: Select all

{ f.path.contains('[JAPANESE]') ? 'japanese' : f.path.contains('[HINDI]') ? 'hindi' : 'english' }
As of course I do not have 1 language set. And probably gonna want to extend this 1 to about 40 languages. Hope Filebot allows that many :)
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Moving movies/shows to seperate folders based on language

Post by rednoah »

You could do something like this to match any [...] from the folder name:

Code: Select all

{ folder.name.match(/\[(\w+)\]/).upperInitial().lowerTrail() }
:idea: /\[(\w+)\]/ matches the HINDI from "[HINDI] Rajkumar (1964)/Rajkumar (1964).mkv" and .upperInitial().lowerTrail() transforms HINDI to Hindi.
:idea: Please read the FAQ and How to Request Help.
skystormer
Posts: 6
Joined: 18 Jun 2023, 07:44

Re: Moving movies/shows to seperate folders based on language

Post by skystormer »

This did the trick.
Was going for all lower.

Changed it to:

Format: Select all

{ folder.name.match(/\[(\w+)\]/).lower () }/
Thank you for the support.
skystormer
Posts: 6
Joined: 18 Jun 2023, 07:44

Re: Moving movies/shows to seperate folders based on language

Post by skystormer »

And here I though I had it all figured out.

Foreign movies no issues found.
And tried to apply the same trick to foreign tv shows.

Tried:

Format: Select all

H:/foreigntv1/{ folder.name.match(/\[(\w+)\]/).lower () }/{N} ({Y}) {{"{imdb-$imdbid}"}}/{'Season '+s}/{N} ({Y})  - {s00E00}{ '.' + lang.ISO2 }
Folder is currently in a folder named: H:\foreigntv1\[BENGALI] Sampurna (2022)
However as the show has /season 1 also folder.name.match does not pick it up (tried putting the files from a season folder to the show folder, and then it did work)

What am I missing?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Moving movies/shows to seperate folders based on language

Post by rednoah »

Use f.path to match the first [...] pattern from the entire file path:

Format: Select all

{ f.path.match(/\[(\w+)\]/).lower () }/
:idea: Please read the FAQ and How to Request Help.
Post Reply