Friday, 20 February 2009

EEE PC as Photo Frame - adding music

It would be nice to add some background music while watching a slideshow (see my previous post about making a slideshow script). After playing with that script I ended up with the following version:
#!/bin/sh

xset s off -dpms
mpg321 --random --quiet /path/to/music/files/*.mp3 &
qiv -sfmir -d 8 /path/to/picture/files/*.JPG
killall mpg321
xset s on +dpms
You should obviously replace "/path/to/music/files/" and "/path/to/picture/files/" to your actual locations.

Below is the short explanation of the changes.
I noticed that after 20 minutes the screen went blank, although screen-saver feature was disabled. The command
xset q
revealed, that DPMS (Display Power Management Signaling) feature was enabled, so I changed the first command in the script as follows:
xset s off -dpms
to switch DPMS totally off. The last command re-enables this feature.

Using my Package Finder tool I found that my EEE PC had pre-installed command-line audio player, called mpg321. It appeared that this program was quite suitable for our purposes.
mpg321 --random --quiet /path/to/music/files/*.mp3 &
The above command launches mpg321 player and tells it to play all mp3 files in the given folder in random order; the --quiet option supresses unnecessary text output. The "&" at the end tells the OS not to wait for the player finished its work, but go to the next line of the script.

When we terminated qiv, playing the slideshow, we also have to stop music. The command
killall mpg321
does the trick.

That's all.

Sunday, 15 February 2009

Asus EEE PC 701 as Digital Photo Frame



Its quite easy to turn your EEE PC into digital photo frame. To make this possible one needs two things.
Firstly a program, which would present the photos in a full-screen slideshow mode.
Secondly the screen saver (or rather power saver) feature should be temporarily disabled, to avoid getting black screen after 5 mins of inactivity. Obviously the laptop must be powered from the mains.

After some googling I found the program, which I think fits quite well for slideshow. It's called qiv, Quick Image Viewer. Because EEE PC has a lot of software pre-installed, it worth to see, if this program is already on your computer or not.

1. Open the terminal (Ctrl+Alt+T) and type:
qiv --help
If you see a lot of output with explanations of possible options and available keys, you can skip the next step, otherwise you have to install it.

2. Type in the terminal:
sudo apt-get install qiv
The above command (apt-get) installs the mentioned package (qiv) into your computer, and requires administrative rights to perform this task (sudo).
If the above does not work, see this tutorial about Adding Additional Software Repositories
.
Unfortunately I am not sure what repository qiv came from.
Note: If you are in doubt what any terminal command is intended to, say "sudo" as above, type "man sudo", which will show manual pages for the given command; to scroll down use Space key, to terminate the manual press Ctrl+Z. Other possible ways are to type the command with -h or --help options, or find its description in the Internet with Google.

3. Put the pictures, you want to present, in a single folder. You may also wish to scale them down, to save some disk space. In my case the photos were exported (with scaling down to 800 pixels) from Picasa to
/home/user/MMC-SD/partition1/DCIM/Starred-Photos/
As you may guess the above string points to the folder, located on the 1GB SD card, which was earlier used with my digital camera. Now this card is an extra storage for EEE PC.

4. Again, in the terminal type the following (change my folder to the path to your picture location, and keep in mind that Linux commands are case-sensitive):
qiv -sfmir -d 8 /home/user/MMC-SD/partition1/DCIM/Starred-Photos/*.JPG
and see, what is going on. Ideally you should get your slideshow working. To terminate it, press ESC . If the above command does not work, first type "qiv --help", to be sure qiv is really installed, then check carefully your path to pictures.
Brief explanation the above command:
  • qiv - calls Quick Image Viewer
  • -sfmir - is actually five options; -s is for slideshow; -f is for full-screen mode; -m is for preserving images aspect ratio and zooming; -i is to disable status bar, and -r is for random order
  • -d 8 - means 8 secs delay between images; you may want to change this value
While watching the slideshow, you can use the following keys:
  • space - to get the next picture
  • esc - to terminate the slideshow
  • s - to pause/continue slideshow.
If you do nothing, the screen should go black after 5 minutes, and this is the next problem to solve.

There is no running screen-saver on EEE PC by default, but there are some low-level power saving options. One of them is an option in xorg.conf file, which tells to set the screen black, if there were no keyboard/mouse activity for 5 mins. To avoid this type the following command:
xset s off
and check you can watch your slideshow endlessly. If all the above works, we should now put it all together.

5. Open a text editor, to do it type in the terminal:
kate
6. Enter the following set of commands:
#!/bin/sh
xset s off
qiv -sfmir -d 8 /path/to/your/pictires/*.JPG
xset s on
In the above sample change the third line with your command from step 4. First line says it is the script, second switches blank screen off, third is actually your slideshow and last restores power saving settings.

7. Click File -> Save As.. and save this file as "slideshow.sh" (without quotes).

8. Close the text editor

9. Type in the terminal:
sudo chmod +x slideshow.sh

The above command makes your "slideshow.sh" file executable.

10. Type:
./slideshow.sh

and check that everything works.

11. Type:
sudo mv slideshow.sh /usr/local/bin/
This command moves your file from your home folder to a system folder for executable files, (not supplied by the OS vendor).

12. Type:
cd /usr/local/bin

This will change your current active folder and then type:
sudo chmod +x slideshow.sh
to make the file executable again.

13. Using Launcher Tools create a new launcher in your favourite folder, like shown in the picture:



That's all!

Enjoy, but avoid using it when the computer is on battery.

TODO: Add some music.