tooxie / shiva-server

A RESTful API to your music collection
http://shiva.readthedocs.org/en/latest/intro.html
MIT License
556 stars 51 forks source link

Add `needs_convertion` field to `track.files` #157

Closed tooxie closed 9 years ago

tooxie commented 9 years ago

This is the current format:

{
    "id": 510,
    "uri": "/track/510",
    "files": {
        "audio/mp3": "http://localhost:8080/nofx-pump_up_the_valuum/04. Dinosaurs Will Die.mp3",
        "audio/ogg": "/track/510/convert?mimetype=audio%2Fogg"
    }
}

Turn it into:

{
    "id": 510,
    "uri": "/track/510",
    "files": {
        "audio/mp3": {
            "needs_conversion": false,
            "uri": "http://localhost:8080/nofx-pump_up_the_valuum/04. Dinosaurs Will Die.mp3"
        },
        "audio/ogg": {
            "needs_conversion": true,
            "uri": "/track/510/convert?mimetype=audio%2Fogg"
        }
    }
}

This will give clients an explicit way of knowing if the file needs to be converted before being delivered, and display according feedback to the user while she waits.

Also think if needs_convertion is the most appropriate name for this attribute.