#! /usr/bin/python # A very simple external downloader # Copyright 2011-2012 Zdenek Pavlas # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., # 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA import time, os, errno, sys from urlgrabber.grabber import \ _readlines, URLGrabberOptions, _loads, \ PyCurlFileObject, URLGrabError def write(fmt, *arg): try: os.write(1, fmt % arg) except OSError, e: if e.args[0] != errno.EPIPE: raise sys.exit(1) class ProxyProgress: def start(self, *d1, **d2): self.next_update = 0 def update(self, _amount_read): t = time.time() if t < self.next_update: return self.next_update = t + 0.31 write('%d %d\n', self._id, _amount_read) def main(): import signal signal.signal(signal.SIGINT, lambda n, f: sys.exit(1)) cnt = 0 while True: lines = _readlines(0) if not lines: break for line in lines: cnt += 1 opts = URLGrabberOptions() opts._id = cnt for k in line.split(' '): k, v = k.split('=', 1) setattr(opts, k, _loads(v)) if opts.progress_obj: opts.progress_obj = ProxyProgress() opts.progress_obj._id = cnt dlsz = dltm = 0 try: fo = PyCurlFileObject(opts.url, opts.filename, opts) fo._do_grab() fo.fo.close() size = fo._amount_read if fo._tm_last: dlsz = fo._tm_last[0] - fo._tm_first[0] dltm = fo._tm_last[1] - fo._tm_first[1] ug_err = 'OK' except URLGrabError, e: size = 0 ug_err = '%d %d %s' % (e.errno, getattr(e, 'code', 0), e.strerror) write('%d %d %d %.3f %s\n', opts._id, size, dlsz, dltm, ug_err) if __name__ == '__main__': main()
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
awk | Folder | 0755 |
|
|
coreutils | Folder | 0755 |
|
|
dbus-1 | Folder | 0755 |
|
|
dovecot | Folder | 0755 |
|
|
gcc | Folder | 0755 |
|
|
getconf | Folder | 0755 |
|
|
git-core | Folder | 0755 |
|
|
grubby | Folder | 0755 |
|
|
imunify-notifier | Folder | 0755 |
|
|
initscripts | Folder | 0755 |
|
|
kcare | Folder | 0755 |
|
|
linux-boot-probes | Folder | 0755 |
|
|
man-db | Folder | 0755 |
|
|
microcode_ctl | Folder | 0755 |
|
|
openldap | Folder | 0755 |
|
|
openssh | Folder | 0755 |
|
|
os-probes | Folder | 0755 |
|
|
p11-kit | Folder | 0755 |
|
|
plymouth | Folder | 0755 |
|
|
selinux | Folder | 0755 |
|
|
smartmontools | Folder | 0755 |
|
|
sudo | Folder | 0755 |
|
|
tuned | Folder | 0755 |
|
|
utempter | Folder | 0755 |
|
|
chrony-helper | File | 6.37 KB | 0755 |
|
ebtables | File | 1.66 KB | 0755 |
|
exim.daemon | File | 758 B | 0755 |
|
gam_server | File | 90.73 KB | 0755 |
|
generate-rndc-key.sh | File | 546 B | 0755 |
|
glib-pacrunner | File | 15.73 KB | 0755 |
|
gnupg-pcsc-wrapper | File | 19.3 KB | 0755 |
|
gpg-check-pattern | File | 102.95 KB | 0755 |
|
gpg-preset-passphrase | File | 86.39 KB | 0755 |
|
gpg-protect-tool | File | 185.57 KB | 0755 |
|
gpg2keys_curl | File | 44.81 KB | 0755 |
|
gpg2keys_finger | File | 61.34 KB | 0755 |
|
gpg2keys_hkp | File | 53 KB | 0755 |
|
gpg2keys_ldap | File | 61.02 KB | 0755 |
|
grepconf.sh | File | 253 B | 0755 |
|
mlx4-setup.sh | File | 2.48 KB | 0755 |
|
newns | File | 7.03 KB | 0755 |
|
nm-dhcp-helper | File | 15.12 KB | 0755 |
|
nm-dispatcher | File | 47.7 KB | 0755 |
|
nm-iface-helper | File | 839.36 KB | 0755 |
|
nm-ifdown | File | 155 B | 0755 |
|
nm-ifup | File | 153 B | 0755 |
|
platform-python | File | 6.98 KB | 0755 |
|
rdma-init-kernel | File | 5.59 KB | 0755 |
|
rdma-set-sriov-vf | File | 3.05 KB | 0755 |
|
report-command-error | File | 7.29 MB | 0755 |
|
run-with-intensity | File | 9.14 MB | 0755 |
|
tcawmgr.cgi | File | 19.56 KB | 0755 |
|
truescale-serdes.cmds | File | 8.5 KB | 0755 |
|
urlgrabber-ext-down | File | 2.54 KB | 0755 |
|
virt-what-cpuid-helper | File | 7.02 KB | 0755 |
|