Exemple #1
0
int gw_image (SPOTIFYSESSION * s, char *id_as_hex)
{
	unsigned char id[20];

	s->output = buf_new ();
	s->output_len = 0;

	hex_ascii_to_bytes (id_as_hex, id, 20);

	return cmd_request_image (s->session, id, gw_image_result_callback,
				  (void *) s);
}
int osfy_image_process_request(sp_session *session, struct request *req) {
    struct image_ctx *image_ctx = *(struct image_ctx **)req->input;

    /*
     * Prevent request from happening again.
     * If there's an error the channel callback will reset the timeout
     *
     */
    req->next_timeout = INT_MAX;
    req->state = REQ_STATE_RUNNING;

    image_ctx->req = req;

    {
        char buf[41];
        hex_bytes_to_ascii(image_ctx->image->id, buf, 20);
        DSFYDEBUG("Sending request for image '%s'\n", buf);
    }

    assert(image_ctx->image->data == NULL);
    image_ctx->image->data = buf_new();

    return cmd_request_image(session, image_ctx->image->id, osfy_image_callback, image_ctx);
}