Shrub / Amazon S3 Proxy

Enter in a bucket name



What?

Shrub lists files in public S3 buckets. For when you want to share a bucket with the world.


How?

  1. Create a bucket. Make it publicly readable.
  2. Point people at your bucket: http://shrub.appspot.com/bucket-name
  3. Make sure files in the bucket are publicly readable (if you want people to be able to access them).

For example, I keep my S3Hub builds in a s3hub bucket thats publicly readable, so it can be accessed at: http://shrub.appspot.com/s3hub.


Questions?

Visit the google group: shrub-gae


Source

Shrub is open source. You can find it at github: gabriel/shrub


URL parameters

These parameters are available to all requests.

Parameter Description Accepted Default Example
format Response format rss
json
id3-json
xspf
tape
None (HTML) http://shrub.appspot.com/s3hub?format=rss
delimiter See S3 docs Passed to S3 / http://shrub.appspot.com/s3hub?delimiter=
prefix See S3 docs Passed to S3 http://shrub.appspot.com/s3hub?prefix=S3Hub-0.5.2
marker See S3 docs Passed to S3 http://shrub.appspot.com/s3hub/?marker=S3Hub-0.5.12-special3.dmg&max-keys=10
max-keys See S3 docs Passed to S3 http://shrub.appspot.com/s3hub?max-keys=5

See below for more info.


RSS

Generate an RSS 2.0 feed with format=rss URL parameter.
For example, http://shrub.appspot.com/s3hub?format=rss.
See limitations below.


JSON

Get list bucket response in JSON format with format=json URL parameter.
For example, http://shrub.appspot.com/s3hub?format=json
See limitations below.

{"maxKeys": "1000", 
 "prefix": "", 
 "commonPrefixes": [], 
 "isTrucated": false, 
 "contents": [
     {"etag": "\"ee8a4f9c22e98b6dfb1781650eaffe01\"", 
      "storageClass": "STANDARD", 
      "key": "S3Hub-0.5.1.dmg", 
      "lastModified": 1213991757, 
      "bucket": "s3hub", 
      "size": 2635399}, 
     {"etag": "\"cb8d95164e9696823f7b01b306840896\"", 
      "storageClass": "STANDARD", 
      "key": "S3Hub-0.5.10.dmg", 
      "lastModified": 1213991757, 
      "bucket": "s3hub", 
      "size": 2779097}, ...

URL parameters

Parameter Description Accepted Default
callback Callback function name to use in response Callback function names may only use upper and lowercase alphabetic characters (A-Z, a-z), numbers (0-9), the period (.), the underscore (_)


Example of http://shrub.appspot.com/s3hub?format=json&callback=myCallback:


myCallback({"maxKeys": "1000", "prefix": "", ...})

ID3

Lookup ID3 information (returned as JSON) for an MP3 with format=id3-json URL parameter.
For example, http://shrub.appspot.com/m1xes/sub-pop-mix-1/01-Dntel-The_Distance_(ft._Arthur%26Yu).mp3?format=id3-json

{ "album": "Dumb Luck",
  "performer": "Dntel",
  "title": "The Distance (Ft. Arthur & Yu)",
  "track": "5/9",
  "year": null,
  "isTruncated": false }

Currently, Shrub will only get the first 1024 bytes of the mp3 (using the Range: bytes=0-1024 header) and will parse as much ID3 tag information as it can. ID3 tag information should be in the beginning of the file (so ID3v1 is not supported). If there was more information after the first 1024 bytes, then the isTruncated will be true. ID3 info is cached for 5 minutes.


This request accepts JSON url parameters (like callback). See JSON section for more info.


XSPF

Generate an XSPF playlist of media files in a bucket or folder with format=xspf URL parameter.
For example, http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=xspf


URL parameters

Parameter Description
exts List of extensions to filter (comma-delimited). For example, exts=mp3,foo,bar


<playlist version="0">
  <title>m1xes/sub-pop-mix-1</title>
  <creator>Shrub</creator>
  <info>http://shrub.appspot.com</info>
  <location>http://s3.amazonaws.com/m1xes?delimiter=%2F&prefix=sub-pop-mix-1%2F</location>
  <trackList>
    <track>
      <location>http://s3.amazonaws.com/m1xes/sub-pop-mix-1%2F01-Dntel-The_Distance_%28ft._Arthur%26Yu%29.mp3</location>
      <meta rel="type">mp3</meta>
      <title>01-Dntel-The_Distance_(ft._Arthur&Yu)</title>
    </track>
    <track>
      <location>http://s3.amazonaws.com/m1xes/sub-pop-mix-1%2F02-No_Age-Eraser.mp3</location>
      <meta rel="type">mp3</meta>
      <title>02-No_Age-Eraser</title>
    </track>
    ...
	

Embeddable music player

Embed an xspf music player, pointing to an XSPF format. For example:
http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=xspf



XSPF Slim Player

You need Javascript enabled and/or a recent version of Flash for the XSPF Slim Player to work.

XSPF Player

You need Javascript enabled and/or a recent version of Flash for the XSPF player to work.

Object embed example

<object id="xspf-slim-player" class="xspf-slim-player" 
  width="400" height="15" 
  type="application/x-shockwave-flash" 
  name="xspf-slim-player" 
  data="/shrub/swf/xspf_player_slim.swf?playlist_url=http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=xspf">

  <param name="allowscriptaccess" value="always"/>
</object>

SWFObject embed example

var loadXspfSlimPlayer = function() {
  var xspfUrl = "http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=xspf";
  var flashvars = { };
  var params = { allowscriptaccess: "always" };
  var attributes = { id: "xspf-slim-player", name: "xspf-slim-player", styleclass:"xspf-slim-player" };

  swfobject.embedSWF('/shrub/swf/xspf_player_slim.swf?playlist_url=' + encodeURI(xspfUrl), "xspf-slim-player", "400", "15", "8.0.0", false, flashvars, params, attributes);
};

$(document).ready(loadXspfSlimPlayer);

Crossdomain

There is a crossdomain.xml, so you can use URLs from flash. For example, an XSPF Music Player.


*Tape

Present bucket or directory as a tape (like MuxTape/OpenTape, etc) with format=tape URL parameter.
For example, http://shrub.appspot.com/m1xes/sub-pop-mix-1/?format=tape
Currently only supports mp3's. Track information is displayed using ID3v2 info (see above).


Sub-directories

By default, Shrub uses a delimiter of / to simulate sub-directories.
For example, http://shrub.appspot.com/s3hub/Images/ only shows the files in the s3hub bucket with the Images/ prefix.


To override, specify an empty delimiter, for example: http://shrub.appspot.com/s3hub/?delimiter=.


Limitations

Shrub will only access the first 1000 entries of a bucket (and will show a warning if you go over). If there are more than 1000 entries in an RSS feed, it will return a 501 error.


Shrub/1.2.16 © 2008 — rel.me (Gabriel Handford) — Shrub is open source

Amazon is a registered trademark of Amazon.com, Inc. or its subsidiaries in the U.S. and/or other countries.