Add part of file path with bracket

All about user-defined episode / movie / file name format expressions
Post Reply
andcbii
Posts: 5
Joined: 04 Apr 2025, 18:33

Add part of file path with bracket

Post by andcbii »

I use StreamFab to get my downloads. StreamFab organizes downloads by provider. The download folder looks like:

Streamfab
-Provider1
--Show
---Season
----file1
-Provider2
--Show
---Season
----file2

I'd like to use this to tab where episodes came from. I'm trying to use brackets {. but I'm having issues. The without brackets this is working:

Code: Select all

{drive}V:\TV\TMDB-Order\30-Stream Rip\{ny}\{'Season '+s00}\{ny} - {s00e00.lower()} - {t} - {f[-4]}
When I try to add brackets it breaks the part at the end.

Code: Select all

{drive}V:\TV\TMDB-Order\30-Stream Rip\{ny}\{'Season '+s00}\{ny} - {s00e00.lower()} - {t} - {"{$f[-4]}"}
Returns the whole file path plus [-4]

How can i get the -4 part to work to just return the part of the path that I'm looking for? Or is there another way to do this?
User avatar
rednoah
The Source
Posts: 24009
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add part of file path with bracket

Post by rednoah »

e.g.

Groovy: Select all

{ ' {' + f[-4] + '}' }
e.g.

Groovy: Select all

{ " {${f[-4]}}" }
e.g.

Groovy: Select all

{ " {$f.dir.dir.dir.name}" }


Alternatively, you could match for text:

Groovy: Select all

{ ' {' + folder.path.match(/Provider1|Provider2/) + '}' }


:!: Unrelated to any of the above, this makes no sense:

Format: Select all

{drive}V:\
You either start your format with {drive}/ if you want to paste the drive letter of the file at hand, or with V:/ regardless of the file at hand, but not both. A file path cannot start with two drive letters.

Format: Select all

{drive}/Media/{plex}

Format: Select all

V:/Media/{plex}
:idea: Please read the FAQ and How to Request Help.
andcbii
Posts: 5
Joined: 04 Apr 2025, 18:33

Re: Add part of file path with bracket

Post by andcbii »

Thanks for the quick reply and seeing another issue I wasn't even asking about (so focused on the end of file I didn't catch that error). I used option 2.
Post Reply