Example Script [Not working]: convert to RadioTracker TM A1wish list

Started by Stefan, June 05, 2010, 01:20:09 AM

Previous topic - Next topic

Stefan

Example Script [Not working]: convert to RadioTrackerTM A1wish list

I have an list of 50 party songs, like:
Anton feat. D.J. Ötzi - Anton aus Tirol
Safri Duo - Played-A-Live
Dolls United - Eine Insel mit zwei Bergen

I use RadioTrackerTM (RT) to record internet radio.
Here i can create, load and save an list of wished songs.
This list is in an special XML format.

To use my list i can manually add each of the 50 songs to RT and save that then as an RT XML,
or i can use HippoEDIT to convert my "plain" list to an RT-XML to easily load this... guess what i chose :D

First i had saved already such an list with RT to get an template.
Then i use this template to convert my list to an RT XML:

------------------------------------------------
1.) open the plain list in HippoEDIT:

Result:
Anton feat. D.J. Ötzi - Anton aus Tirol
Safri Duo - Played-A-Live
Dolls United - Eine Insel mit zwei Bergen




------------------------------------------------
2.) do an RegEx search and replace:

Find what: ^(.+) - (.+)$
Replace with: <Wish>\n    <Artist>$1</Artist>\n    <Track>$2</Track>\n  </Wish>

(you may want to use Search Favorites to store this for later re-use)

Here i just select and copy the parts from the template:
<Wish>
   <Artist>

into the "Replace with" box.
HippoEDIT recognizes the line break and the space and do the right things.
Then i add an "$1" sign, then i pasted the next part
</Artist>
   <Track>

into the "Replace with" box, followed by an "$2",... and so on, you got the idea?


Use [Find] and [Replace] for first test, and if all went fine use [Replace All]

Result:
<Wish>
   <Artist>Anton feat. D.J. Ötzi</Artist>
   <Track>Anton aus Tirol</Track>
 </Wish>
<Wish>
   <Artist>Safri Duo</Artist>
   <Track>Played-A-Live</Track>
 </Wish>
<Wish>
   <Artist>Dolls United</Artist>
   <Track>Eine Insel mit zwei Bergen</Track>
 </Wish>



------------------------------------------------
3.) Add the end tag to the button:
</Exported_Wishes>

Result:
<Wish>
   <Artist>Anton feat. D.J. Ötzi</Artist>
   <Track>Anton aus Tirol</Track>
 </Wish>
<Wish>
   <Artist>Safri Duo</Artist>
   <Track>Played-A-Live</Track>
 </Wish>
<Wish>
   <Artist>Dolls United</Artist>
   <Track>Eine Insel mit zwei Bergen</Track>
 </Wish>
</Exported_Wishes>



------------------------------------------------
4.) Jump to top/first line:
Ctrl+Pos1

And add starting lines at the top:
<?xml version="1.0" encoding="UTF-16"?>
<Exported_Wishes version="1.0" name="#####" createdby="radiotracker" contenttype="artist">


Result:
<?xml version="1.0" encoding="UTF-16"?>
<Exported_Wishes version="1.0" name="#####" createdby="radiotracker" contenttype="artist">
<Wish>
   <Artist>Anton feat. D.J. Ötzi</Artist>
   <Track>Anton aus Tirol</Track>
 </Wish>
<Wish>
   <Artist>Safri Duo</Artist>
   <Track>Played-A-Live</Track>
 </Wish>
<Wish>
   <Artist>Dolls United</Artist>
   <Track>Eine Insel mit zwei Bergen</Track>
 </Wish>
</Exported_Wishes>



------------------------------------------------
5.) Replace "#####" by, e.g. "50ApresSkiHits", or with an script, prompt the user to add an description.

Result:
<?xml version="1.0" encoding="UTF-16"?>
<Exported_Wishes version="1.0" name="50ApresSkiHits" createdby="radiotracker" contenttype="artist">
<Wish>
   <Artist>Anton feat. D.J. Ötzi</Artist>
   <Track>Anton aus Tirol</Track>
 </Wish>
<Wish>
   <Artist>Safri Duo</Artist>
   <Track>Played-A-Live</Track>
 </Wish>
<Wish>
   <Artist>Dolls United</Artist>
   <Track>Eine Insel mit zwei Bergen</Track>
 </Wish>
</Exported_Wishes>




That are 5 easy steps, but we can create an script to do this all in one step.... (soon  ;D )
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-