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

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


#!/bin/rc
# Given raw tracks in /tmp/cdtracks and aux/cddb output on stdin,
# rips music to /lib/music/artist/album/

sed 's/ \/ /\n/' $1 | sed 's/^title	//
	s/ /_/g' > /tmp/cleanedup
tail +2 /tmp/cleanedup | awk '/^[1-9]	/{print "0"$1"-"$2} /^[1-9][0-9]	/{print $1"-"$2}'

artist = `{sed 1q /tmp/cleanedup}
album = `{sed 2q /tmp/cleanedup | tail -1}
if (! test -e /lib/music/$artist) {
	mkdir /lib/music/$artist
}
if (! test -e /lib/music/$artist/$album) {
	mkdir /lib/music/$artist/$album
}

tail +2 /tmp/cleanedup | awk '/^[1-9]	/{print "0"$1"-"$2} /^[1-9][0-9]	/{print $1"-"$2}' > /tmp/tracknames
for (j in `{ls /tmp/cdtracks}) {
	songname = `{sed 1q /tmp/tracknames}
	tail +2 /tmp/tracknames > /tmp/foobar
	mv /tmp/foobar /tmp/tracknames
	dd -conv swab < $j | /bin/games/mp3enc -r -b 128 >/lib/music/$artist/$album/$songname.mp3
}

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.