2011-11-20

google-musicmanager -p

Thankfully I did not have to face this situation again with google music manger's reluctance remembering the password when using 2-step authentication as a (supposedly) nice guy wrote about the -p command line option here. Simply have it followed by an application password and you're good to go.
Let's hope it'll be just a short while till Google fixes music manager to support 2-step properly...

Backup into the (T-)Cloud

For a while now the Deutsche Telekom has been offering 25GB of online storage free of charge. The service is branded Mediencenter or T-Cloud. While the web interface seems mostly targeted towards photo, video and music use, it also works as a plain network drive accessible through secure WebDAV.

One use I found for this space is to do off-site backups using duplicity.
Not very sophisticated yet but it principally works like this:
#!/bin/sh export PASSPHRASE="this_is_not_my_data_encryption_key" export FTP_PASSWORD="the_tonline_email_password" duplicity -vn --include /home/guesswho/important_stuff --include /home/guesswho/more_important_stuff --exclude / / webdavs://<myaccount>@t-online.de@webdav.mediencenter.t-online.de/backup/

In case you get errors like this from duplicity
GPGError: GPG Failed, see log below: ===== Begin GnuPG log ===== gpg: problem with the agent: Bad CA certificate ===== End GnuPG log =====
try killall gnome-keyring-daemon. Some resource clash along the lines of gpg going on there.

Update:
After encountering some problems with the built-in webdav support of duplicity when doing incremental backups, I changed it towards davfs2 for mounting the cloud space to a local directory and running duplicity against that by replacing the webdavs:// url with file:///home/guesswho/mnt/tcloud/backup/.

This also renders the need to kill gnome-keyring-daemon moot.

There is one caveat though, which is you need to add the statement use_locks 0 to the config file (eg. /home/guesswho/.davfs2/davfs2.conf).

Recording and archiving streaming radio

First store the stream to disk, which in case of an http stream can be done like this

$ mplayer -dumpaudio http://whatever/streaming.url

That should result in a file stream.dump, which in this case luckily comes directly in mp3 format

$ file /tmp/stream.dump
/tmp/stream.dump: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo

Since we're talking live recording here, we'll (hopefully) have provided for some buffer minutes at the beginning and at the end of the file which we need to get rid of now. So fire up the audacity sound editor (in case you're doing this on Fedora Linux make sure to install audacity-freeworld from rpmfusion over the regular audacity package which lacks mp3 support) and find the cue points. Of course you can also trim the stream and save it to a new file right there, but that would mean re-encoding. Not much of an issue but still it would be nicer to preserve the original stream.

So just note the cue points in audacity and head back to the commandline, this time we'll be using a tool by the name mpgtx from a package of the same name.

$ mpgtx -s /tmp/stream.dump [5:47-57:38] -o myrecording.mp3

Easy to tell, the actual program started 5 minutes 47 seconds into the stream, and went on until 57 minutes and 38 minutes. Whole-second precision is usually sufficient, but decimal seconds are also supported.

Finally, we'll want to tag our new file. I like to use eyeD3 (package name python-eyed3) for that:

$ eyeD3 -a "The artist" -t "The title" -G <genre> -Y <year> --add-image=/tmp/artist_pic.jpg:ARTIST: myrecording.mp3

To learn about the possible <genre>s, run "eyeD3 -l"; to see supported image types invoke as "eyeD3 --list-image-types". The term image type may be a bit confusing in this context, we're not talking JPEG vs. PNG but what is depicted (in the example it would be a picture of the performer).