Tuesday, April 30, 2024
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 22808  / 3 Years ago, sun, october 17, 2021, 9:47:50

I'd like to generate a M3U playlist for a directory containing mp3 files on my server from the terminal. Since I'd like to ensure that every player will be able to stream those files I'd like to prefix each file entry with the absolute URL to that directory, like this:




http://server.com/dir/file1.mp3
http://server.com/dir/file2.mp3
...


So unfortunately simply doing ls -1 *.mp3 > play.m3u isn't enough. Is there a one-liner to achieve this?


More From » command-line

 Answers
2

I think the following one-liner should work:



for f in *.mp3; do echo "http://..../$f" >> play.m3u; done


[#32548] Monday, October 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brellked

Total Points: 63
Total Questions: 107
Total Answers: 104

Location: Morocco
Member since Fri, May 22, 2020
4 Years ago
;