shithub: rc

ref: 05158bda287766580ed5e8e3416d0046678c7d3b
dir: /bin/gibmehrcinap/

View raw version
#!/bin/rc
hget http://felloff.net/usr/cinap_lenrek/music \
	| awk '
BEGIN{
	excl["quality60"] = 1
	excl["quality83"] = 1
	excl["r32"] = 1
}
/mp3/{
	sub(".*<a href=\"","")
	sub("\">.*\.mp3</a>","")
	s = $1
	sub("\.mp3$", "")
	if($0 in excl){
		h["excl" $1] = s
		next
	}
	if($1 ~ /[^0-9][0-9]+$/)
		sub("[0-9]+$", "")
	d[$1] = d[$1] " " h[$1]
	h[$1] = s
}END{
	for(i in h){
		if(d[i] != " "){
			split(d[i], a)
			for(j in a){
				if(system("test -f " a[j]) == 0){
					print a[j] >"/fd/2"
					system("rm " a[j])
				}
			}
		}
		if(system("test -f " h[i]) != 0)
			print "http://felloff.net/usr/cinap_lenrek/music/" h[i]
	}
}
' >list
cat list
{<list xargs -n 256 dw} && rm list