跳转到主要内容

基于Tornado和Redis的完整异步docsplit预览服务器

项目描述

简介

我们正在努力寻找最佳预览媒体服务器的解决方案。

情况很简单,我们有PDF文件,我们想要预览它们(小、中、大、标题)。

我们首先从Insight开始,它允许人们从一个带有缓存的URL请求同步和异步预览生成。

该系统能够注册引擎,以便我们可以在流中操作文档。

Insight-Reloaded的想法是移除同步模式,并将其委托给Nginx和磁盘或S3存储。

如果文档预览未准备好,我们想要一个404错误。

我们将通过回调获取文档预览URL。

API

简单示例

curl -X GET "http://localhost:8888/?url=http://my_file_url.com/file.pdf&callback=http://requestb.in/12vsewg"
{"insight_reloaded": "Job added to queue.", "number_in_queue": 14}

curl -X GET http://localhost:8888/status
{"insight_reloaded": "There is 14 job in the queue.", "number_in_queue": 14}

curl -X GET http://localhost:8888/
{"version": "1.5", "insight_reloaded": "Bonjour", "name": "insight-reloaded"}

多队列示例

您必须在您的settings.py中配置REDIS_QUEUE_KEYS

REDIS_QUEUE_KEYS = ['urgent', 'normal']
DEFAULT_REDIS_QUEUE_KEY = 'normal'

然后您可以使用

curl -X GET "http://localhost:8888/urgent?url=http://my_file_url.com/file.pdf&callback=http://requestb.in/12vsewg"
{"insight_reloaded": "Job added to queue 'normal'.", "number_in_queue": 14}

curl -X GET http://localhost:8888/urgent/status
{"insight_reloaded": "There is 14 job in the 'urgent' queue.", "number_in_queue": 14}

curl -X GET http://localhost:8888/
{"version": "1.5", "insight_reloaded": "Bonjour", "name": "insight-reloaded"}

设置散列

默认情况下,Insight使用URL(sha1(url))计算预览散列。如果您愿意,您也可以在请求中发送它,确保每个预览都有一个唯一的散列。

curl -X GET "http://localhost:8888/?url=http://my_file_url.com/file.pdf&callback=http://requestb.in/12vsewg?hash=123456789"
{"insight_reloaded": "Job added to queue.", "number_in_queue": 14}

服务架构

https://raw.github.com/novapost/insight-reloaded/master/docs/_static/InsightReloaded.png

服务器配置

您可以在以下位置找到insight-reloaded chef cookbooks: https://github.com/novapost/insight-installer

这将帮助您安装运行insight-reloaded服务器所需的所有要求。

运行测试

make test

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

insight_reloaded-1.6.6.zip (39.9 kB 查看哈希值)

上传时间 源代码

由以下支持