0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

NetBSDでshuffle,shuffle

Last updated at Posted at 2025-07-17

mp3をランダムに再生してみたいと思いました。

Linuxにはshufというコマンドがあるようですが、NetBSDにはshuffleというコマンドがあります。FreeBSDにはなくてNetBSD固有のものぽいです。

このコマンドはデフォルトでは引数をランダムにするのですが、-fオプションで-を指定すると標準入力をランダムにします。

以前作ったスクリプトをいじってmpg123に食わせてるplaylistを作るcgiを用意してみました。

#!/bin/sh

echo "Content-type: text/html
"

LIST=`find ../mp3/${QUERY_STRING} -name *.mp3 | shuffle -f - | sed 's/^.../http:\/\/'${SERVER_NAME}'\//'`

echo "${LIST}"

mpg123のランダム再生の機能でもできるかもしれません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?