Tunebox Song Batch Delete

If anyone’s using Tunebox for IOS and is frustrated that you can’t delete unwanted songs directly (the app blocks this by policy to prevent any bug or tampering from directly affecting your Dropbox) here’s a handy one-liner to take the playlist file it generates in the root Dropbox folder.

N/B: This must be run from Dropbox root folder.  It assumes a single playlist is present (else you’ll need to adjust the JSON parsing) and it will REMOVE EVERY SONG found within.  As always, exercise caution with this or any other script which essentially does a foreach() rm.

> head -5 .Tunebox.Playlists.mp3 | json_pp | grep '"/' | sed 's/^         "\//"/g' | sed 's/",$/"/' | sed 's/""$//' | xargs ls -alF

-rwxr-xr-x@ 1 chrimann  staff   5655957 Mar 19  2011 music/daft punk/daft punk - tron legacy/nokia ovi/sunrise prelude (nokia ovi store bonus track).mp3*
-rwxr-xr-x  1 chrimann  staff  10097265 Mar 19  2011 music/daft punk/daft punk - tron legacy/remixes/derezzed remix (nteibint remix).mp3*
-rwxr-xr-x  1 chrimann  staff  15818280 Mar 19  2011 music/daft punk/daft punk - tron legacy/remixes/end of line remix (basic slack midnight cheap mix).mp3*
-rwxr-xr-x  1 chrimann  staff  10854191 Apr 27  2010 music/music2/hybrid discogrpahy/hybrid - remix & additional production/04_hybrid_moby_bodyrock.mp3*
-rwxr-xr-x  1 chrimann  staff   6429663 Apr 27  2010 music/music2/hybrid discogrpahy/hybrid - soundsystem 01 (2008) (mp3-eac-320kbs)/disc 1/01 - hybrid - harry gregson-williams - 'desert chase'.mp3*
-rwxr-xr-x  1 chrimann  staff   2350370 Apr 27  2010 music/music2/hybrid discogrpahy/hybrid - soundsystem 01 (2008) (mp3-eac-320kbs)/disc 1/02 - hybrid - trentemøller & buda - 'gamma'.mp3*
-rwxr-xr-x  1 chrimann  staff   3891598 Apr 27  2010 music/music2/hybrid discogrpahy/hybrid - soundsystem 01 (2008) (mp3-eac-320kbs)/disc 1/03 - hybrid - massive attack - 'sweet is good'.mp3*

> head -5 .Tunebox.Playlists.mp3 | json_pp | grep '"/' | sed 's/^         "\//"/g' | sed 's/",$/"/' | sed 's/""$//' | xargs -n 1 rm

And before you say anything, I know that you can sed ‘\s+’ instead of ‘      ‘.  For some reason this wasn’t working (under zsh) and I don’t have time to debug.  This is just quick ‘n dirty.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s