Page 1 of 1

Should I use capture text filter ?

Posted: Fri Nov 09, 2012 4:29 pm
by Matrix1990
Hi everyone,

I tried to look into the forum but can't figure out how to do it.

>>>>>>>>>>
I have a text file with URL's like below:

https://spideroak.com/share/Party/Black ... 8DJ%29.mp3
https://spideroak.com/share/Party/Bomba ... 8DJ%29.mp3
https://spideroak.com/share/Party/Fatbo ... 8DJ%29.mp3
https://spideroak.com/share/Party/Flo%2 ... 8DJ%29.mp3
https://spideroak.com/share/Party/Imeld ... 8DJ%29.mp3
https://spideroak.com/share/Party/T-Pai ... 8DJ%29.mp3


I want to pick this lines one by one and create new text file with following pattern:

<track>
<location>URL</location>
<creator></creator>
<title>WRITE SONG TITLE HERE</title>
<annotation></annotation>
</track>

For Example:
<track>
<location>https://spideroak.com/share/Party/Flo%2 ... 8DJ%29.mp3</location>
<creator></creator>
<title>Flo Rida - Low(DJ).mp3</title>
<annotation></annotation>
</track>
<track>
<location>https://spideroak.com/share/Party/T-Pai ... 8DJ%29.mp3</location>
<creator></creator>
<title>T-Pain - Church(DJ).mp3</title>
<annotation></annotation>
</track>

I am familiar with Extract Line Matching, Perl Pattern, Merge to file, Restrict to attribute and couple of others simple filters.
I can't figure out how to deal with this thing.

Just help me out with the filters to be used and their sequence and I will try to solve this thing.

Their are around 420 URLs in the file. If I can automate this thing It would save me lot of time & energy.
Please help me out.

Thanks in advance.....

Re: Should I use capture text filter ?

Posted: Mon Nov 12, 2012 8:39 am
by DataMystic Support
Easy, use a perl regex search/replace, search for:

Code: Select all

^https://spideroak.com/share/Party/([^/]*)\.mp3$
Replace with:

Code: Select all

<track>
<location>$0</location>
<creator></creator>
<title>$1</title>
<annotation></annotation>
</track>

If need be, you can also post-process the filename to remove the escaped characters - let me know if you want this too.

Re: Should I use capture text filter ?

Posted: Wed Nov 14, 2012 7:22 pm
by Matrix1990
Thanks a lot man. It worked like charm. Thank you.

I thought i gotta use 4-5 filters. Ha Ha. You did it in one filter.

Yes I do want to get rid of the escape characters.

Please help me with that.

Re: Should I use capture text filter ?

Posted: Thu Nov 15, 2012 6:20 am
by DataMystic Support
Ok, to remove escaped characters, add a new EasyPattern search replace:

Code: Select all

<title>[ capture(1+ not '<' )]</title>
Instead of entering a replace text, set the Action field to 'Send variable 1 to subfilter'.

Then, add a Filters\Convert\HTTP\HTTP Decode as a SUBFILTER, so it acts on the restricted text.

Re: Should I use capture text filter ?

Posted: Fri Nov 16, 2012 12:44 am
by Matrix1990
Thanks a lot it worked. :D