Using a csv file for lists

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
ChefGregS
Posts: 102
Joined: 30 Mar 2016, 11:14

Using a csv file for lists

Post by ChefGregS »

Red, you helped me long ago set up the code to read a file and make changes to movie ratings. The code is:

Code: Select all

{any{csv('S:/replacecert1.csv').get(certification)}{certification}{"NR"} }
Inside that file I have this list:

UNRATED;NR
Not Rated;NR
NOT RATED;NR
APPROVED;NR
N A;NR
N R;NR
;NR

And it works perfectly every time.

I now need one for subs. I'll start with my list (this is my test list):

SDH.eng;eng-SDH
[Forced].nor;nor-Forced
Danish [Forced].dan;dan-Forced

And this is the code I was trying:

Code: Select all

{any{csv('S:/replacesubt1.csv').get(subt)}{subt}{""}}
I have tried with and without the {""}} at the end and currently, it doesn't matter either way.

When the movie folder contains subs and one of them is a sub with Danish [Forced].dan as part of one of the sub files names it simply has .dan as the language instead of dan-Forced

What I see under the Movie Format is: Pattern not found: 3D: Danish [Forced].dan

Is this because it isn't reading the file correctly? Did I not call the file correctly?

I hope that makes sense.. I am trying to have a list with a crap ton of subs listed. I keep finding that people label these files with all sorts of variations of what it should be so I will have a list of many many changes.

Thanks as always for any help....

Greg
User avatar
rednoah
The Source
Posts: 23459
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Using a csv file for lists

Post by rednoah »

{subt} will never return [Forced].nor so a lookup won't work here.

You'll have to do a "if file name ends with" check for each line in the CSV file.

Since {subt} already mostly works, you can probably get away with just matching the "forced" bit from the file name:

Format: Select all

{ '-' + fn.match(/forced/) }
:idea: Please read the FAQ and How to Request Help.
Post Reply