Need help with an example with folder file differences

Any questions? Need some help?
Post Reply
8i6juyhrggvf
Posts: 14
Joined: 19 Mar 2023, 02:21

Need help with an example with folder file differences

Post by 8i6juyhrggvf »

I have a bunch of files that when I use {source} it shows WEB, which is totally correct, but in the folder name its actually AMZN.WEBRip is there a way to properly get this from the original folder to use in place of {source} in the new file name? I've tried some regex's against {f} to see if it existed but had no luck being able to override {source} if the folder name had the correct source but the original file name did not.

Thank you!

edit forgot to mention I am currently using the GUI.
8i6juyhrggvf
Posts: 14
Joined: 19 Mar 2023, 02:21

Re: Need help with an example with folder file differences

Post by 8i6juyhrggvf »

Guess I did not get deep enough in the docs. This is at least working for my current scenario. I am going to leave in and see how it behaves in my usual processing.

Code: Select all

(source == 'WEB' ? (f.path.match(/WEBRip|WEBDL|WEB-DL/)) ?: "{${source}}" : "{${source}}")
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with an example with folder file differences

Post by rednoah »

8i6juyhrggvf wrote: 18 Jul 2023, 23:29 I have a bunch of files that when I use {source} it shows WEB, which is totally correct, but in the folder name its actually AMZN.WEBRip is there a way to properly get this from the original folder to use in place of {source} in the new file name?
Please always include the complete file path. We need it for testing. Please read How to Request Help.
:idea: Please read the FAQ and How to Request Help.
8i6juyhrggvf
Posts: 14
Joined: 19 Mar 2023, 02:21

Re: Need help with an example with folder file differences

Post by 8i6juyhrggvf »

Code: Select all

Criminal.Minds.S12.1080p.AMZN.WEBRip.DD5.1.x264/Criminal.Minds.S12E11.1080p.WEB.H264.mkv
Criminal.Minds.S12.1080p.AMZN.WEBRip.DD5.1.x264/Criminal.Minds.S12E09.1080p.WEB.H264.mkv
Apologies, these were the original folder and file names.

My full crazy setup right now is

Code: Select all

/NewDir/
{ny.removeAll(/[!?.]+$|:/).replaceAll(/[`´''?]/, "'").replace('&', 'and').replaceTrailingBrackets().ascii()} 
({y}) 
{ ' {tvdb-' + { id } + '}' } 
{ ' {tmdb-' + tmdbid + '}' } 
{ ' {imdb-' + { imdbid } + '}' }/
{regular ? 'Season ' + s.pad(2) : 'Specials'}/
{ny.removeAll(/[!?.]+$|:/).replaceAll(/[`´''?]/, "'").replace('&', 'and').replaceTrailingBrackets().ascii()} 
({y}) - 
{s00e00} - 
{t.removeAll(/[!?.]+$|;|:|"|>/).replaceAll(/[`´'']/, "'").replace('&', 'and').replaceTrailingBrackets().ascii()} 
{ " -{edition-${tags[0]}}" } -
{' {tvdb-' + { id } + '}' } -
{' {tmdb-' + tmdbid + '}' } -
{' {imdb-' + { imdbid } + '}' } 
{"- {${airdate}}"} 
{vf ? "- {${vf}}" : ''}
{ '-[' + (
  (source == 'WEB' ? "{${f.path.find(/(?:ABC|ATVP|AMZN|BBC|CBS|CC|CR|CW|DCU|DSNP|DSNY|FBWatch|FREE|FOX|HMAX|HULU|iP|LIFE|MTV|NBC|NICK|NF|RED|TF1|STZ)[.-](?:WEBRip|WEBDL|WEB-DL)/) ?: source}}" : "{${source}}") +
  (hd ? "-{${hd}}" : '') + 
  (vcf ? "-{${vcf}}" : '') + 
  (vc && !vc.contains('AVC') ? "-{${vc}}" : '') + 
  (aco ? "-{${aco}}" : '') + 
  (acf ? "-{${acf}}" : '') + 
  (any{"-{${hdr}}"}{'-{SDR}'}) + 
  (audioLanguages ? "-{${audioLanguages.join(",")}}" : '')
) + ']' }
which has gotten me in the GUI to this using TVDB, that seems to still be working as needed. I am sure the above is very messy/sloppy still just guessing my way through with groovy

Code: Select all

/NewDir/Criminal Minds (2005) {tvdb-75710} {tmdb-4057} {imdb-tt0452046}/Season 12/Criminal Minds (2005) - S12E09 - Profiling 202 - {tvdb-75710} - {tmdb-4057} - {imdb-tt0452046} - {2017-01-04} - {1080p}-[{AMZN.WEBRip}-{FHD}-{AVC}-{Dolby Digital Plus}-{DDP5.1}-{SDR}-{eng}].mkv
/NewDir/Criminal Minds (2005) {tvdb-75710} {tmdb-4057} {imdb-tt0452046}/Season 12/Criminal Minds (2005) - S12E12 - A Good Husband - {tvdb-75710} - {tmdb-4057} - {imdb-tt0452046} - {2017-02-08} - {1080p}-[{AMZN.WEBRip}-{FHD}-{AVC}-{Dolby Digital Plus}-{DDP5.1}-{SDR}-{eng}].mkv
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with an example with folder file differences

Post by rednoah »

8i6juyhrggvf wrote: 19 Jul 2023, 06:41

Code: Select all

Criminal.Minds.S12.1080p.AMZN.WEBRip.DD5.1.x264/Criminal.Minds.S12E11.1080p.WEB.H264.mkv
Criminal.Minds.S12.1080p.AMZN.WEBRip.DD5.1.x264/Criminal.Minds.S12E09.1080p.WEB.H264.mkv
Cheers. FileBot r9893 and above will not prefer longer pattern matches when matching values for the {vc} and {source} bindings.
:idea: Please read the FAQ and How to Request Help.
8i6juyhrggvf
Posts: 14
Joined: 19 Mar 2023, 02:21

Re: Need help with an example with folder file differences

Post by 8i6juyhrggvf »

rednoah wrote: 19 Jul 2023, 09:32
8i6juyhrggvf wrote: 19 Jul 2023, 06:41

Code: Select all

Criminal.Minds.S12.1080p.AMZN.WEBRip.DD5.1.x264/Criminal.Minds.S12E11.1080p.WEB.H264.mkv
Criminal.Minds.S12.1080p.AMZN.WEBRip.DD5.1.x264/Criminal.Minds.S12E09.1080p.WEB.H264.mkv
Cheers. FileBot r9893 and above will not prefer longer pattern matches when matching values for the {vc} and {source} bindings.
Does that mean source and vc going forward will always prefer WEB over WEBRip? Not sure I get what you mean, thanks!
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with an example with folder file differences

Post by rednoah »

I mistyped "now" as "not"... I meant to say that "AMZN.WEBRip" (11 chars) is now preferred over "WEB" (3 chars) based on String length.
:idea: Please read the FAQ and How to Request Help.
Post Reply