コード例 #1
0
ファイル: edit.py プロジェクト: GunioRobot/castro
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
ファイル: play.py プロジェクト: sh0ked/castro
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
ファイル: play.py プロジェクト: zu1kbackup/Canvas
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
ファイル: edit.py プロジェクト: zu1kbackup/Canvas
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