GSSMP goes beta

I’ve just released version 0.9 of GSSMP, and since I’ve fixed all the bugs I know about (except working around a gstreamer bug, which I will try to do before 1.0), I’ve marked this release as beta.

This is the second project I’ve marked as beta, and I am determined I am going to get to 1.0 this time. That means no more features, just bug fixes, and hopefully a 1.0 release in a few weeks, when it’s had a bit of testing.

Really, I think FreeGuide should have had a 1.0 release a couple of years ago, but I’ve always had a lot of features in mind before I feel it is complete. I think this was a mistake: it was pretty stable at one point, and it might have been helpful to label it as such.

GSSMP is not going to fall into that trap! It’s supposed to be minimal, and that is what it is.

It’s surprising how many features would be nice to have in a minimal app, though, like being a drag and drop target and checking the MIME types of files before playing them, not to mention cool stuff like gapless playback and volumne balancing…

But no, these will have to come after 1.0. My focus needs to go back onto FreeGuide after GSSMP 1.0, as I’ve been neglecting it, and it needs some love if it’s ever going to get to 0.11 … and 0.12 … and so on for infinity … and then after that, 1.0.

Recording in FreeGuide

If you download the nightly builds of FreeGuide, you can try out the new recording functionality.

There is quite a bit to do before this is ready for release. There are several bugs in the TODO list and you have to create your own scripts at the moment to launch mplayer or whichever recording software you want to use.

When the release happens, we will incude scripts that are useful for common TV cards (actually, it’s beginning to look like mplayer will handle all this for us, so all we need is one script) and make it easy to set up, with a default setup that should work for most people out of the box. Or that’s the idea.

The good news is that Alex appears to be back and working on fixing the bugs, so the ever-receding horizon of the next release is somewhat less receding.

I’ve not quite managed to get it to actually record something yet, (mainly due to mplayer being extremely awkward) but it shoud work…

My daily backup

I recently recovered my files from my daily backup, which had actually worked!

(Pop quiz: this is how I deleted half my home dir – what is wrong with this Makefile?

TMP_DIR=/tmp/gssmp

blah: blah1
    blah

...

blah7:
    ...
    rm -rf $TMPDIR/

...

)

Anyway, I am extremely grateful that the backup did work, but a slight problem was that I have been backing up absolutely everything, and never deleting anything that was backed up until I ran out of disk space.

So when I restored from backup, every file I had ever deleted (since I started backing up) re-appeared. This included files and dirs (and email) that had just been moved somewhere else – I now had 2 copies of them.

I’ve spent the night deleting stuff that I didn’t actually want restored, and this has encouraged me to create an improved backup script that puts deleted stuff into a separate folder, named after the day it was deleted. I can delete those folders at my leisure when they get too big, but when a disaster happens like it did on Wednesday, I can restore back to a sane state by just ignoring any irrelevant deleted folders.

It’s quite simple, but I hadn’t thought of it before, so it might be helpful to others. Enjoy:

#!/bin/bash

# Copy this to /etc/cron.daily and make it owned by root, and executable

# Back up everything important from my main drive (hda) to the backup
# drive (hdb).

# Keep stuff that has been deleted from the real drive in a separate
# backup dir, named after the day it was deleted.

BKP_DRIVE=/media/hdb1

FLAGS="-a --delete-during --max-delete 100 --backup"

DT=`date +%F`
DELETED_DIR=deleted-$DT

function run_rsync
{
    THIS_DIR=$1
    EXCLUDES=$2

    echo rsync $FLAGS --backup-dir=$BKP_DRIVE/$DELETED_DIR$THIS_DIR \
        $EXCLUDES $THIS_DIR/ $BKP_DRIVE$THIS_DIR/
    rsync $FLAGS --backup-dir=$BKP_DRIVE/$DELETED_DIR$THIS_DIR \
        $EXCLUDES $THIS_DIR/ $BKP_DRIVE$THIS_DIR/
}

run_rsync /home/andy \
    "--exclude /iRiver --exclude /downloads --exclude /.Trash --exclude /misc/qemu"

run_rsync /etc

run_rsync /var

run_rsync /boot

Creating .deb and RPM packages

Since I’ve managed to get it to work for GSSMP, I thought I might share how I am generating .deb and RPM packages using a Makefile. These make it much easier for Ubuntu and Fedora Linux users (respectively) to install the program. It should also be helpful for people using Debian, who can try the .deb, and other RPM-based distros, who can try the RPM.

This project is all autotooled-up, so this may not be very helpful if you don’t use autotools.

(Side tip: I don’t understand autotools at all, but since I created the project with glade, it did all the hard work for me.)

I created these files for the Ubuntu .deb package:

changelog:

gssmp (0.8-0ubuntu1) edgy; urgency=low

  * First release packaged for ubuntu

 -- Andy Balaam <myemailaddress>  Thu, 15 Feb 2007 12:33:11 +0000

copyright:

This package was debianized by Andy Balaam <myemailaddress> on
Thu, 15 Feb 2007 12:33:11 +0000.

It was downloaded from
http://sourceforge.net/project/showfiles.php?group_id=187144&package_id=219138

Copyright Holder: Andy Balaam <myemailaddress>

License:
   This package is free software; you can redistribute it and/or modify
   blah blah blah GPL boilerplate

control:

