shithub: rc

ref: 1cf04fdaabf1dbfb7fb4ce59a8cd41a2336d8f18
dir: /bin/gibmehrcinap/

View raw version
#!/bin/rc
hget http://felloff.net/usr/cinap_lenrek/music \
	| awk '
BEGIN{
	excl["quality60"] = 1
	excl["quality83"] = 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