Is it possible to lookup a CSV for parts of the filename.
At the moment my code is pretty long to include all the possible movie editions, versions and cuts.
What I would like to do is move all this out to a CSV file.
example.csv
Director cut;Directors cut
Directors cut;Directors cut
Director's cut;Directors cut
dir cut;Directors cut
Special Edition;Special Edition
Extended;Extended Edition
etc...
Lookup parts of the filename in CSV
Re: Lookup parts of the filename in CSV
I've seen a few of the examples, but the problem is that it looks for a complete match, I just wanna do a partial one.
My script:
{y =~ "2014|2015" ? "\\\\DS3612\\Volume 1\\Video\\Filmer\\" : "\\\\DS3612\\Volume 2\\Filmer\\"}\{n.replaceAll(/[\\/?<>:|]/, "").replaceAll(/[*\s]+/, " ").replaceAll(/[`´‘’ʻ""“”]/, "'")} ({y}) [{imdbid} {(csv('editions.csv').get(fn.lower().replaceAll(/[._]/," ")) ?: "") + " "}{"$source "}{vf} {vc} {af} {ac}{" $group"}]
Filename:
Aliens.Special.Edition.1986.720p.BrRip.x264.YIFY.mp4
editions.csv:
special edition;SPECIAL EDITION
As you can see it wont match since its looking for "aliens special edition 1986 720p brrip x264 yify" in the CSV file
My script:
{y =~ "2014|2015" ? "\\\\DS3612\\Volume 1\\Video\\Filmer\\" : "\\\\DS3612\\Volume 2\\Filmer\\"}\{n.replaceAll(/[\\/?<>:|]/, "").replaceAll(/[*\s]+/, " ").replaceAll(/[`´‘’ʻ""“”]/, "'")} ({y}) [{imdbid} {(csv('editions.csv').get(fn.lower().replaceAll(/[._]/," ")) ?: "") + " "}{"$source "}{vf} {vc} {af} {ac}{" $group"}]
Filename:
Aliens.Special.Edition.1986.720p.BrRip.x264.YIFY.mp4
editions.csv:
special edition;SPECIAL EDITION
As you can see it wont match since its looking for "aliens special edition 1986 720p brrip x264 yify" in the CSV file
Re: Lookup parts of the filename in CSV
1.
Why don't you just use the {tags} binding?
2.
csv() will give you a Map. Instead of just using Map.get() you can do lots of other things if you need slightly more complicated logic and conditions.
e.g.
Why don't you just use the {tags} binding?
2.
csv() will give you a Map. Instead of just using Map.get() you can do lots of other things if you need slightly more complicated logic and conditions.
e.g.
Code: Select all
{['regex':'TAG'].findResult{ k, v -> if (fn =~ k) v}}
Re: Lookup parts of the filename in CSV
Thanks for you help, got it working by using:
{csv('editions.csv').findResults{ k, v -> if (fn.lower().replaceAll(/[._]/," ") =~ k) v}.unique().join(' ')}
{tags} gave me a undefined error when the filename didnt have tags in them.
A also wanted to pick up strange versions like for example X-Men: Days of Future Past The Rogue Cut
{csv('editions.csv').findResults{ k, v -> if (fn.lower().replaceAll(/[._]/," ") =~ k) v}.unique().join(' ')}
{tags} gave me a undefined error when the filename didnt have tags in them.
A also wanted to pick up strange versions like for example X-Men: Days of Future Past The Rogue Cut
Re: Lookup parts of the filename in CSV
I can add patterns for {tags} for the next release if you can give me your list. 

Re: Lookup parts of the filename in CSV
Only one I seen a few of is "dir cut" which you dont have on your list. The rest is one off for each movie which would be impossible to maintain.