#!/bin/bash sort='sort -u' shit_filter='shit[@]' good_filter='none[@]' while getopts "Rnlwga" opt do case "$opt" in R) sort='sort -uR';; # play albums in random order (instead of newest first) n) unset sort;; # play only newest albums (i.e. the slush pile) l) fidelity=lofi;; # play lofi (not hifi) w) action=wget;; # download (not play) album g) good_filter='good[@]';; a) shit_filter='none[@]';; '?') exit 1;; esac done shift $((${OPTIND:-1}-1)) none=(cat) shit=(grep -vEx -e 'magnacomp-.+' # "Mix Tape" albums, original tracks are elsewhere. -e braid-soundtrack # original tracks are elsewhere. -e '.*inst' # Instrumental (i.e. voice track muted) -e '.*mixter(one|twocd[12])' # Remixes, I guess? # Bands I just don't like the sound of. -e acosmo-inbetween -e alexlisenkov-fashionthemes -e allmeadowcostlow-reunion -e allmeadowcostlow-switchon -e almqvist-goldberg # boring Bach -e cbooth-bachgold # Bach -e amccartney-mesangeau # boring harpsichord -e andygabrys-constant -e annussek-palaces # uninspired altrock -e arodriguez-somewherenew # uninspired altrock -e anonymph-terrarium -e askold-askold # bland jazz -e beyond7-revelations -e breaker-tmiwtmigi # instrumental remix -e robin-silent # instrumental -e cavalcade-failure -e cbritton-counterpoint -e chadlawson-chopinone -e chadlawson-chopintwo -e dbp-wtc.. # Bach -e dgilden-ancestral ## This guy is so eclectic, I can't justify blacklisting all of it. # -e francoiscouture -e '(alienet|aligntime|amoeba|andrewjohn|andromeda|angelight|arphaus|atek|atomic|attictrax)-.+' -e '(bachplay|barkscrock|barryjames|barrysulkin|bcsd|berget|birdy|bmeuwsen|bois|bots|boulevard)-.+' -e '(candidate|capitalsons|careyclayton|carilive|cbooth|ccasanova|chambure|charlieb|chill|chinaski|chiwawa|chrisfield|ckgem|ckovach|cobbbussinger|cod|colfax|commusicare|crummarks|curl)-.+' -e '(damseldown|daugustin|dbautista|deepwinter|dinohaak|diometrix|djcary|dle|doublethink|doughamer|dpkaufman|dpreston|drkuch|drsounds|durand)-.+' -e '(ecarpediem|edwards|eelectra|ehodgkinson|ejp|emavision|emmalee|ernststolz|eschnack|estrem|etherine|evgenybardyuzha|ezivian)-.+' -e '(fallingyou|farallon|fatherofsam|federicomoscogiuri|fielding|figueroaohlsen|filles|fitch|flurries|fourstones|franca|fud|fuzz|fwheel)-.+' -e '(greatmook|glimmer)-.+' -e '(harlan|harris|heavymellow|hectormukomol|heifervescent|heirtomadness|heringman|hferre|hopalmer|horstreich|hube|humanresponse|hurdy|hybris)-.+' -e '(icicle|idlemine|ilic|immune|indchoice|indidginus|ingridmatthews|intersonicsub|introspekt|ion|ishwish|ithomas|ivilion)-.+' -e '(jamesakers|FIXME)-.+' -e innovat-tradcarols -e harham-allhayle # the vocalists are all Tim Curry style -e thestroj-metafonik -e sssm-raptor # far too green-dayish ) good=(grep -Ex -e '(almernirvan|amarchand|ammonite|amycanbe|anamar|anonymous|antiqcool|arival)-.+' -e '(bbunkertrio|beight|bellhours|block|brusch)-.+' -e '(connorbfitz)-.+' -e '(daria|debenedictis|delko|dixiecannon|donnistrio|dtc)-.+' -e '(ehren|elecfrank|erickamen|erik|ewallace)-.+' -e '(fickle|fleagle|fogelberg)-.+' -e '(gcawthorn|genco|gianmarcoleone|glynch|gom|gopal|greatalexander|gregwilliams|gzimmerman)-.+' -e '(hadidan|hazelmain|homelessballoon|hopkins|hwye)-.+' -e '(inserra)-.+' # hanghang! -e '(jackalopes|jackman|jag|jambedaem)-.+' -e '(kiwi)-.+' -e '(wcr)-.+' -e headroom-apa -e heifervescent-murderinthe -e heifervescent-verbalbandit -e hollywoodrunks-.+ # ambivalent about this one -e beatunder-intro -e cthuotte-caughtsummers -e cthuotte-sunblind -e dbautista-eurotrip -e domased-analog # Upstream mislabelled "Dr. Kuch" as "Domased". -e francoiscouture-mylittlebook -e francoiscouture-quallunak -e mikegoudreau-twentyyears ) albums=$( # Sometimes albums land in new/ before albums/, so always get new/. curl -sSf http://magnatune.com/artists/new/ http://magnatune.com/artists/albums/ | egrep -o /artists/albums/[^/\"\']+ | sed s:.*/:: | ${sort-uniq} | #sed '1,/^janover-/d' | # DEBUGGING # Filter out some utterly unlistenable albums. "${!shit_filter}" | "${!good_filter}" | # Filter by any keywords (ORed together) on the command line. ${@+grep} "${@-cat}" | ${sort-uniq} ) for album in $albums do tput setaf 2 2>/dev/null || : echo ============================================================ echo $album echo ============================================================ tput sgr0 2>/dev/null || : url=http://magnatune.com/artists/albums/$album/${fidelity-hifi}.m3u case $action in wget) curl -sSf "$url" | grep -v ^# | wget -i- -P "${album//-//}" -nv -nc;; *) mpg123 -C@ "$url";; #*) mpg123 --shuffle --skip $((2**11)) -C@ $url;; # DEBUGGING esac done