zoomhub/zoomhub — pull request #45 by aseemk (2014-10-07 05:41:08+00:00)
Title: File-based data store & Content class overhaul

Fixes #3. @gasi @iangilman @nein09: PTAL!

We don't have any staging server today, and this isn't deployed to production, so the only way to test at the moment is to pull this branch and load up the sample data yourself. (See instructions in diff.)

You can also re-enable `ALLOW_NEW_CONTENT`, and things should work.

With this PR, our API responses *for existing data* are identical to Zoom.it's. E.g. http://localhost:8000/v1/content/1000 and http://api.zoom.it/v1/content/1000 both return this for me:

```json
{
"id": "1000",
"url": "http://fc08.deviantart.net/fs32/f/2008/235/6/d/New_York_Subway_map_by_tomasNY.jpg",
"ready": true,
"failed": false,
"progress": 1,
"shareUrl": "http://localhost:8000/1000",
"embedHtml": "",
"dzi": {
"url": "http://localhost:8000/static/dzi/1000.dzi",
"width": 9153,
"height": 9147,
"tileSize": 254,
"tileOverlap": 1,
"tileFormat": "jpg"
}
}
```

There's currently a bug where *new data* adds a `ready` property *within* the `dzi` object, because we added that to `DZIParser`. On the flip side, this PR implements the full DZI properties that were missing, so now that we have those, we don't need that `ready` within `dzi`. And in fact, we don't need to fetch and parse the DZI XML at read-time anymore either. (That also means we no longer need CORS on CloudFiles!) I'll work on these things after this PR.

The production server does have all of the Zoom.it data @iangilman generated. I just need to run the `normalize-data` script from this PR on it. I haven't done that yet, but will do so tomorrow.

Okay, lemme know if you have any q's!