Пример #1
0
def reorganize(info, stream, moviefiles, range_str='-',
               loop=True, seekbar=True,
               step=1, kfinterval=0, 
               mp3seek=True, mp3skip=0,
               debug=0):
  movie = MovieContainer(info)
  for fname in moviefiles:
    if fname.endswith('.swf'):
      # vnc2swf file
      movie.parse_vnc2swf(fname, True, debug=debug)
    elif fname.endswith('.flv'):
      # flv file
      movie.parse_flv(fname, True, debug=debug)
    elif fname.endswith('.vnc'):
      # vncrec file
      movie.parse_vncrec(fname, debug=debug)
    else:
      raise ValueError('unsupported format: %r' % fname)
  r = range2list(range_str, 0, movie.nframes-1, step)
  if movie.info.mp3:
    if isinstance(mp3skip, float):
      mp3skip = int(mp3skip * movie.info.mp3.sample_rate)
    movie.info.mp3.set_initial_skip(mp3skip)
  builder = MovieBuilder(movie, stream, mp3seek=mp3seek, kfinterval=kfinterval, debug=debug)
  builder.build(r)
  stream.close()
  movie.info.write_html(seekbar=seekbar, loop=loop)
  return 0
Пример #2
0
def play(moviefiles, info, debug=0):
    movie = MovieContainer(info)
    for fname in moviefiles:
        if fname.endswith('.swf'):
            # vnc2swf file
            movie.parse_vnc2swf(fname, True, debug=debug)
        elif fname.endswith('.flv'):
            # flv file
            movie.parse_flv(fname, True, debug=debug)
        elif fname.endswith('.vnc'):
            # vncrec file
            movie.parse_vncrec(fname, debug=debug, outtype="vnc")
        elif fname.endswith('.novnc'):
            # vncrec file
            movie.parse_vncrec(fname, debug=debug, outtype="novnc")
        else:
            raise ValueError('unsupported format: %r' % fname)
        info.filename = os.path.basename(fname)
    PygameMoviePlayer(movie, debug=debug).play()
    return
Пример #3
0
def play(moviefiles, info, debug=0):
    movie = MovieContainer(info)
    for fname in moviefiles:
        if fname.endswith(".swf"):
            # vnc2swf file
            movie.parse_vnc2swf(fname, True, debug=debug)
        elif fname.endswith(".flv"):
            # flv file
            movie.parse_flv(fname, True, debug=debug)
        elif fname.endswith(".vnc"):
            # vncrec file
            movie.parse_vncrec(fname, debug=debug)
        else:
            raise ValueError("unsupported format: %r" % fname)
        info.filename = os.path.basename(fname)
    PygameMoviePlayer(movie, debug=debug).play()
    return
Пример #4
0
def play(fnames, framerate=12):
    info = SWFInfo()
    info.framerate = framerate
    movie = MovieContainer(info)
    for fname in fnames:
        print 'Reading:', fname
        if fname.endswith('.swf'):
            # vnc2swf file
            movie.parse_vnc2swf(fname)
        elif fname.endswith('.vnc'):
            # vncrec file
            movie.parse_vncrec(fname)
    player = PygameMoviePlayer(movie)
    player.play()
    return
Пример #5
0
def reorganize(info, moviefiles,
               range_str='-', step=1,
               is_video=False, kfinterval=0, 
               mp3seek=True, mp3skip=0):
  movie = MovieContainer(info)
  if is_video:
    stream = SWFVideoStream(info)
  else:
    stream = SWFShapeStream(info)
  for fname in moviefiles:
    if fname.endswith('.swf'):
      # vnc2swf file
      movie.parse_vnc2swf(fname, True)
    elif fname.endswith('.vnc'):
      # vncrec file
      movie.parse_vncrec(fname)
  r = range2list(range_str, 0, movie.nframes-1, step)
  if movie.info.mp3:
    movie.info.mp3.set_initial_skip(mp3skip)
  builder = MovieBuilder(movie, stream, mp3seek=mp3seek, kfinterval=kfinterval)
  builder.build(r)
  info.generate_html()
  return