Sunday, 22 March 2009

Playlists with MythTV

I've been wanting a way to use playlists on my media center either from within MythTV or with any other player. The reason is I have a bunch of short videos (music and documentaries) that I'd like to be able to play consecutively.

It turns out to be a case of just RTFM. You can create playlists for MPlayer from directory listings, and then associate playlists with a particular mplayer command.

To generate the playlist from all files in a directory, I use the following:

dir * | sed 's/\\//g' > all_videos.pls

The sed part of this command removes the \ from escaped spaces... i.e. a file 'Hello world' is output from the dir command as 'Hello\ world' - the space is escaped. We need to generate a file without these escaped spaces for it to work properly.

I use the following mplayer command associated with the pls extension:
mplayer -shuffle -fs -zoom -quiet -vo xv -playlist %s

Saturday, 21 March 2009

Hey! Where'd my swap go?

I've just noticed that I've got no swap space! (Dell 1525 running Ubuntu 8.10).

I first installed my laptop with Ubuntu 8.04, and later upgraded to 8.10. After the upgrade I noticed that hibernate no longer worked, and I think (from memory) I found an error message saying something about not enough swap space. I briefly thought about trying to find out how to add more swap (I already had a 4G partition defined, and I've only got 2G ram) but then I swiftly moved on to other more pressing issues.

Well, just recently I fired up System Monitor to check on a process, and notice in the bottom right corner it said there was no swap space. Firing up 'top' confirmed this - my system had zero swap!

I could see that I had a swap partition defined:
paul@dell1525:~$ sudo blkid
/dev/sda8: TYPE="swap" UUID="4bd53cb9-611c-4e57-a9df-4754d6bcdd65"

But the corresponding entry in /etc/fstab had a different entry:.
# /dev/sda8
UUID=e6eb6c47-599c-4612-ac8a-287279ee438b none swap sw 0 0

The UUIDs didn't match! Thus no swap. Correcting the fstab file and rebooting resolved the problem, but I don't know what caused it.

Right now, top shows I've got my 4G swap space being used, and hibernate has successfully hibernated and resumed. Perhaps now this laptop will perform better too?

As for adding more swap space, I don't think I need to do that right now - but here is a good article for future reference.

Wednesday, 18 March 2009

Grails Openid plugin and Xerces

I just created a grails 1.1 application, and installed the openid plugin. When starting the application, I got the following exception:

2009-03-17 22:25:41,090 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'consumerManager': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.openid4java.consumer.ConsumerManager]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
at Method)
Caused by: java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
at org.openid4java.discovery.Discovery.(
at org.openid4java.consumer.ConsumerManager.(
... 21 more

I worked around this by dropping xercesImpl-2.6.2.jar in the lib directory of my grails app. This seems to work - I've successfully logged in via my yahoo openid account.

I haven't looked any further into this - time is short already, but I hope this helps you if you stumble across this problem.

Set default browser in Ubuntu

To set the default browser, use update-alternatives as shown below:

paul@dell1525:~$ sudo update-alternatives --config x-www-browser

There are 2 alternatives which provide `x-www-browser'.

Selection Alternative
1 /usr/bin/firefox-3.0
*+ 2 /usr/bin/seamonkey

Press enter to keep the default[*], or type selection number: 1
Using '/usr/bin/firefox-3.0' to provide 'x-www-browser'.

There is a good write-up of the update-alternatives system here.

Tuesday, 17 March 2009

Podcatching solution

I'm getting closer to a podcatching solution with gpodder. Gpodder is a simple and easy to use podcatcher - and importantly, it can be invoked from the command line in a non-interactive mode. This is important because of my internet plan - I get twice as much download quota on off-peak times as I do on on-peak. So, I can shedule a cron job to fire gpodder up at 1am and download the latest podcasts. Great, because I'm not going to consume precious on-peak bandwidth.

Now that I've got the latest podcasts handy, I can listen to them on my media center using Amarok. This isn't the only option, but it works for me because the interface lets me 'group by album' - which is conveniently groups most podcasts - and display those added today/1 week/1 month/...

Amarok also lets me configure Xine to output to SPDIF - important, because my media center is only connected via SPDIF to my surround sound receiver. Without this option, I wouldn't be able to hear anything.

A little frustrating is that gpodder saves all of its files using hashes instead of human readable filenames (it looks like there may be a solution to this in the next release). This doesn't really matter if you use a media player that reads the mp3 tags - as most do, including Amarok - but I've been surprised by several podcasts that have no mp3 tags at all:

paul@dell1525:~$ wget
2009-03-16 21:41:29 (552 KB/s) - `holmes090304.mp3' saved [27288970/27288970]
paul@dell1525:~$ id3ed -i holmes090304.mp3
holmes090304.mp3: (no tag)
paul@dell1525:~$ id3v2 -l holmes090304.mp3
holmes090304.mp3: No ID3 tag

paul@dell1525:~$ wget
2009-03-16 21:44:35 (530 KB/s) - `Waleswikipedia.mp3' saved [19987016/19987016]
paul@dell1525:~$ id3ed -i Waleswikipedia.mp3
Waleswikipedia.mp3: (no tag)
paul@dell1525:~$ id3v2 -l Waleswikipedia.mp3
Waleswikipedia.mp3: No ID3 tag

Compare this to a podcast with mp3 tags:

paul@dell1525:~$ id3v2 -l grails_podcast_episode_63.mp3
id3v2 tag info for Podcasts/Grails Podcast/grails_podcast_episode_63.mp3:
TT2 (Title/songname/content description): Grails Podcast Episode 63: Newscast for August 17, 2008
TP1 (Lead performer(s)/Soloist(s)): Glen Smith & Sven Haiges
TP2 (Band/orchestra/accompaniment): Glen Smith & Sven Haiges
TCM (Composer): Glen Smith & Sven Haiges
TAL (Album/Movie/Show title): Grails Podcast
TYE (Year): 2008
TBP (BPM (beats per minute)): 30720
TCO (Content type): Podcast (255)
COM (Comments): (iTunPGAP)[eng]: 0
TEN (Encoded by): iTunes v7.7.1
COM (Comments): (iTunNORM)[eng]: 000001C2 000001C2 00006F76 00006F76 0009BCA7 0009BCA7 0000786C 0000786C 0008439C 0008439C
COM (Comments): (iTunSMPB)[eng]: 00000000 00000210 00000B34 00000000048F933C 00000000 01A793ED 00000000 00000000 00000000 00000000 00000000 00000000
PIC (Attached picture): ()[JPG, 0]: , 17185 bytes

Another feature of gpodder that I appreciate is synchronization to media device OR filesystem. The filesystem synchronization means you can specify a directory to copy to and the filename format. This suits me well (although this doesn't seem to copy those files without mp3 tags).

Monday, 16 March 2009

Extra Ubuntu Repositories

A friend put me on to this blog post about extra repositories for Ubuntu. This is a great resource which highlights some great (and possibly essential) software that you should know about if you are running Ubuntu (and possibly any linux flavour).

Have a look, you may find some software listed there of interest to you. I didn't know about some of the items listed (eg GNOME Do) so its been a great resource for me.

Getting rid of Root email

I've got a Linux VPS through RimuHosting - I'm no system admin, and the root account gets a pile of email spam. This takes up disk space so I try to regularly delete it. The best way I've found is to us Mutt - a console based email reader.

Firing up Mutt as root displays the thousands of spam mails recieved. Pressing 'D' lets you delete messages that match a pattern. So I can specify the pattern 'a' and that matches almost all of the messages. When quitting the application, it deletes the marked messages.

So, this is a good solution for reading or deleting many emails without downloading them - if you have ssh access.

To avoid having to do this, can anyone tell me how to stop receiving these emails?

Sunday, 15 March 2009

Removing svn files

I recently needed to clean up and remove all of the svn files in a directory structure. I found the answer here, a simple linux command line to recursively delete .svn folders:

find . -name ".svn" -print0 | xargs -0 rm -Rf

Saturday, 14 March 2009

Over typing -Dskip.junit=true

I generally prefer Maven2, but I'm currently on a project using a custom ant build script - and I'm over having to type -Dskip.junit=true when I just want to generate a quick jar without running the tests.

To easily switch off tests, I modified ant.bat so that it looks for a command line parameter 'st' and if found, it will substitute it with -Dskip.junit=true.

In Ant 1.7.0, you just need to change line 68 in block ':setupArgs' from



if ""%1""==""st"" (set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% -Dskip.junit=true) else (set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1)

So, the whole block reads (from line 65):

if ""%1""=="""" goto doneStart
if ""%1""==""-noclasspath"" goto clearclasspath
if ""%1""==""st"" (set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% -Dskip.junit=true) else (set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1)
goto setupArgs

Now, I can just type

ant all st

Wednesday, 11 March 2009

Cannot find a valid baseurl for repo: core

I came across this error while trying to install a package on Fedora 5:

# yum install gd-devel
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
core [1/3]
Cannot find a valid baseurl for repo: core
Error: Cannot find a valid baseurl for repo: core

The solution was relatively simple if obscure - I found it here.

I simply changed the enabled=1 to enabled=0 in:


Do you have that package installed

With yum, you can find out if you have a package installed using the query option. For example if you want to know if 'php-gd' is installed:

# rpm -q php-gd