Delete songs from HDD while listening to them on audacious

I digitalized my old CD music collection a (very) long time ago. And the other day ,listening to it, I stumbled over some tracks I did really not like. I used to simply ignore them (unless I was willing to stand up and press the next track on my Hi-Fi), but the time has come to... delete them!

In this post I want to share a small script that can be bound to any key combination on your keyboard. When a song comes up that you don't like, simply invoke it and it will not only move the current song to the trash (you don't want to listen to it forever, right?) but also delete it from Audaciou's playlist.

You need to install:
  • Audacious, which comes with audtool, a small tool to control the player from the command line.
  • Trash: a command line utility to delete to trash (instead of permanently deleting as with rm).
So, let's install everything:

    $ sudo pacman -S audacious trash-cli

Once everything is installed, create the following script and give it execution permissions.

    $ sudo nano /usr/bin/
    [copy text below]
    $sudo chmod +x  /usr/bin/
    #Delete song currently playing on audacious and send it to trash

    SONG="$(audtool current-song-filename)"
    touch "$SONG"
    trash "$SONG"
    POSITION=$(audtool --playlist-position)
    audtool --playlist-advance
    audtool --playlist-delete $POSITION

Now, whenever you are listening to a song you don't like, you only have to write audacious-delete on the terminal. But this is inconvenient. Better ad a key-combination shortcut to your desktop environemt so you have a "panic" key-combination on your keboard (mine is CTRL+SHIFT+F12).

No comments :

Post a Comment