Blog

Controlling Amarok 2 with LIRC

21 June 2009, 16:31

I picked up a Media Center remote while I was in the US and wanted to set up LIRC to control Amarok.

It’s fairly simple since all you need to do is map the LIRC controls to qdbus commands and use a bash script to control volume and position seeking.

First, if you haven’t already, you need to install LIRC. On Debian/Kubuntu you can install it with apt-get install lirc.

Once you’ve done that, make sure you’re using the correct driver by testing input with ‘irw‘. The output should look like this (the driver I’m using is mceusb – yours might be different):

don@desktop:~$ irw
000000037ff07be9 00 Play mceusb

If you don’t get any output from irw you need to take a step back and get the correct driver working for your remote first. I had to reboot for the driver to work.

After you have installed the driver, save lirc-amarok to $HOME/.lirc/amarok, open it in your favourite text editor and replace mceusb with the driver you are using (irw output will show the driver you are using):

Then, save lirc-amarok.sh to $HOME/bin/lirc-amarok.sh and chmod +x $HOME/bin/lirc-amarok.sh to make it executable.

The lirc-amarok.sh script isn’t loaded by LIRC automatically so you need to run it yourself. Either when starting your desktop or by editing your Amarok menu entry to run “lirc-amarok.sh && amarok %U” – which will load it only when you open Amarok.

Comments

PHP classes for Amazon SQS and SimpleDB

20 February 2009, 11:45

Dan Myers has written some PHP classes for Amazon SQS and SimpleDB based on the S3 PHP class:

Comments [1]

Wordpress plugin for Amazon S3

16 February 2009, 18:47

I’ve created a very simple Wordpress plugin for Amazon S3 which uses my Amazon S3 PHP class.

Currently it allows you to upload files to an S3 bucket and insert them into your post when adding media.

Please note that PHP 5 and the CURL extension are required.

Download the latest version of the plugin.

To install place s3uploader.php into your wp-content/plugins/ directory. After activating the plugin you will need to configure your AWS credentials under Settings » Amazon S3 and select the bucket you would like to upload to.

Planned features for upcoming releases

  • Image resizing
  • Bucket browsing functionality under the media library

Changelog

  • 0.2 (2009-03-07):
    Some improvements and support for file downloads and flash movies
  • 0.1 (2009-02-16):
    Initial release

Comments

Tracking file downloads with Google Analytics and Prototype

16 July 2008, 10:29

Using Prototype’s CSS-style selectors you can easily track file downloads with Google Analytics:

Event.observe(window, 'load', function() {
	$$('a[href$=".zip"]', 'a[href$=".pdf"]').each(function(anchor) {
		anchor.observe('click', function(event) {
			if (pageTracker) pageTracker._trackPageview(anchor.getAttribute('href'));
		});
	});
});

Comments

Simple PHP upload progress meter using Prototype

6 July 2008, 02:45

The uploadprogress extension is fairly simple to use - but it is important to note that on some PHP configurations it doesn't function correctly and only returns a progress of 100%.

Upload progress screenshot

The JavaScript uses David Stone's method for displaying percentage bars but you can modify the onCreate, onUpdate and onComplete callbacks if you want to use your own.


1) You will need uploadprogress >= 0.3.1 (0.3.0 does not seem to work for me), to build it from source (don't forget to restart your webserver after installing):

cvs -d :pserver:cvsread@cvs.php.net:/repository checkout pecl/uploadprogress
cd pecl/uploadprogress && phpize && ./configure && make && sudo make install

2) Progress tracking is automatically enabled if you have a field named UPLOAD_IDENTIFIER with a unique ID in your file upload form:

<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?php echo $uploadID; ?>" id="uploadIdentifier" />

3) You retrieve the upload progress with your UPLOAD_IDENTIFIER (obviously these calls will be AJAX requests):

$data = uploadprogress_get_info($uploadID);

Once the upload is complete the extension will remove the temporary file and further info calls will return null.

That's it!

See the demo

Download the code


Comments [7]

Top

Copyright © 2007-2008 Undesigned