The environment shouldn’t be, part 2…
2009-10-13 / 12:30 / dave
…in which all I want to do is read and write some goddamn ID3 tags.
I’ve said I want to learn Haskell but I’ve also talked about the pains of learning new programming environments (and given an example from Forth). So when I wanted to rename some mp3 files based on ID3 tags I thought “that’s a great excuse to use Haskell! What could possibly go wrong?” So I simply…
- install the Haskell Platform
- check Hackage for ID3 libraries
cabal install taglib. FAIL: requires taglib_c C library- download the Windows MSVC binary and copy to correct dirs under
c:\cygwin\usr\local\ - update environmental variables according to the Cabal help pages. FAIL: still can’t find package
- use
cabal install --verbose=3 taglibto find out it’s failing callingpkg-config - remove MSVC binary of taglib_c
- try building taglib_c from SVN tip. FAIL: no
configure - try IDiii:
cabal install idiii. FAIL: error installingencoding-0.6.2dependency - back to TagLib: download tarball & install. Success.
- add
PKG_CONFIG_PATH='c:\cygwin\usr\local\lib\pkgconfig'to environment cabal install taglib. FAIL: the.pcfiles for taglib contain cygwin style paths- rebuild taglib_c with
--PREFIX=c:/cygwin/usr/local. Success: installed in same directory but with Windows style paths in the.pcfiles cabal install taglib. Success!- run TagLib’s included test code (nice touch, btw). FAIL: can’t find DLL
- try renaming DLL’s & rerunning test. FAIL: finds DLL’s, can’t link. Suspect this is because GHC is built with MinGW
- uninstall source-built taglib
- install taglib’s MinGW binaries, including copying & modifying source built
.pcfiles cabal install --verbose=3 --reinstall taglib- re-run test code. FAIL: can’t link because of duplicate symbols in
bytestring. WTF? - test in
ghci. FAIL: can’t find DLL - rename DLL’s… FAIL: can’t link to DLL
- uninstall MinGW taglib
- try MSVC taglib once more for fun. FAIL: can’t find/link to DLL’s
So I’ve got no ID3 library a broken GHC installation. Next stop: mailing list. But first…
Let’s try that in Python
I wish I could say it was sooo much easier in Python, because that would mean I was done. Instead…
- check PyPI for ID3
pip install -v PyID3. FAIL: can’t resolve URL’s- follow URL from PyPI. FAIL: Django error
- skip pyid3tag because of external dependencies
pip install id3reader. Success!
A few dozen lines of code and a few Unicode issues later and I am automatically renaming files based on ID3 tag.
Unfortunately the next step is automatically tagging files based on filename and id3reader doesn’t write tags. This is why people write their own libraries.
So what’s the point
Nothing really. I just wanted to complain. Also people often ask me what it’s like to be a programmer. Sometimes, this is it. My advice: stay in business school.
