Commit 3a44cbc1 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team

server/gunzip-sequences.py: unzip '.gz' sequence files and fool the DB.

This may be a temporary hack.
parent d7190333
import sys
import glob
import os
from subprocess import Popen, PIPE, STDOUT
UPLOADS = '/mnt/upload/uploads/'
for f in glob.glob(UPLOADS + '/*.gz'):
print "<==", f
### Quick check
cmd = 'gunzip -l "%s"' % f
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) #STDOUT, stderr=STDOUT, close_fds=True)
(stdoutdata, stderrdata) = p.communicate()
if 'not in gzip format' in stderrdata:
print stderrdata
continue
### Unzip, then link to original name to fool the DB
f_base = f.replace('.gz', '')
cmd = 'gunzip "%s" ; ln -s "%s" "%s"' % (f, f_base, f)
print cmd
os.system(cmd)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment