Splitting flac and ape files in Debian / Ubuntu

I keep forgetting this one, so I’ll keep it here.

What to do when you get a cue file with a single huge flac file, or even worse, an ape file? With the right packages it’s an easy task (getting the packages right may be hard tough).

There are three parts to this problem: getting the ape file to a more user friendly format (flac), splitting it and then renaming the splitted files.

Needed packages

wget http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb && 
   sudo dpkg -i mac-3.99-u4_b3-1_i386.deb && 
   rm -f mac-3.99-u4_b3-1_i386.deb

Source: http://aidanjm.wordpress.com/2007/01/26/using-monkeys-audio-ape-files-in-ubuntu/

Now install cuetools:

  sudo apt-get install cuetools

Splitting the file

  cuebreakpoints *.cue|shnsplit *.ape -o flac

Renaming the splitted parts

In the cue file there should be a list of the original file names. I hacked a script to parse & rename the files from the previous step, you can get it here: cue-rename

For this script to run you’ll need php-cli package. Just run it in the same folder the cue file is, as any other bash script. There’s a flag to get a preview instead of a complete rename; it’s somewhere in the file and I don’t have much plans to clean it up anytime soon. Drop me a line if you do.

Back online!

Ruby: Method chaining

Interesante ūüôā


module MethodDecorator
  # Create a chain between methods:
  #   Rename org_mthd to org_alias and then point it to new_mthd
  # The next time org_mthd is called new_methd will be executed
  def add_chain org_mthd, new_mthd, org_alias
    self.class.class_eval do
      (alias_method org_alias, org_mthd) unless method_defined? org_alias
      alias_method org_mthd, new_mthd

  # Extremly evil code ahead!
  def decorate method, decorator
    # Create a chain counter if it doesn't exist
    @chain_counter ||= 0
    # Use the chain counter as a method id
    i = (@chain_counter += 1)

    # Create a new method which will dispatch the call to both
    # the original and the decorator method
    self.class.class_eval <<-EOM
      def chain_dispatcher#{i} *params
        #{decorator} *params
        chain_original#{i} *params

    # Once the method was created, add chain
    eval "add_chain method, :chain_dispatcher#{i}, :chain_original#{i}"

class Foo
  include MethodDecorator
  def foo; print "Hello "; end
  def bar; print "worldn"; end
  def initialize; decorate :bar, :foo; end


Ahora si, tengo que buscar ya un plugin para código.

Edit: Agregado el plugin para código!


Continuando el post sobre aplicaciones necesarias para un nuevo sistema, un review que escribí hace tiempo sobre Lyx, un frontend para LaTeX:


(Tip: hay una versión para Windows)


Add a CODE tag

apt-get new computer

Siempre me olvido cuales son los paquetes copados para instalar en un nuevo sistema así que voy a copiarlo acá. Después pongo links a cada aplicación.

apt-get install mozilla-thunderbird lyx

# DPOTD cool apps
apt-get install tilda mmv unclutter katapult moc

# DPOTD SA tools
sudo apt-get install knetworkmanager xdiskusage iptraf sshfs apt-listbugs

# Media stuff: flv player, shnsplit/cuebreakpoints (flac), winrar
apt-get install ffmpeg shntool cuetools flac wavpack unrar vlc

# Reading APE files (not recommended, though)
# cuebreakpoints *.cue|shnsplit -o flac *.ape
# http://aidanjm.wordpress.com/2007/02/15/split-lossless-audio-ape-flac-wv-wav-by-cue-file/
# http://aidanjm.wordpress.com/2007/01/26/using-monkeys-audio-ape-files-in-ubuntu/
wget http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb &&
sudo dpkg -i mac-3.99-u4_b3-1_i386.deb &&
rm -f mac-3.99-u4_b3-1_i386.deb

# Conky, sensores y plugins
apt-get install conky libxext-dev lm-sensors build-essential checkinstall wmctrl

# Servers y script dev
apt-get install apache2 php5 mysql5-server rails ruby

# Headers y demas (incluye X11)
apt-get install libc6-dev libstdc++6-4.1-dev g++-4.1 g++ dpkg-dev build-essential x11proto-core-dev linux-libc-dev libxau-dev libxdmcp-dev x11proto-input-dev x11proto-xext-dev x11proto-kb-dev xtrans-dev libx11-dev libxext-dev glibc-doc libgtk2.0-doc manpages-dev

# Headers para php
ant php5-dev ant-optional m4 autoconf autotools-dev automake1.4

# Ecplise con CDT
apt-get install java-common libswt3.2-gtk-jni libswt3.2-gtk-java eclipse-rcp liblucene-java liblucene-java-doc libjsch-java libservlet2.4-java libcommons-el-java java libcommons-collections-java java libcommons-logging-java java libcommons-launcher-java liblog4j1.2-java libregexp-java libbcel-java libmx4j-java libcommons-collections3-java libcommons-beanutils-java libcommons-digester-java libcommons-modeler-java libcommons-pool-java libcommons-dbcp-java libtomcat5.5-java eclipse-platform junit eclipse-jdt eclipse-pde exuberant-ctags eclipse-cdt mlock libc-client2002edebian zlib1g-dev libssl-dev eclipse libtld3 odbcinst1debian1 unixodbc sun-java5-bin


Superado el primer post casi obligatorio, ¬Ņde que se trata todo esto?

Planeo volcar acá todo tipo de locuras que se me ocurran, muchas de las cuales estarán dedicadas a la informática. Prometo mantener al mínimo los meta-posts.

El contenido estar√° mayormente en espa√Īol pero como las estad√≠sticas muestran hits de otros lados (yo tampoco me explico c√≥mo) algunas cosas ir√°n traducidas.

With obliged frist post out of the way, what’s all this about?

I’m planning to dump here all kind of crazy ideas I can think of, many of which will be about computing. I promise to keep meta-posts to a bare minimum.

The content will be mainly in Spanish but as the statistics show hits from some other places (I have no idea why neither) some things will be translated.

Bonus points para quien adivine de donde saqué la imagen.

etc/init.d/blog start

First post!!1