1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-16 03:48:44 +00:00
This commit is contained in:
kev 2015-07-13 01:46:37 +08:00
parent 7c73585c86
commit 6ec51642c7
2 changed files with 21 additions and 7 deletions

@ -34,7 +34,7 @@ $ docker-compose up -d
$ docker-compose logs
Attaching to youtube_worker_1
worker_1 | 2015-07-12T16:07:07 [INFO] connect redis
worker_1 | 2015-07-12T16:07:26 [INFO] process: https://www.youtube.com/watch?v=os6U77Hhm_s
worker_1 | 2015-07-12T16:07:26 [INFO] process: os6U77Hhm_s
worker_1 | [youtube] os6U77Hhm_s: Downloading webpage
worker_1 | [youtube] os6U77Hhm_s: Downloading video info webpage
worker_1 | [youtube] os6U77Hhm_s: Extracting video information
@ -42,14 +42,28 @@ worker_1 | [youtube] os6U77Hhm_s: Downloading DASH manifest
worker_1 | [youtube] os6U77Hhm_s: Downloading DASH manifest
worker_1 | [download] Destination: Shia LaBeouf TED Talk-os6U77Hhm_s.mp4
[download] 100% of 11.03MiB in 00:0297MiB/s ETA 00:00known ETA
worker_1 | 2015-07-12T16:07:28 [INFO] success: True
```
## client
```
$ redis-cli -h server -a 'secret-passwd'
server> lpush urls 'https://www.youtube.com/watch?v=os6U77Hhm_s'
server> lpush urls os6U77Hhm_s
server> keys *
1) "pending"
server> keys *
1) "running"
server> keys *
1) "finished"
server> quit
$ rsync -ahP user@server:fig/youtube/data ~/Movies/youtube
$ rsync -ahP user@server:fig/youtube/data
receiving file list ...
2 files to consider
drwxr-xr-x 74 2015/07/13 00:52:25 data
-rw-r--r-- 0 2015/07/13 01:04:40 data/Shia LaBeouf TED Talk-os6U77Hhm_s.mp4
sent 16 bytes received 116 bytes 29.33 bytes/sec
total size is 0 speedup is 0.00
```

@ -14,17 +14,17 @@ def download(url):
def hook(info):
time = int(time.time())
now = int(time.time())
status = info['status']
if status == 'downloading':
rdb.zadd('running', time, url)
rdb.zadd('running', now, url)
elif info['status'] == 'error':
rdb.zrem('running', url)
rdb.zadd('error', time, url)
rdb.zadd('error', now, url)
elif status == 'finished':
rdb.zrem('running', url)
rdb.zadd('finished', time, url)
rdb.zadd('finished', now, url)
if rdb.zrank('finished', url) != None:
return False