Should I use capture text filter ?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
Matrix1990
Posts: 3
Joined: Fri Nov 09, 2012 3:40 pm

Should I use capture text filter ?

Post 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.....
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Should I use capture text filter ?

Post 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.
Matrix1990
Posts: 3
Joined: Fri Nov 09, 2012 3:40 pm

Re: Should I use capture text filter ?

Post 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.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Should I use capture text filter ?

Post 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.
Matrix1990
Posts: 3
Joined: Fri Nov 09, 2012 3:40 pm

Re: Should I use capture text filter ?

Post by Matrix1990 »

Thanks a lot it worked. :D
Post Reply