addfile ./.boring hunk ./.boring 1 +# Boring file regexps: +\.hi$ +\.hi-boot$ +\.o-boot$ +\.o$ +\.o\.cmd$ +# *.ko files aren't boring by default because they might +# be Korean translations rather than kernel modules. +# \.ko$ +\.ko\.cmd$ +\.mod\.c$ +(^|/)\.tmp_versions($|/) +(^|/)CVS($|/) +\.cvsignore$ +^\.# +(^|/)RCS($|/) +,v$ +(^|/)\.svn($|/) +(^|/)\.hg($|/) +\.bzr$ +(^|/)SCCS($|/) +~$ +(^|/)_darcs($|/) +\.bak$ +\.BAK$ +\.orig$ +\.rej$ +(^|/)vssver\.scc$ +\.swp$ +(^|/)MT($|/) +(^|/)\{arch\}($|/) +(^|/).arch-ids($|/) +(^|/), +\.prof$ +(^|/)\.DS_Store$ +(^|/)BitKeeper($|/) +(^|/)ChangeSet($|/) +\.py[co]$ +\.elc$ +\.class$ +\# +(^|/)Thumbs\.db$ +(^|/)autom4te\.cache($|/) +(^|/)config\.(log|status)$ +^\.depend$ +(^|/)(tags|TAGS)$ +#(^|/)\.[^/] +(^|/|\.)core$ +\.(obj|a|exe|so|lo|la)$ +^\.darcs-temp-mail$ +-darcs-backup[[:digit:]]+$ +\.(fas|fasl|sparcf|x86f)$ +\.part$ +(^|/)\.waf-[[:digit:].]+-[[:digit:]]+($|/) +(^|/)\.lock-wscript$ +^\.darcs-temp-mail$ + +^transmit-my-tune$ addfile ./Makefile hunk ./Makefile 1 +transmit-my-tune: transmit-my-tune.hs + ghc --make $@ -O3 -Wall + +install: transmit-my-tune + install $< $(HOME)/bin/ + +.PHONY: install addfile ./transmit-my-tune.hs hunk ./transmit-my-tune.hs 1 +import Data.Maybe +import HSH +import System.Console.HCL +import System.FilePath.Glob + + +main :: IO () +main = do wav <- findWav + artist <- getArtist + putStrLn artist + + +findWav :: IO FilePath +findWav = do putStrLn "Looking for wav files..." + files <- namesMatching "*.wav" + case files of + [] -> do files' <- namesMatching "Audio/*.wav" + case files' of + [] -> error "No wav files are here." + _ -> askWhich files' + [wav] -> do putStrLn ("Ok, I found " ++ wav) + return wav + _ -> askWhich files + where + askWhich :: [FilePath] -> IO FilePath + askWhich = fmap fromJust . runRequest . mkReq + + mkReq :: [FilePath] -> Request FilePath + mkReq = prompt "Which wav file do you want to transmit?" . mkMenu + where + mkMenu = reqMenu . map mkItem + mkItem file = (file, makeReq file) + + +getArtist :: IO String +getArtist = fmap fromJust $ + runRequest $ + prompt "What artist name should be tagged? [default: PHO] " $ + reqDefault reqResp "PHO" changepref boringfile .boring