Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Termux:

    pkg install mplayer
    cd /sdcard/Music
    find -type f | shuf | head -1 | xargs mplayer
(Or whatever command-line player you already have installed. I just tested with espeak that audio in Termux works for me out of the box and saw someone else mentioning mplayer as working for them in Termux: https://android.stackexchange.com/a/258228)

- It generates a list of all files in the current directory, one per line

- Shuffles the list

- Takes the top entry

- Gives it to mplayer as an argument/parameter

Repeat the last command to play another random song. For infinite play:

    while true; do !!; done
(Where !! substitutes the last command, so run this after the find...mplayer line)

You can also stick these lines in a shell script, and I seem to remember you can have scripts as icons on your homescreen but I'm not super deep into Termux; it just seemed like a trivial problem to me, as in, small enough that piping like 3 commands does what you want for any size library with no specialised software needed



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: