shithub: rc

ref: 7c063c346a361bca2e57e26e04e8fb48a05c8c7e
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
	excl["bat2"] = 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