For those who simply can't wait for the Music app to come to Ubuntu Touch, I made a short bash script that randomly shuffles songs in ~/Music and plays them while you use the phone.

The script is triggered "on" by turning the volume to max (slide down from the top over the speaker icon, then slide the slider to the far right). If the volume is at less than max, songs will no longer be played until you turn it back up to max.

Here is the script:

while [ 1 ]
        export vol=$(amixer | head -n5 | grep "Mono: Playback" | cut -c 18,19)
        if [ $vol = 10 ] && [ ! -f /tmp/music-is-playing ]
                touch /tmp/music-is-playing
                while [ $vol = 10 ]
                        mplayer /home/phablet/Music/$(ls /home/phablet/Music/ | rl -c 1)
                        export vol=$(amixer | head -n5 | grep "Mono: Playback" | cut -c 18,19)
                rm /tmp/music-is-playing

Here is how to install it (assuming you already have Ubuntu Touch installed on your phone):

  1. Make sure adb is installed if it isn't already.
  2. Plug your phone into your computer via USB.
  3. Run the commands (in order) "adb root", then "adb shell".
  4. You should now be adb'ed into your phone. Run the command "ubuntu_chroot shell".
  5. Execute the command "su - phablet", then "sudo -i" (password "phablet") to get root.
  6. Install ssh with "apt-get install openssh-server". Run "exit" to exit the device after that finishes.
  7. Connect via SSH over USB by running "adb forward tcp:8888# tcp:22", then "ssh phablet@localhost -p 8888".
  8. Get root again with "sudo -i".
  9. Install the dependencies with "apt-get install mplayer randomize-lines wget".
    Note: This may not be all of them; contact me if you have more to add.
  10. Connect to wifi from the phone if you haven't already.
  11. Put the script in place with "wget -O /usr/bin/".
  12. Run the command "chmod +x /usr/bin/" to make it executable.
  13. Now, add your songs to ~/Music. You can do this in a number of ways, but I'll do it through scp:
    1. Close your terminal and open a new local terminal.
    2. Run "scp '-P 8888' /path/to/your/music/files/* phablet@localhost:/home/phablet/Music/" as many times as necessary.
    3. Repeat step 7 again to get back into your phone.
  14. Run the command "", then press "Ctrl-Z", then run the command "disown" to start shuffling!

Feel free to detach your phone once it's installed and running. Remember: turn it on by turning the volume up to max, and turn it off by turning the volume up to less than max.