30 lines
698 B
Python
Executable file
30 lines
698 B
Python
Executable file
#!/usr/bin/env python
|
|
#
|
|
# Retrieve the latest dvb-apps scan files
|
|
#
|
|
|
|
import os, sys, shutil, glob, urllib2, tarfile
|
|
|
|
url = 'http://linuxtv.org/hg/dvb-apps/archive/tip.tar.bz2'
|
|
tmp = '/tmp/getmuxlist.%d' % os.getpid()
|
|
out = os.path.abspath(os.path.dirname(sys.argv[0]) + '/../data/dvb-scan')
|
|
|
|
# Get files
|
|
if os.path.exists(tmp):
|
|
shutil.rmtree(tmp)
|
|
os.makedirs(tmp)
|
|
tbz = tmp + '/dvb-apps.tar.bz2'
|
|
open(tbz, 'w').write(urllib2.urlopen(url).read())
|
|
tp = tarfile.open(tbz)
|
|
tp.extractall(tmp)
|
|
|
|
# Copy to TVH
|
|
if os.path.exists(out):
|
|
shutil.rmtree(out)
|
|
os.makedirs(out)
|
|
for d in glob.glob('%s/dvb-apps*/util/scan/*' % tmp):
|
|
if os.path.isdir(d):
|
|
shutil.move(d, out)
|
|
|
|
# Cleanup
|
|
shutil.rmtree(tmp)
|