Archive

Archive for January, 2007

Media Center on the PS3 (debian) :)

January 25th, 2007

This guide assumes a basic knowledge about linux. Writing a step by step guide for complete beginners would take forever, and at the current state there is no reason for someone who aren’t a linux user (geek) to install this yet. I predict that eventually there will be distributions for PS3 bundled with media frontends but until then this is not for the mainstream audience. I take no responsibilities for what you do with your PS3. Don’t do this if you don’t know what you are doing (although it should be safe).

Some guy named cka at somethingawfuls forum hinted that someone should try compiling MMS (http://mms.sunsite.dk/) for PS3 since it seems kind of nice.
I gave it a shot and it worked just fine, so I might give a few hints on how to do this if you are interested.

Picture of it running (never mind the Swedish, it will use your own locales)
mms on ps3

I did this using debian on my PS3 so my guide will cover how to do this in debian, but it should work just fine on any distribution, however you will of course not be able to use the same packaging tool (apt-get) as debian-users.

Step 1: Install debian on your PS3.
This might need it’s own guide… I used the debian live cd/installer from http://www.keshi.org/moin/moin.cgi/PS3/Debian/Live . I’m extremely pleased with this and concider it much better than YDL or FC5 for PS3 use. Try to follow the instructions (use the expert install) and it should be ok.

Step 2: Install ps3utils
Download ps3utils on your ps3 Available here.
As root do

dpkg -i ps3pf-utils_1.0.9-1_powerpc.deb

Step 3: Setup correct resolution
Most of the stuff here needs root access so open a terminal and su to root.
Create a file called “ps3video” in /etc/init.d/
Write the following text to it

#!/bin/bash
ps3videomode -v 3

Replace the “3″ argument in ps3videomode with your tv’s resolution as quoted from here

DO NOT ADD THE LINES BELOW TO THE ps3video FILE. They are just for you to find out which number to use.

Video mode ID:
  0:automode
  YUV 60Hz  1:480i  2:480p  3:720p  4:1080i  5:1080p
  YUV 50Hz  6:576i  7:576p  8:720p  9:1080i 10:1080p
  RGB 60Hz 33:480i 34:480p 35:720p 36:1080i 37:1080p
  RGB 50Hz 38:576i 39:576p 40:720p 41:1080i 42:1080p
  VESA     11:WXGA 12:SXGA 13:WUXGA

  full screen mode: 

ps3videomode -v 4 configures your PS3 for 60Hz 1080i and so on. I have a 720p 60Hz tv so I use ps3videomode -v 3.

Then make your ps3video script executable by doing

chmod +x /etc/init.d/ps3video

Finally make this script run at start up

ln -s /etc/init.d/ps3video /etc/rc2.d/S09ps3video

Step 4: Setup audio
Open /etc/modules
Add “snd_ps3pf” at a new line at the bottom of the file
Restart your PS3

Step 5: Install dependencies for MMS
First install pygame. You don’t really need this but is also sets up all of SDL correctly and will make it possible for you to use my script for showing the resolutions to pick later.

As root:

apt-get update
apt-get install python-pygame

Then install the dependencies as descripted in the mms help wiki.

apt-get install libimlib2-dev libsdl1.2-dev autoconf bazaar build-essential libxine-dev mplayer-nogui
apt-get install w32codecs libtag1-dev libsqlite0-dev libpcre3-dev liblircclient-dev libtool gettext

To compile you also need the xorg development package.

apt-get install xorg-dev

Step 6: Install MMS
Make a folder to hold the source files, change directory to it and do

baz register-archive http://mms.sunsite.dk/archives/2005-mmsv2
baz get anders@gnulinux.dk--2005-mmsv2/mmsv2--mainline--1.0.8

cd into the newly created directory and then do

./configure
make
make install

If no errors occur then it should have been installed correctly!

Step 7: Configure MMS
Open up /etc/mms/config and change some stuff in it :)

1. Make sure that outdev under “Output devices” is set to “sdl”
2. Set audio_dir to your folder containing music
3. Set mov_dir to your folder containing videos
4. Set mplayeropts to “-fs -zoom -sws 0 -ao oss”
(This stands for fullscreen, zoom, no software scaling, OSS audio)
5. Set v_res and h_res to your full screen resolution. For ps3videomode -v 3 this is

v_res = 1124
h_res = 644

If you are unsure about what resolutions are supported you can download a small script I wrote to find out (pygame required).

wget buffis.com/ps3/resolutions.py
python resolutions.py

6. Make sure that fullscreen is set to “true”
(if you want full screen)

Step 8: Run MMS
Write “mms” in a terminal. Hopefully it should start.
Read how to use the application at the mms-wiki.
http://mms.kicks-ass.org/wiki/index.php/MMS_Basics

And now you are done!
The possibility of me forgetting something to write in this guide is rather high as I’m simply trying to backtrack my actions from earlier today. If anyone run into issues drop a comment and I’ll reply as fast as I can!

NHK on ps3

buffi Gaming, Gaming Software, Programming & scripting

Pygame apparently extremely easy to install on PS3 with Feodora Core 5

January 13th, 2007

Hehe, I went through all of the trouble of installing the dependencies for pygame in YDL when apparently pygame is in the repositories for Feodora Core 5 for PS3 :)
It doesn’t seem to be in the repositories for YDL (”yum search pygame” returns nothing) so I simply went ahead and installed everything from source.

