Skip to content

Instantly share code, notes, and snippets.

@tobybaier
Created May 20, 2013 20:35
Show Gist options
  • Save tobybaier/5615294 to your computer and use it in GitHub Desktop.
Save tobybaier/5615294 to your computer and use it in GitHub Desktop.
when offering MP3s (own material, of course, not pirated stuff) in multiple directories, I use this bash script to show all MP3s of a directory (dir name as first and only parameter to the script call) as an HTML file with HTML5 audio player and download links. Also adds the page to a list of directories.
#!/bin/bash
cd $1
for i in `ls *.mp3`; do echo "<li><audio preload="none" controls="controls"><source src='$i' type='audio/mp3'/></audio> <a href='$i'>download $i</a></li>" >> index.html; done;
cd ..
echo "<li><a href='$1'>$1</a></li><br>" >> index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment