Bembel-B Blog

2008/03/30

My 12th very own custom Rockbox build for Sansa e200

Just another patched Rockbox based on this evening’s SVN Revision 16892. The svn commit r16817 fixes loading the OF, which prevents the system freeze I got when plugging in USB in OF using my previous patched bootloader build! Album Art maximum dimensions are now again restricted to the display width. I don’t think anything else important has changed since my last build.SanDisk Sansa e200

Updated Patches

  • multifont-20080322a.patch
  • albumart-smooth_resize-080325.patch

Removed Patches

  • viewports-wps-v3.diff (viewports-wps-v4.1.diff got committed into svn)

Download

Patch Log

FS#4733 – Multifont
patch -p0 < /home/scheff/downloads/multifont-20080322a.patch

FS#8308 – Port of a imlib2 based smooth scaling algorithm for bitmaps
patch -p1 < /home/scheff/downloads/smooth_resize.patch

FS#5697 – bmp resize patch
patch -p0 < /home/scheff/downloads/albumart-smooth_resize-080325.patch

FS#8523 – Disable WPS updating when the backlight is off.
patch -p0 < /home/scheff/downloads/wps-2.patch

FS#7661 – Make ID3 info screen more readable
patch -p0 < /home/scheff/downloads/expand_id3_screen_line_width.patch
**
Hunk #3 FAILED at 1224.
1 out of 3 hunks FAILED — saving rejects to file apps/screens.c.rej
** no-brainer fix (function parameters changed)

FS#7542 – This patch moves all the playlist creation from the root dir to the PLAYLISTS directory.
patch -p0 < /home/scheff/downloads/playlist_folder.patch

FS#7565 – support for the TPA tag
patch -p1 < /home/scheff/downloads/50-id3TPA.patch

FS#6800 – Sansa e200 backlight behaviour
patch -p0 < /home/scheff/downloads/backlight-thread-fading_r16180M-080128.patch

FS#4988 – Optionally keep backlight on while plugins are running
patch -p0 < /home/scheff/downloads/plugin-backlight_070303.patch
**
Hunk #1 FAILED at 390.
1 out of 1 hunk FAILED — saving rejects to file apps/settings.h.rej
** no-brainer fix

FS#6884 – Sansa E200 m3u/m3u8 to pla playlist converter
patch -p0 < /home/scheff/downloads/sansa_playlist_converter_V3.3.diff
**
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED — saving rejects to file apps/plugins/CATEGORIES.rej
** no-brainer fix

FS#8070 – Sansa battery_bench plugin buffer overflow
patch -p0 < /home/scheff/downloads/sansa_batt_bench.patch

FS#8363 – Charger configuration for Sansa e200/c200
patch -p0 < /home/scheff/downloads/charge_e200_16657.diff

FS#8642 – Improve boot time on Sansa
patch -p0 < /home/scheff/downloads/bootloader_boost.patch

ChangeLog

[2009-04-26: Fix box.net links.]

2008/03/26

Neo Diggler Actions I Find Useful

Neo Diggler is a Firefox Add-on that lets you define and run actions based on your current URL, like jumping to parent folders. It’s the successor of Diggler compatible with newer browser versions. It’s a very useful Add-on, I’d say. I’ll provide some actions I hacked together over the time. I guess there’s be much room for improvement, but they are indeed working real nice for me.Firefox 2

Reload the current page from CoralCDN.

Name: CoralCDN
Matching Regular Expression: ^http://(.+)$
Show Action as Menu Entry: no
Action: http://$h.nyud.net$p

Opens the BugMeNot entries for the current domain in another window. Doesn’t work in Windows.

Name: BugMeNot
Matching Regular Expression: ^(.+)$
Show Action as Menu Entry: no
Action: javascript:window.open("http://www.bugmenot.com/view/$h", "$h"); javascript:window.reload();

Loads the current page with an www subdomain (http://some.example.com/foobar.php becomes http://www.example.com/foobar.php).

Name: www Subdomain
Matching Regular Expression: ^(.+//)([\d\w]+\.|)(.+)$
Show Action as Menu Entry: yes
Action: $1www.$3

Loads the current page’s base address with a www subdomain (http://some.example.com/dig/around/here.html becomes http://www.example.com/).

Name: www Subdomain Index
Regular Expression: ^(.+//)([\d\w]+\.|)([\d\w\.]+\.[\w]+/)(.*)$
Show Action as Menu Entry: yes
Action: $1www.$3

Loads a current http page as https (ssl).

Name: https
Regular Expression: ^http([^s].+)$
Show Action as Menu Entry: yes
Action: https$1

Click the left thumbnail to see how these actions appear in Neo Digglers context menu next to the Firefox address bar.

A great help when building Regular Expressions is KDE’s kregexpeditor, part of kdeutils. You can visually compose and analyse your regexes and match them against desired text.
And well, while this regex might seem like black magic at first (and second ;) sight, and it can be kind of mind boggling oftentimes, it’s really worth learning it! The syntax is being used in so many places (tools, programming languages) and will come very handy for parsing and substituting texts.

ChangeLog

[2008-03-30: Fix https action. BugMeNot not working in Windows.]

2008/03/21

Direct Links to Box.net Shared Files for Free

Filed under: Box.net,Deep Link,Direct Link,File Hosting,Internet,Web,websites — FrankZabbath @ 11:33

Update

Sadly this method stopped working. Even old links don’t work anymore. You would have to use shared instead of lite again.

I’ve been happily using the free Box.net file hosting for a while. What’s a bit annoying is that as a free member you aren’t offered direct links to your shared files. So you’d always have to load some sort of bridge page containing the direct link. But I found an easy way for direct linking, which I successfully use for example on this blog. Here’s how..Box.net

  1. Log in to your box.net account (what a surprise ;)
  2. Browse to URL http://www.box.net/lite/
  3. Upload one single file
  4. Note down the shared file URL, e.g. http://www.box.net/shared/dgr8b0xn3t
  5. The Direct Link is the given URL above with /shared/ replaced by /lite/. That would be http://www.box.net/lite/dgr8b0xn3t

Beware that Hot Linking is not allowed with Box.net AFAIK (at least for free members), so don’t use this to embed your 10 MB Flash applets or something like that. But still, Deep (or Direct) Linking like I do with my downloads will most certainly not cause you trouble.

ChangeLog

[2009-04-26: This trick isn’t working anymore.]

My 11th very own custom Rockbox build for Sansa e200

My latest patched Rockbox build based on yesterday’s Revision 16718. As before it includes USB Mass Storage (High Speed), USB Serial, smooth resized Album Art, Viewports patches and Fast Charge. I also built a patched bootloader, which replaces the whole Sandisk bootloader decreasing the boot time to about 3 seconds (more than 10 seconds before)!SanDisk Sansa e200

I made this build to try the new bootloader and to see if the increased boost ratio I believe to get with the recent builds would drop.
The bootloader is working very fine! But you should be careful to take this step and be sure to read the patch tracker page. To apply the bootloader attach your Sansa to USB, be sure to unmount it, and use Sansapatcher (x86 binaries for Linux and Windows) like this: ./sansapatcher -bl bootloader.bin
High boost ratio seems to persist; though I’m not sure if it really increased. Maybe the higher boost is because of using the multiband equalizer now, instead of just the bass/treble settings like before or I simply don’t remember correctly. Should compare the boost behaviour with an unpatched build..
There haven’t been very grave changes in the codebase as far as I can see. There have been fixes to USB Storage, microSD hot-swapping, charging strategy, WPS tags. Additionally some DSP routines rewritten in ARM assembler.

Updated Patches

viewports-wps-v3.diff
multifont-20080317.patch
charge_e200_16657.diff

Removed Patches

multivolume_dircache_20080310b.patch (committed to svn)

New Patches

bootloader_boost.patch

Download

rockbox-16718.zip
rockbox-full-16718.zip
rockbox-bootloader-16718.zip Optional! Removes Sandisk Bootloader (i.e. loosing Recovery Mode)!

Patch Log

FS#8385 – Viewports
patch -p0 < /home/scheff/downloads/viewports-wps-v3.diff

FS#4733 – Multifont
patch -p0 < /home/scheff/downloads/multifont-20080317.patch

FS#8308 – Port of a imlib2 based smooth scaling algorithm for bitmaps
patch -p1 < /home/scheff/downloads/smooth_resize.patch

FS#5697 – bmp resize patch
patch -p0 < /home/scheff/downloads/albumart-smooth_resize-080221.patch

FS#8523 – Disable WPS updating when the backlight is off.
patch -p0 < /home/scheff/downloads/wps-2.patch

FS#7661 – Make ID3 info screen more readable
patch -p0 < /home/scheff/downloads/expand_id3_screen_line_width.patch

FS#7542 – This patch moves all the playlist creation from the root dir to the PLAYLISTS directory.
patch -p0 < /home/scheff/downloads/playlist_folder.patch

FS#7565 – support for the TPA tag
patch -p1 < /home/scheff/downloads/50-id3TPA.patch

FS#6800 – Sansa e200 backlight behaviour
patch -p0 < /home/scheff/downloads/backlight-thread-fading_r16180M-080128.patch

FS#4988 – Optionally keep backlight on while plugins are running
patch -p0 < /home/scheff/downloads/plugin-backlight_070303.patch
**
Hunk #1 FAILED at 390.
1 out of 1 hunk FAILED — saving rejects to file apps/settings.h.rej
** no-brainer fix

FS#6884 – Sansa E200 m3u/m3u8 to pla playlist converter
patch -p0 < /home/scheff/downloads/sansa_playlist_converter_V3.3.diff
**
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED — saving rejects to file apps/plugins/CATEGORIES.rej
** no-brainer fix

FS#8070 – Sansa battery_bench plugin buffer overflow
patch -p0 < /home/scheff/downloads/sansa_batt_bench.patch

FS#8363 – Charger configuration for Sansa e200/c200
patch -p0 < /home/scheff/downloads/charge_e200_16657.diff

FS#8642 – Improve boot time on Sansa
patch -p0 < /home/scheff/downloads/bootloader_boost.patch

ChangeLog

[2009-04-26: Fix box.net links.]

Prevent Debian on Linksys NSLU2 Going Out of Memory

After switching from Unslung to Debian I constantly got various programs (mt-daapd, rtorrent, gcc) terminating, because they ran out of memory. Tweaking or even disabling the oom-killer kernel feature didn’t do the trick, so I took a look at the ulimits and found most of them set to unlimited. Setting some of the ulimit defaults like on Ubuntu Linux solved these problems.
Linksys NSLU2

Update

Thanks to Michael the solution to any oom problem is upgrading to Debian Unstable (aka. Lenny). My “solution” didn’t proof. See the comments for more detail.

After some experimenting, I now have two ulimit settings – stack size and max locked memory – pointed out, but am not sure if really both are mandatory. But it shouldn’t hurt either. These limits, being unlimited by default, now got set to sane values as follows.

You can set the ulimits for the current shell with ulimit -l 32 -s 8192. System wide defaults are defined in /etc/security/limits.conf e.g. by adding this:

#restrictions to avoid oom using ubuntu defaults
*       hard    memlock 32
*       hard    stack   8192

As mentioned before, I currently have oom-killer disabled. But I should try to enable it again, to benefit from this feature. This can be done with the sysctl tool and in the /etc/sysctl.conf file.

While I’m at it, that would be the output of the stock Debian settings:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) unlimited
max rt priority                 (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

That’s the output for Ubuntu Gutsy:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 8191
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 8191
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

ChangeLog

[2008-04-11: Better upgrade to Lenny.]

2008/03/19

Fixed-point Ogg Vorbis and Musepack Decoder Packages for Debian Etch ARM

I’m using Firefly Media Server on a Linksys NSLU2 running Debian Etch to stream my whole music collection to my Pinnacle SoundBridge HomeMusic. Many files in my collection are in Ogg Vorbis format and a few in Musepack too, which unfortunately aren’t natively supported by the SoundBridge. Luckily Firefly can transcode audio files on the fly e.g. using the ssc plug-in and any console application via shell scripts. But the problem with the Debian packages is that they don’t take into account the missing floating point unit (FPU) of the NSLU2 hardware, and that makes oggdec/ogg123 and mpc123 take ages – way below real-time – to transcode. Fixed point versions of the transcoders aren’t available in the Debian Etch package repositories even the sourcecode already exists, so I had to build them myself.
Linksys NSLU2
I first searched the Debian packages for fixed point versions.
I found the libvorbisidec package, which is the fixed point version of libvorbis also going by the name Tremor. The vorbis-tools is only available as normal floating-point version linked to libvorbisdec. For Musepack there are (floating-point) packages libmpcdec3 for the library and mpc123 for the application.
In the Firefly forums I found patches for vorbis-tools (providing the ogg123 and oggdec transcoders), so that I could build Tremor versions of the transcoder apps.
In the Musepack sources there’s already a define variable to build with fixed point math only. So I would just have to enable that and rebuild the library and transcoder.

To make a long story short, here are the Debian Etch ARM binary packages for fixed-point Ogg Vorbis and Musepack:

I will gladly provide the sources. Feel free to ask for them! You can download the Deb sources for libmpcdec and vorbis-tools further below.

Update

These are the integer Lenny ARM binaries. Libvorbisidec is available through the official repos.:

Update 2

Here are the Deb sources (.dsc, .diff.gz and .orig.tar.gz) to build your own binary Deb packages.

Performance now is very good on my 266 MHz NSLU2. From what I’ve seen in top, mpc123 and ogg123 stay below 50% CPU usage and decoding is done faster than real-time.

Only to show off how unbelievably cool I am ;), and in case somebody would like to reproduce these builds on another distribution, I’ll roughly describe the steps I’ve taken.

Build libvorbisidec

Pretty straight forward. As far as I remember I only had to rebuild the source package:

mkdir -p ~/debuild/libvorbisdec
cd ~/debuild/libvorbisdec
dget -x http://ftp.de.debian.org/debian/pool/main/libv/libvorbisidec/libvorbisidec_1.0.2+svn14261-1.dsc
cd libvorbisidec-1.0.2
debuild -rfakeroot -uc -us
cd ..
sudo dpkg -i libvorbisidec1_1.0.2+svn14261-1_arm.deb libvorbisidec-dev_1.0.2+svn14261-1_arm.deb

Patch and build vorbis-tools

This one was trickier. The patches found on the forum aren’t complete. The older one is blindly changing the endianess of the resulting audio data, thereby producing only noise on the little endian Debian I use. The newer one misses linking mpcdec to libvorbisidec.

mkdir -p ~/debuild/vorbis-tools
cd ~/debuild/vorbis-tools
dget -x http://ftp.de.debian.org/debian/pool/main/v/vorbis-tools/vorbis-tools_1.1.1-6.dsc
cp -pr vorbis-tools_1.1.1 vorbis-tools_1.1.1.wrk
cd vorbis-tools_1.1.1.wrk
[apply and manually fix the tremor patch]
[create tremor patch file against vorbis-tools_1.1.1/]
[copy patch file to vorbis-tools_1.1.1/debian/patches]
[add patch file at bottom of vorbis-tools_1.1.1/debian/patches/series]
[add libvorbisidec-dev dependency to vorbis-tools_1.1.1/debian/control and document Tremor versions in description]
[increase version and add changes in changelog via dch -i]
cd vorbis-tools_1.1.1
debuild -rfakeroot -uc -us
cd ..
dpkg -i vorbis-tools_1.1.1-7_arm.deb

Patch and build libmpcdec

Here I add a patch to enable the fixed-point define. Beware, the following steps are just written down from memory in a hurry. So expect flaws. :)

mkdir -p ~/debuild/libmpcdec
cd ~/debuild/libmpcdec
dget -x http://ftp.de.debian.org/debian/pool/main/libm/libmpcdec/libmpcdec_1.2.2-1.dsc
cp -pr libmpcdec-1.2.2 libmpcdec-1.2.2.wrk
vim libmpcdec-1.2.2.wrk/include/mpcdec/math.h
[uncomment #define MPC_FIXED_POINT]
mkdir libmpcdec-1.2.2.wrk/debian/patches
diff -Naur libmpcdec-1.2.2 libmpcdec-1.2.2.wrk > libmpcdec-1.2.2.wrk/debian/patches/enable_fixed_point.diff
cd libmpcdec-1.2.2.wrk
dch -i
[increases version in changelog. add some notes.]
debuild -rfakeroot -uc -us
cd ..
dpkg -i libmpcdec3_1.2.2-2_arm.deb libmpcdec-dev_1.2.2-2_arm.deb

Build mpc123

This one has only to be rebuilt with the fixed-point libmpcdec version above installed.

mkdir -p ~/debuild/mpc123
cd ~/debuild/mpc123
dget -x http://ftp.de.debian.org/debian/pool/main/m/mpc123/mpc123_0.2.1-1.dsc
cd mpc123-0.2.2
debuild -rfakeroot -uc -us
cd ..
dpkg -i mpc123_0.2.2-1_arm.deb

I haven’t found a fast enough way to transcode Monkey’s Audio (aka. APE) files yet, but that’s mainly because I don’t have any (which haven’t been transcoded to mp3 by myself already). For your information: Building the Monkey’s Audio Codec (MAC) for Linux did work.
I think when looking for more low resource or fixed-point codecs, a good place to look for is the Rockbox Wiki. That’s what I used too.

To make this Firefly Transcoding post more complete, here’s my current version of the ssc script:

#!/bin/sh
#
# script to facilitate server-side transcoding of ogg files
#
#
# Usage: mt-daapd-ssc.sh   
#
# You may need to fix these paths:
#

WAVSTREAMER=/opt/mt-daapd-ssc/wavstreamer
OGGDEC=oggdec
OGG123=ogg123
FLAC=flac
MPC=mpc123
FFMPEG=/opt/mt-daapd-ssc/ffmpeg-quiet.sh
MAC=mac

ape_file() {
    $MAC "$FILE" - -d | $WAVSTREAMER -o $OFFSET $FORGELEN
}

ffmpeg_file() {
    $FFMPEG -i "$FILE" -acodec pcm_s16le -f wav - | $WAVSTREAMER -o $OFFSET $FORGELEN
}

mpc_file() {
    $MPC --quiet --wav - "$FILE" | $WAVSTREAMER -o $OFFSET $FORGELEN
}

ogg_file() {
#    $OGGDEC --quiet -o - "$FILE" | $WAVSTREAMER -o $OFFSET $FORGELEN
    $OGG123 -q -d wav -f - "$FILE" | $WAVSTREAMER -o $OFFSET $FORGELEN
}

flac_file() {
    $FLAC --silent --decode --stdout "$FILE" | $WAVSTREAMER -o $OFFSET $FORGELEN
}

FILE=$1
OFFSET=${2:-0}

# this is nonsense!
if [ "$3" != "" ]; then
  FORGELEN="-l ${3%.*}"
fi

case "$1" in
  *.[sS][hH][nN])
  ape_file
  ;;
  *.[sS][hH][nN])
  ffmpeg_file
  ;;
  *.[mM][pP][cC])
  mpc_file
  ;;
  *.[oO][gG][gG])
  ogg_file
  ;;
  *.[fF][lL][aA][cC])
  flac_file
  ;;
  *)
# here you could cat a generic "error" wav...
# cat /path/to/error.wav
  ;;
esac

Oh, FYI I’m using mt-daapd 0.2.4+r1376-1 from the Debian repo. I got the wavstreamer binary and the ssc script example by extracting them from a newer Debian package. The Firefly Wiki provides more information on transcoding implementation.

ChangeLog

[2008-04-11: Add Lenny Debs.]
[2008-06-06: Add Deb sources for libmpcdec and vorbis-tools.]
[2009-04-26: Fix box.net links.]

2008/03/13

ScummVM v0.11.1 for GP2X

The ScummVM binaries I found in the web aren’t up to date (v0.10) and therefore new games like Elvira series are missing. (v0.11). I already made some GP2X build of ScummVM (SVN) before. The current SVN didn’t run, so I built the latest stable version.ScummVM Logo

It’s built with the open2x toolchain against their standard SDL and the MAD (mp3), Tremor (Vorbis), and libmpeg2 (mpeg2) libraries. What’s missing is fluidsynth and FLAC, but those were also missing in the other GP2X builds AFAIK.

Download the build here: scummvm-gp2x-0.11.1.zip

One bug that persists in my builds is the stereo sound in games switches the balance to the right channel after a few seconds. Otherwise this build seems fine. I guess it has to do with the SDL_mixer in the open2x libraries.

ChangeLog

[2008-03-19: Categories for the post]
[2009-04-26: Fix box.net links.]

2008/03/11

Scrobbling Everywhere All the Time

I must confess I’ve become quite a Last.fm fanboy. :) So what would be more important than keeping track of as much music playing as possible. Scrobbling the plays of my PC audioplayer Amarok and Foobar2000 ain’t that spectacular, but feeding statistics of my mobile MP3 Player SanDisk Sansa e200 and my stand-alone player Pinnacle SoundBridge HomeMusic (licensed by Roku) I consider being more of that kind.Last.fm Social Music Revolution

Scrobbling Sansa e200 with Rockbox

Precondition is using the great alternative Firmware Rockbox. It already has the Audioscrobbler logging built in. To submit the logs I use the PC application QTScrobbler under Linux (and occasionally Windows). That’s very easy and convenient. Just be sure to set your Sansa’s clock somewhat correct.

Scrobbling SoundBridge with Firefly Mediaserver

To gain access to my whole music collection without having a PC running, I’m using the fine Linksys NSLU2 NAS running the Firefly Mediaserver (aka. mt-daapd) with a cheapo 160 GB USB HDD (Storage) and a 2 GB USB Flash Drive (OS) attached. I’ve had a working setup using the alternative NSLU2 firmware Unslung, but soon switched to Debian ARM, for its greater versatility and more straight forward configuration.

I’ll write more detailed posts on the NSLU2 soon, especially regarding Firefly and fixed-point Transcoding and Last.fm Radio. But for now a quick overview on the setup, which should be possible on other platforms and for any streaming client too.

I obtained the Firefly Mediaserver prebuilt from the Firefly website. Installation is quite easy and well documented.

Submission to Last.fm is done by the Python application Lastfmsubmitd. As the name suggests it’s a daemon permanently waiting for data to be submitted. That data is gathered from text files placed e.g. in /var/spool/lastfm. Under Unslung I had to manually install it from source (python setup.py install), and for Debian it’s in the apt repo (but I built a deb package of the recent version found in Debian unstable).

Creating the data files is done periodically by a shell script based on what I found in the Firefly Forum. It’s run every 5 minutes by cron and queries the “last played field” of Firefly’s collection database and outputs results to Lastfmsubmitd’s spool directory.
That’s my current shell script (converting GMT+1 timestamps to UTC by substracting 3600 seconds):

#!/bin/bash

# fetch newly played songs from fireflydb and write
# into lastfmsubmitd readable format

# config
SQLITE=sqlite3
DATABASE=/var/cache/mt-daapd/songs3.db
LASTFILE=/var/cache/mt-daapd/lastfmsubmit.date
DBLSFILE=/var/cache/mt-daapd/lastfmsubmit.ls
TMPDIR=/tmp
SPOOLDIR=/var/spool/lastfm


# get last run time
if [ -e "$LASTFILE" ]
then
  . "$LASTFILE"
else
  LASTRUN=0
fi

# get last database file date
if [ -e "$DBLSFILE" ]
then       
  . "$DBLSFILE"
else     
  DBLSRUN=
fi

# exit when database file unchanged
DBLSNOW=`ls -l "$DATABASE"`
if [ "$DBLSRUN" == "$DBLSNOW" ]
then
  exit
fi

# log file date
echo "DBLSRUN=\"$DBLSNOW\"" > "$DBLSFILE"

# query database
OUTFILE=$(mktemp "$TMPDIR"/mt-daapd-XXXXXXXX)
"$SQLITE" "$DATABASE" 'SELECT artist,album,title,track,song_length,time_played FROM songs where time_played > '"$LASTRUN"' ORDER BY time_played ASC;' | gawk -F '|' '{ printf "---\nartist: \"%s\"\nalbum: \"%s\"\ntitle: \"%s\"\ntrack: %s\nlength: %d\ntime: !timestamp %s\n",$1,$2,$3,$4,$5/1000,strftime("%Y-%m-%d %T",$6-3600) }' > "$OUTFILE"

# place non-zero result into spool, else drop file
if [ -s "$OUTFILE" ]
then
  chmod 664 "$OUTFILE"
  mv "$OUTFILE" "$SPOOLDIR"
else
  rm "$OUTFILE"
fi

# log query date
echo "LASTRUN="`date +%s` > "$LASTFILE"

Downside of this solution is, Firefly will only consider a track as played, if it has been completely and continuously been played. So skipping or pausing a track will cause it to not be submitted.
Also there’s no separation between Podcasts and the rest of my music collection. What I haven’t tried yet, is the behaviour when playing web radio via Firefly playlists, as I do all radio streaming directly through the SoundBridge user interface.
To iron out the downsides using the same approach, the first one would need changes to the Firefly code I guess, the others could probably be fixed modifying the shell script.

My 10th very own custom Rockbox build for Sansa e200

Time for yet another patched Rockbox build. This one based on Sunday’s Revision 16594 also includes USB Mass Storage (High Speed this time), USB Serial, smooth resized Album Art, Viewports patches and Fast Charge.SanDisk Sansa e200

Updated Patches

02.#4733,multifont-20080309.patch
viewports-wps-v1-20080309.diff

Removed Patches

integration_1.diff (obsolete)
changes (committed into svn)

Download

rockbox-16594.zip
rockbox-full-16594.zip

Patch Log

FS#8385 – Viewports
patch -p0 < /home/scheff/downloads/viewports-wps-v1-20080309.diff

FS#4733 – Multifont
patch -p0 < /home/scheff/downloads/02.#4733\,multifont-20080309.patch
**
Hunk #1 FAILED at 682.
Hunk #2 FAILED at 690.
2 out of 2 hunks FAILED — saving rejects to file firmware/drivers/lcd-remote-1bit-v.c.rej
** code was moved to lcd-1bit-vert.c, so “patch” there

FS#8308 – Port of a imlib2 based smooth scaling algorithm for bitmaps
patch -p1 < /home/scheff/downloads/smooth_resize.patch

FS#5697 – bmp resize patch
patch -p0 < /home/scheff/downloads/albumart-smooth_resize-080221.patch

FS#8523 – Disable WPS updating when the backlight is off.
patch -p0 < /home/scheff/downloads/wps-2.patch

FS#7661 – Make ID3 info screen more readable
patch -p0 < /home/scheff/downloads/expand_id3_screen_line_width.patch

FS#7542 – This patch moves all the playlist creation from the root dir to the PLAYLISTS directory.
patch -p0 < /home/scheff/downloads/playlist_folder.patch

FS#7565 – support for the TPA tag
patch -p1 < /home/scheff/downloads/50-id3TPA.patch

FS#6800 – Sansa e200 backlight behaviour
patch -p0 < /home/scheff/downloads/backlight-thread-fading_r16180M-080128.patch

FS#4988 – Optionally keep backlight on while plugins are running
patch -p0 < /home/scheff/downloads/plugin-backlight_070303.patch
**
Hunk #1 FAILED at 390.
1 out of 1 hunk FAILED — saving rejects to file apps/settings.h.rej
** no-brainer fix

FS#6884 – Sansa E200 m3u/m3u8 to pla playlist converter
patch -p0 < /home/scheff/downloads/sansa_playlist_converter_V3.3.diff
**
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED — saving rejects to file apps/plugins/CATEGORIES.rej
** no-brainer fix

FS#8070 – Sansa battery_bench plugin buffer overflow
patch -p0 < /home/scheff/downloads/sansa_batt_bench.patch

FS#8363 – Charger configuration for Sansa e200/c200
patch -p0 < /home/scheff/downloads/charge_e200.diff

FS#7598 – Dircache support for multivolume targets.
patch -p0 < /home/scheff/downloads/multivolume_dircache_20080130b.patch
**
Hunk #1 FAILED at 304.
1 out of 1 hunk FAILED — saving rejects to file firmware/export/config.h.rej
** no-brainer

ChangeLog

[2009-04-26: Fix box.net links.]

Create a free website or blog at WordPress.com.