Plan 9 from Bell Labs’s /usr/web/sources/contrib/john/cdripper

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# Sit and watch the CD-ROM drive and rip any audio CDs that are
# inserted. Depends on having cdprep in the path.
# Usage: cdripper [bitrate]

if (! ~ $#* 1) {
	echo usage: cdripper bitrate
	exit usage
}

if (ps | grep cdfs) {
	echo 'Detected cdfs, killing and restarting'
	slay cdfs | rc
}

cdfs

if (! test -e "/tmp/cdtracks") {
	mkdir /tmp/cdtracks
}

haveripped = 0

while (~ 1 1) {
	if (! ~ `{ls /mnt/cd | wc | awk '{print $1}'} 1) {
		if (~ $haveripped 0) {
			cp /mnt/cd/ctl /tmp/cdinfo
			for (i in `{ls /mnt/cd/a*}) {
				cp $i /tmp/cdtracks/
			}
			sed 1q /tmp/cdinfo | rc > /tmp/cddbinfo
			cdprep $1 /tmp/cddbinfo
		}
		haveripped = 1
	}
	if (~ `{ls /mnt/cd | wc | awk '{print $1}'} 1) {
		haveripped = 0	
	}
	sleep 5
}
g1

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.