Source: gssmp
Section: sound
Priority: optional
Maintainer: Andy Balaam <myemailaddress>
Build-Depends: debhelper (>= 4.0.0), autotools-dev, libgstreamer0.10-dev, libgnomeui-dev
Standards-Version: 3.6.2

Package: gssmp
Architecture: any
Depends: libgstreamer0.10-0, libgnomeui-0
Description: Gnome Simple Stateful Music Player
 GSSMP is a music player designed to work with Gnome.  It does not store a
 database of all your music, but is designed to work with music files organised
 into directories.  It is small, unobtrusive, and tries to do what you would
 expect, instead of asking you questions.
 .
 It remembers which file was playing on exit, and continues that file from the
 same place when you start again.  It remembers tracks you have been listening
 to recently and displays them in the "Recent" menu.

I put those three files in my source tree under install/deb/.

For the RPM, I just needed one file, gssmp.spec:

###
### RPM spec file for Gnome Simple Stateful Music Player
###
### Adapted from jEdit's spec file http://www.jedit.org
###
Summary: A music player that doesn't interfere.
Name: gssmp
Provides: gssmp
Version: 0.8
Release: 1
License: GPL
Group: Applications/Multimedia/
Source0: %{name}-%{version}.tar.bz2
URL: http://gssmp.sourceforge.net/
Vendor: Andy Balaam <myemailaddress>
Packager: Andy Balaam <myemailaddress>
BuildArch: i386
BuildRoot: %{_builddir}/%{name}-root
Requires: libgnomeui, gstreamer
BuildRequires: libgnomeui-devel, gstreamer-devel

%description
GSSMP is a music player designed to work with Gnome.  It does not store a
database of all your music, but is designed to work with music files organised
into directories.  It is small, unobtrusive, and tries to do what you would
expect, instead of asking you questions.

It remembers which file was playing on exit, and continues that file from the
same place when you start again.  It remembers tracks you have been listening
to recently and displays them in the "Recent" menu.

%prep
%setup -n %{name}-%{version}

%build
./configure --prefix=/usr
make

%install
make DESTDIR=%{buildroot} install

%clean
rm -rf %{buildroot}

%files
/usr/bin/gssmp
/usr/share/doc/gssmp/AUTHORS
/usr/share/doc/gssmp/COPYING
/usr/share/doc/gssmp/INSTALL
/usr/share/doc/gssmp/NEWS
/usr/share/doc/gssmp/README
/usr/share/doc/gssmp/TODO

which I put in install/rpm

Then I modified my Makefile.am to build the deb and RPM when I told it to:

APP_NAME=gssmp

# Create a deb package
pkg-deb: pkg-src
        - rm -r $(TMP_DIR)
        mkdir -p $(TMP_DIR)
        cp pkg/$(APP_NAME)-$(VERSION).tar.bz2 $(TMP_DIR)/
        tar --directory $(TMP_DIR)/ \
                -xjf $(TMP_DIR)/$(APP_NAME)-$(VERSION).tar.bz2
        cd $(TMP_DIR)/$(APP_NAME)-$(VERSION)/; \
                echo | dh_make --single --copyright gpl -e myemailaddress -f \
                        ../$(APP_NAME)-$(VERSION).tar.bz2
        cp install/deb/changelog install/deb/control \
                install/deb/copyright $(TMP_DIR)/$(APP_NAME)-$(VERSION)/debian/
        cd $(TMP_DIR)/$(APP_NAME)-$(VERSION)/; \
                rm debian/README.Debian debian/*.ex debian/*.EX; \
                ./configure; \
                dpkg-buildpackage -rfakeroot; \
                mv ../*.deb $(PWD)/pkg/
        rm -r $(TMP_DIR);

# Create an RPM package
pkg-rpm: pkg-src
        mkdir -p $(HOME)/.rpm/RPMS/i386
        mkdir -p $(HOME)/.rpm/SRPMS
        mkdir -p $(HOME)/.rpm/BUILD
        mkdir -p $(HOME)/.rpm/SOURCES
        mkdir -p $(HOME)/.rpm/tmp
        - rm -r $(HOME)/.rpm/BUILD/$(APP_NAME)-root
        - rm -r $(HOME)/.rpm/RPMS/$(APP_NAME)-*
        - rm -r $(HOME)/.rpm/SRPMS/$(APP_NAME)-*
        - rm -r $(HOME)/.rpm/SOURCES/$(APP_NAME)-*
        cp pkg/$(APP_NAME)-$(VERSION).tar.bz2 $(HOME)/.rpm/SOURCES/
        rpmbuild --quiet --nodeps --define="_topdir $(HOME)/.rpm" \
            -ba install/rpm/gssmp.spec
        mv $(HOME)/.rpm/RPMS/i386/$(APP_NAME)-$(VERSION)-*.i386.rpm pkg/

Now I just needed to run ./autogen.sh to regenerate my Makefile, and then make pkg-deb or make pkg-rpm and the deb or RPM appears magically in the pkg/ directory.

Autotools, for all its faults, does make this stuff relatively easy. All the code for installing in different places (installing at all) and general flexibility is done for you. Of course, it’s at the expense of ever understanding what’s going on, but you can’t have everything.

Now I just need to make a man page … and fix all the bugs … oh, and make an icon … and make it accept a filename on the command line … and sort out MIME types … etc … so it should be finished really soon.