Exemplo n.º 1
0
    if flv:
      flvurl = flv.group(1)
      #download the file
      file_path = (flvurl.rsplit('/',1))[1]
      print page[1] + '   ' + flvurl
      if options.dry_run:
        continue
      flvurl = urllib.quote_plus(flvurl, safe=':/')
      d = Download(flvurl, options.destination)
      d.start()

      while 1:
        try:
          progress = d.progress['percent']
          print("%.2f percent | %.2f of %.2f" % (progress, d.progress['downloaded'], d.progress['total']))
          if progress == 100:
            print("")
            print("Download complete: %s" % d.filename)
            break
          time.sleep(10)

        # tell thread to terminate on keyboard interrupt,
        # otherwise the process has to be killed manually
        except KeyboardInterrupt:
          d.cancel()
          break

        except:
          raise