Convert & Split FLAC files

I had some .flac files that needed to be converted for iTunes, but I couldn’t find a standalone app for OSX, so using my CLI-fu, I managed to do the job.

For reference, this is how I proceeded (you’ll need Homebrew for this).

Install the following packages:

  • cuetools (to print the breakpoints from a cue or toc file)
  • shntool (to split a single-file album image to a file-per-track album)
  • flac (to read .flac file format)
  • ffmpeg (to do the conversion)
  • id3v2 (to read and write id3 tags)
  • mmv (to change the name of files, see below)

mmv is not really needed, but this tool is invaluable, you should use it.

brew install cuetools shntool flac ffmpeg mmv id3v2

First, split the flac file in tracks:

cuebreakpoints album.cue | shnsplit -o flac album.flac

Add the tags to the tracks

cuetag.sh album.cue split-track*.flac

Rename the files (why? because!)

mmv 'split-track??.flac' "Track#1#2.flac"

Concert the .flac files to mp3 VBR

(for FILE in Track*.flac ; do ffmpeg -i "$FILE" -codec:a libmp3lame -qscale:a 1 "`basename "$FILE" .flac`.mp3" || break; done)

You can now import the *.mp3 files in iTunes.

I couldn’t find a way to convert the .flac files to .m4e AND keep the metadata so I used mp3. If anyone knows a way, let me know. I also read that the ffmpeg aac converter wasn’t as good as iTunes, so I don’t think it’s really worth it.

Catégories OSX

Start VPN when waking up

On my Linode server (great company and service BTW), I had setup a VPN for me, but after upgrading to Ubuntu 14.04, I had no time to reinstall it.

So yesterday, I grabbed a free account on NoLimitVPN (because NSA and Google, you know) and I’ve been using it without any problems. (I’m no expert in security, but since NoLimitVPN is managed by a french company and their VPN is hosted on RamNode.com in the Netherlands, I expect a minimum of privacy).

The only problem I had was that the VPN doesn’t connect automatically when my Mac wakes up. DuckDuckGoing (what’s the official or usual verb ?) (because I don’t use Google anymore), I only found AppleScripts running in background and connecting the VPN. Since I don’t want something running in the background on my old and faithful iMac, I looked for alternatives.

This is the solution I’ve set up on my Mac:

To start the VPN (named « VPN », duh), I use a terminal command

scutil --nc start VPN

Instead of this AppleScript (found on StackOverflow)

    
tell application "System Events"
    tell current location of network preferences
        set myConnection to the service "VPN"
        if myConnection is not null then
            if current configuration of myConnection is not connected then
                connect myConnection
            end if
        end if
    end tell
    return 120
end tell

To start the VPN when waking up, I use SleepWatcher (a tool I use to pause ArqBackup when my Mac wakes up) and I put this line in my ~/.wakeup file:

scutil --nc start VPN > /dev/null 2>&1

Voila, problem solved.

Catégories OSX

Rotate backup disks with SuperDuper

If, like me, you’re paranoid with your data, you surely have 2 backups of your data, one being off-site.

My backup strategy is as follow: I backup my desktop machine on 2 external disks with SuperDuper. I keep one backup disk off-site and the other one near my machine so I can backup at regular interval.

Lire la suite…

Catégories OSX

TimeMachine: it’s alive, alive!

When I bought my iMac, I did a restore from my MacBook TimeMachine backup. When I continued working on my current project, I did notice a difference between the files that were on my MacBook and the files on my iMac. The files restored from the backup were not up-to-date and were from a few days ago.

I tried this snippet on MacOSXHints to compare Time Machine backups to the original drive, and it found differences between the original disk and the backup.

Lire la suite…