25 May, 2007

You are currently browsing the daily archive for 25 May, 2007.

Wireless Project 02: GCD Generator

What I would like to do one day soon is to write an indexing script in PHP, but it’s not as simple as I’m making it sound.

Instead of your classic “Here’s what’s in the directory, regurgitated onto your lap for your convenience” setup, I need it to do three special things.

The first one is that it needs to read subdirectories, and present them to users in a list, be it ordered or unordered.
For example, I have three folders: Movies, Wallpaper, Ringers.
The script would sit in the folder where those three folders sit. It would look in each folder, and for each file it found, it would generate a General Content Descriptor file, usable by Sprint phones, and dynamically served on request.
I’m thinking that to generate the proper mimetypes for the GCD, I’d start by looking at the extension on the file. To generate the content name, I’d look at the filenames, which should all be formatted in such a way that a separator won’t affect the file, but will make it easier to build the content, eg: ‘P_moss–Xial.jpg’, content name = “Xial”, content vendor = “P_moss”, version will always be 1.0.

I’ve sort of brushed on the second part of what I want it to do: Generate those General Content Descriptors. I’d like to do this cleanly, without actually spitting files onto the system, but instead, serve the file dynamically in some method. Hopefully this will be easy to do.

The third thing the script should do is be capable of serving the content both as a wireless markup language (WML) page, and as a normal HTML or XHTML page, depending on what the browser asks for. I do think this part would be a bit tricky, but in most cases, the browser requesting the page would be a WAP browser. I think that if I were to sniff the browser and see whether it announces it can handle HTML or XHTML, rather than sniffing to see if it supports WML, this would work. If it doesn’t say it can handle HTML or XHTML, I serve the watered down WML pages. If it announces HTML, then we get HTML and perhaps extra features.

I would need to learn WML first, however, and I’d need to relearn PHP, since I’ve just about forgotten it.
I need to find out what part of the browser to sniff to find out if it supports HTML or better, as well. I know that it can be done in PHP, since I did it once to serve XHTML 1.1 a long time ago, and water it down enough for Internet Explorer to actually view a page.

I don’t know if a project like this would benefit from database access. I somewhat doubt this, but if it does need one, I don’t want to require MySQL to be installed. I’d like something else that’s very light and can be used on any operating system.

For those of you who speak PHP, would an idea like what I’m considering even be doable, or do I need to change my angle of attack somewhat?

[tags]Sprint, GCD, WAP, WML, PHP, HTML, Content Delivery[/tags]

Tags: ,

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States