Get info either from Filename or Foldername or Both?

All about user-defined episode / movie format expressions
Post Reply
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Get info either from Filename or Foldername or Both?

Post by DevXen »

So My movies some have the info in the filename, and some in the foldername and some have the info in both.
how would I pull movie from the foldername, if it's not there pull it from the filename. but not pull it twice if it's in both?

I know: {folder.name} {fn.contains('x')} to access them. but if i use them both it'll pull the info twice, when the info is both in the filename and the foldername.

Example:
1. Thor (3D HSBS)\Thor.mkv
2. Thor\Thor (3D HSBS) (HSBS).mkv
3. Thor (3D HSBS)\Thor (3D HSBS).mkv

I would want to add (3D) and (HSBS) to the renamed file. in each of these cases, but I don't want it added twice in the last example.
User avatar
rednoah
The Source
Posts: 19011
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get info either from Filename or Foldername or Both?

Post by rednoah »

I'd just pull it from the whole path:

Code: Select all

{file.path.match(/3D.HSBS/)}
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Re: Get info either from Filename or Foldername or Both?

Post by DevXen »

Perfect, i did'nt know there was a file.path.match, i'll mess with that and see if I can get it working. thank you.
Post Reply