November 15, 2013

Custom spotify playlists

The problem with spotify and iTunes etc is that there's really no good support for playlists. With playlists I mean importing say csv lists. Why would i need a list like this? Because, every now and then I'd like to just create a simple playlist containing the Artis Name and track number as ARTIST,TRACK repeat.

That's where ivyishere comes in, cool online tool that can export your csv, amongst other, playlists to spotify. Thanks.

How do I get a csv playlist, in this case I found the work of another House MD fan who did spend the time to organize all tracks from all shows on a website. I'd like that playlist without hving to add every single song by hand.

This i what I did.

1. copy the neatly ordered html table using you mouse, from top till bottom, selecting all the songs you like in your playlist.

2. open libreoffice calc and paste the songs there, select the html formatted table and wait.

3. Delete the rows you dont need, keeping only artist and track.

4. Copy the artist and track coloumns paste in a new document, then save this document as csv.

5. Fire up your shell and perl the shit outta a the csv.

cat housemd.playlist.csv  # to see what you have to deal with

Figure out the reguar expressions you'll need, yes you can most likely find a more combined expression than I did, nevertheless my way worked ;)


perl -p -e "s/^,$//g" # Remove the lines containing just ,
perl -p -e "s/^\s$//g" # remove lines containing just whitespaces
perl -p -e "s/^'No.*,$//g" # remove th elines containing the No Commer ... text
perl -p -e "s/\"|\'//g" # remove the ' and " from all artists and songs

The final experssion for me was:

perl -p -e "s/^,$//g" housemd.playlist.csv | perl -p -e "s/^'No.*,$//g" | perl -p -e "s/^\s$//g" | perl -p -e "s/\"|\'//g" > housemd.playlist.2.csv

6. Cat your file to see if it is what you'd expect

7. Upload you file to ivyishere and wait.

Thanks perl and ivyishere.


No comments: