Skip to content

Instantly share code, notes, and snippets.

@xulapp
Created March 21, 2011 11:27
Show Gist options
  • Select an option

  • Save xulapp/879317 to your computer and use it in GitHub Desktop.

Select an option

Save xulapp/879317 to your computer and use it in GitHub Desktop.
ffmpeg installer
# coding: utf-8
import os
import re
import urllib
import locale
locale.setlocale(locale.LC_ALL, '')
pageurl = 'http://blog.k-tai-douga.com/'
re_fileurl = re.compile(r'(?<=")http://abechin\.sakura\.ne\.jp/sblo_files/k-tai-douga/ffmpeg/ffmpeg_bin_pentium4-\d+\.zip(?=")')
def progress(block_count, block_size, total_size):
per = 100 * block_count * block_size / total_size
print '%3d%% (total: %s)\r' % (per, locale.format('%d', total_size, True)),
def main():
page = urllib.urlopen(pageurl)
for line in page:
x = re_fileurl.search(line)
if x:
break
else:
print u'file url not found.'
return
fileurl = x.group()
print 'Downloading archive:', fileurl
filename, headers = urllib.urlretrieve(fileurl, reporthook=progress)
print
os.system('7z e -y -i!ffmpeg.exe "%s"' % filename)
urllib.urlcleanup()
print '\ndone'
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment