Is there A Way to match multiple items against a csv file?
Posted: 02 Feb 2015, 19:15
I thought I saw something here on the forums last week that would do this.
I have a couple things like this, i'd like to simplify:
{if (file.path.matchAll(/monstervision/))('[MonsterVision]/')}{if (file.path.matchAll(/rifftrax/))('[RiffTrax]/')}{if (file.path.matchAll(/fan.edit|fanedit/))('[FanEdits]/')}}
Instead of doing a file.path.matchALL() 3 separate times. is there a way to loop through all the items i'm looking for and just do it once?
Something like:
file.path.matchALL(/monstervision|rifftrax|fanedit/) {(csv('C:/extras.csv').get($1))}
extras.csv:
monstervision;[Monstervision]/
riffrax;[RiffTrax]/
fanedit;[FanEdit]/
I was thinking something like:
{def map=[(csv('C:/FileBot Settings/Movies/GenreTest.csv'))]; genres.findResults{ map[it] }.sort{ map.values().toList().indexOf(it) }.first()}
But that's not working so well.
I have a couple things like this, i'd like to simplify:
{if (file.path.matchAll(/monstervision/))('[MonsterVision]/')}{if (file.path.matchAll(/rifftrax/))('[RiffTrax]/')}{if (file.path.matchAll(/fan.edit|fanedit/))('[FanEdits]/')}}
Instead of doing a file.path.matchALL() 3 separate times. is there a way to loop through all the items i'm looking for and just do it once?
Something like:
file.path.matchALL(/monstervision|rifftrax|fanedit/) {(csv('C:/extras.csv').get($1))}
extras.csv:
monstervision;[Monstervision]/
riffrax;[RiffTrax]/
fanedit;[FanEdit]/
I was thinking something like:
{def map=[(csv('C:/FileBot Settings/Movies/GenreTest.csv'))]; genres.findResults{ map[it] }.sort{ map.values().toList().indexOf(it) }.first()}
But that's not working so well.