Wednesday, December 31, 2008

Monday, December 29, 2008

Setting up a laptop to become a digital picture frame

This will assume you have some experiance using a *nix command line interface (CLI).
When you boot from the CD, or floppies, type in expert. In expert mode install Debian with only the laptop and base system packages. I suggest not allowing root to login and using sudo, and if you do want to be able to log in as root I would still choose to use sudo at this time. Choosing to use sudo here will allow the user you create to sudo still, and to be able to login as root just run:
sudo passwd


To use feh, which will auto rotate and auto resize the pictures for you on a system that can handle X running:
apt-get install feh imagemagick rungetty autofs udev hal ivman unclutter xserver-xorg xorg
apt-get remove xserver-xorg-video-all doc-debian doc-linux-text info man-db manpages m4 exim4 exim4-base exim4-config mutt procmail ftp tcsh iamerican ibritish ispell dictionaries-common wamerican
apt-get install xserver-xorg-video-vesa xserver-xorg-video-fbdev

Otherwise to use fbi, which will also do a lot of automagic stuff for you and only requires a framebuffer running:
apt-get install autofs udev ivman rungetty hal pmount fbi imagemagick
apt-get remove doc-debian doc-linux-text info man-db manpages m4 exim4 exim4-base exim4-config mutt procmail ftp tcsh iamerican ibritish ispell dictionaries-common wamerican
To explain some of the packages used: *Note, some of the packages may be installed already.
  • autofs: This allows the automagic detection of what filesystem is being used on removable media.
  • udev: Device manager for the 2.6 kernel. We will be creating a rule to allow us to automagically mount a cd and copy the contents over.
  • ivman: Used because it "anounces" the change in a drives state to the system, making the udev rule take affect as soon as the CDROM in this case is inserted.
  • rungetty: Used to autologin when booted
  • pmount: To allow users to use the mount command
  • imagemagick: Always a good tool to have when manipulating images.
  • unclutter: Removes the mouse cursor from the screen.


To allow autologin, I suggest installing rungetty (see above) and then changing the inittab.
/etc/inittab
1:2345:respawn:/sbin/getty 38400 tty1

change to
1:2345:respawn:/sbin/rungetty --autologin pictures tty1
#1:2345:respawn:/sbin/getty 38400 tty1


Ok, since this is most likely going to be a gift, and when hacked into being a frame it may or may not have a keyboard it is nice to write a script that will just auto copy the pictures off a cd when inserted.

Script to copy cd files over
/home/pictures/cdcp.sh - Original version
#!/bin/sh
pmount /dev/cdrom /media/cdrom
cp -r /media/cdrom/* /home/pictures/photos/
pumount /media/cdrom
eject /dev/cdrom
/home/pictures/cdcp.sh - Improved version
#!/bin/sh
pmount /dev/cdrom /media/cdrom0
find /media/cdrom0 -iname '*.jpg' -exec sh -c 'exec cp -f "$@" /home/pictures/photos/' find-copy {} +
chmod 664 /home/pictures/photos
pumount /media/cdrom0
eject /dev/cdrom

Now that we have a script to copy for us, we need to get it to run when a cd is inserted. This is done by adding a UDEV rule.

/etc/udev/rules.d/udev.rules
SUBSYSTEM=="block", KERNEL=="hdc", RUN+="home/pictures/cdcp.sh"


Now for the actual slideshow script. Assuming this is a gift I am using a duration of 240 seconds, this is how long a picture will stay up before switching to a new one.
The first one is if your using feh.

slideshow.sh
#!/bin/bash

killall feh unclutter

unclutter &

feh -zZFr -D 240 /home/pictures/photos/

A script to restart the slideshow.
restartshow.sh
#!/bin/bash
killall feh unclutter;
/home/pictures/slideshow.sh &

Then to make sure the computer doesn't go to sleep, in case you can not edit the bios for some reason, in the chrontab add the lines to send a signal to the mouse. Also I have a line that restarts the slideshow every 6 hours. its not really needed but if it crashes from some reason it will restart at the six hour mark at least.
$ chrontab -e
0,10,20,30,40,50 * * * * echo "Hello there mousey" > /dev/mouse
1,11,21,31,41,51 * * * * echo "Hello there mousey" > /dev/mouse
* 0,6,12,18 * * * /home/pictures/restartshow.sh


Since feh requires X, we need it so start when pictures logs in, and if X quits it will restart itself as well.
/home/pictures/.bash_profile
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
while [ 1 == 1 ]
do
startx
sleep 10
done
fi

Since feh runs in X, you need to tell X that when it starts to start the slideshow. You may need to create this file in the users home directory.
/home/pictures/.xsession
/home/pictures/slideshow.sh


Using fbi you could use the script similar to this:
slideshow.sh
#!/bin/bash

killall fbi
fbi -a -u -t 240 /home/pictures/photos/*
Note, as of this posting I have not been able to test the fbi as the IBM Thinkpad 365xd I was trying to use was having issues getting the frame buffer working. Will edit this later to include pictures and the rest of the fbi information.





Sources used to create these scripts and set up the frame are :
http://www.risacher.org/pfl/
http://www.adamfranco.com/archives/3
http://robert.hoisington.googlepages.com/walk-throughandscripts
http://linuxbasement.com/content/digital-picture-frame-howto
https://www.agol.dk/elgaard/picframe.html
http://irisframe.odul.com/mediawiki/index.php/Main_Page

Sunday, December 21, 2008

LAW UV WATER

LAW UV WATER: "




funny pictures of cats with captions


LAW UV WATER DISPLACEMENT A kitteh in a baff will displace ten times its own volume in water. (Mostly frum attemptz 2 escape)


unless u iz a trikky kitteh nd can git awt of baffs.


picture: dunno source, via our lolcat builder. lol caption: chech1965


» Recaption This


» See All Captions


''''''



"



(Via Lolcats 'n' Funny Pictures - I Can Has Cheezburger?.)

Twitter Updates