I would recommend you to choose Feodora Core 5 instead of YDL I guess. Installing pygame there is apparently as simple as writing “yum install pygame” as root.

Thanks to Onken at somethingawful.com’s forums for telling me this.

buffi Programming & scripting, Python

Pygame works rather decent at ps3 :)

January 13th, 2007

Got my PS3 today. Decided to try and compile pygame for Yellow Dog Linux since well… it should work. It did :)

Compiling all of the dependencies and the pygame made it possible for me to run stuff at decent speed. Its not exactly fast, but absolutely fast enough to develop graphical user interfaces and small games.
Since python is such a high level language you are of course limited to a single SPE, which isn’t very nice, but well… it works :)
UPDATE: I wrote this line before actually reading anything about the functionality of the CELL. I obviously mean that you are limited to the PPE, and can’t access any SPE.

If people want me to I can write a guide for compiling pygame for PS3, but it’s pretty much the same as compiling it for any other platform… Simply install all dependencies for SDL, then SDL and SDL_mixer, SDL_image and so on and top it all of with pygame.

pygame test

buffi Gaming, Programming & scripting, Python

Fuck yeah!

January 12th, 2007

PS3!

Downloading Yellow Dog Linux as I write this…

buffi Uninteresting

Dealing with Internet Explorer 6 and png-transparency

January 10th, 2007

Internet Explorer 6 (and below) is evil, since it apparently doesn’t support png-transparency which means that my new pretty thumbnails looked like crap. After asking around a bit in #apache@freenode and browsing the mod_rewrite manual of apache I came up with a nice solution.

At my server i have a thumbs/ folder containing the thumbnails (in png format). I then made a new set of IE6 friendly thumbnails, that were uglier but at least didn’t look insanely weird like the messed up pngs. I chose to save these as jpgs for no real reason. Its probably smarter to use gif but IE6 users aren’t picky, if they were then they wouldn’t use IE6.

So in my thumbs/ folder I now have a double set of thumbs, with the same name except the extension.
I then added this to .htaccess in thumbs/

Options +FollowSymLinks
RewriteEngine On
RewriteCond  %{HTTP_USER_AGENT}  MSIE\\ [^7]
RewriteRule ^(.*)png$ /thumbs/$1jpg [R]

To explain, all users of Internet Explorer of a different version than 7 will have all png-files in the directory redirected to the jpg files. They will not be as pretty, but it’s a quite nice fix :)

All other solutions for png-transparency I’ve seen have been only for displaying them on your own page, but since I encourage hotlinking, that would not work here. This does so beautifully though :)

buffi Programming & scripting

Getting output of a system-call in python

January 9th, 2007

I was playing around a bit with os.system() in python trying to get the verbosed output and not the returnvalue into a variable.
I wanted to use identify from imagemagick and get the image information, but didn’t find much about how to do that until I ran into The subprocess module.

I didn’t even know that this existed in python, but that could just be me. Anyways, a fast way to get the verbosed output of a script/application:

import subprocess, os
command = "uptime"
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
os.waitpid(process.pid, 0)
output = process.stdout.read().strip()

Output now contains the output of the command, in this case:
“18:58:09 up 4 days, 17:24, 37 users, load average: 0.18, 0.25, 0.26″

buffi Programming & scripting, Python

New pretty thumbnails for pici

January 9th, 2007

Finally decided that php-gd was too much of a pain to deal with and installed imagemagick on my server.
The newly generated thumbnails for pici is really nice :)

Pictures below will look different in Internet Explorer 6 and below since it doesn’t allow png transparency

Im extremely pleased with this!

If anyone want the arguments for imagemagick for creating this then here they are. It’s really easy to modeify this and make a script to use this on a lot of pictures. I use python on my implementation at pici.se

convert \\
picture.jpg \\
-thumbnail 80x80 \\
-font /usr/share/fonts/truetype/freefont/FreeSerif.ttf \\
-pointsize 12 \\
-gravity South   -background white   -splice 0x18 \\
-draw "text 0,0 'resolution goes here'" \\
-bordercolor white  -border 3 \\
-bordercolor grey60 -border 1 \\
-background  none   -rotate 3 \\
-background  black  \\( +clone -shadow 50x4+4+4 \\) +swap \\
-background  none   -flatten \\
-depth 8  -quality 95 \\
thumbnail.png

Imagemagick is used for this

buffi Programming & scripting

Dead harddrive :(

January 2nd, 2007

My harddrive in my main computer died earlier today. Sucks a bit but I was able to save most of my data.

And this is the worst output from fsck I’ve ever seen.
I wonder what the hell I fixed.

buffi Uninteresting

pici.se updated

January 2nd, 2007

My imagehosting site pici.se has undergone several updates today. Some are visible, some are not.

The changelog so far is:

  • Improved readability and documentation of my code
  • Fixed it so that the image descriptions are showing correctly
  • Made email mandatory for registration
  • Made a box for confirmation of password when registering
  • Created a script for sending out new password by email in case of forgotten passwords
  • Increased security of users passwords by using double salted hashes instead of plain MD5.
  • Fixed a bug with the display order in the picture list and gallery
  • Improved the automated backup script

Next up on the todo list is private pictures, an uninstaller for picisend and the linux version of picisend (already finished).

buffi Programming & scripting