Example #1
0
def makeMov(frames, **kwargs):
    """
    Makes a movie file from a frame sequence.

    :param sequences: rvio-compatible file sequence string

    :param kwargs: Supported kwargs

        show         shotgun show name
        shot         shotgun shot code
        task         shotgun task name
        version      version or pts number*
        width        width of mov to resize [0 (same as input)]
        quality      compression quality 0 to 1.0 [0.95]
        outfile      output movie file path
        dailies      submit this movie to shotgun (bool)*
        comment      slate comment and take description
        frameBurn    burn frame numbers into frames (bool)

    * If dailies is true, all kwargs get passed to makeTake.
    * If version is None, a version number will be auto generated.

    :return: path to generated movie file
    """
    _in = frames
    _out = kwargs.get('outfile', config.DAILIES_MOVIE_PATH % kwargs)

    # slate settings
    _show = kwargs.get('show', None)
    _shot = kwargs.get('shot', None)
    _task = kwargs.get('task', None)
    _slate = kwargs.get('slate', False)
    _user = kwargs.get('user', os.environ.get('USER'))
    _date = time.strftime('%a %b %e, %Y %l:%M%P')
    _comment = kwargs.get('comment', '')

    # rvio settings
    _width = kwargs.get('width', config.RV_WIDTH)
    _height = kwargs.get('height', None)
    _crop = kwargs.get('crop', None)
    _resize = kwargs.get('resize', None)
    _quality = kwargs.get('quality', config.RV_QUALITY)
    _frameBurn = kwargs.get('frameBurn', False)
    _dryRun = kwargs.get('dryRun', False)

    # rvio options strings
    perSeqOpts = []
    optionStrings = config.RV_RVIO_OPT[:]

    # scale / resize / crop
    if _height:
        optionStrings.append('-outres %d %d' %(_width, _height))
    else:
        optionStrings.append('-resize %d' % _width)

    if _resize and type(_resize) in (list, tuple):
        optionStrings.append('-resize "%d %d"' %(_resize[0], _resize[1]))

    if _crop and type(_crop) in (list, tuple):
        perSeqOpts.append('-crop %d %d %d %d' %(_crop[0], _crop[1], _crop[2], _crop[3]))

    # quality
    optionStrings.append('-quality %s' % _quality)
    optionStrings.append('-v')

    # rvio slate options
    if _slate:
        slateArgs = ['-leader', 'simpleslate', config.RV_SLATE_TITLE, ]
        slateArgs.append('"Show=%s"' % _show)
        slateArgs.append('"Shot=%s"' % _shot)
        slateArgs.append('"Task=%s"' % _task)
        slateArgs.append('"Date=%s"' % _date)
        slateArgs.append('"User=%s"' % _user)
        slateArgs.append('"Source=%s"' % _in)
        slateArgs.append('"Comments=%s"' % _comment)
        optionStrings.extend(slateArgs)

        if _frameBurn:
            optionStrings.extend(['-overlay', 'frameburn', '0.5', '0.5', '20.0', ])

    # the command string
    cmd = "%s [ %s %s ] %s -o %s" % (config.RV_RVIO_PATH, _in, ' '.join(perSeqOpts), ' '.join(optionStrings), _out)
    log.debug('cmd: %s' % cmd)

    # check to make sure base dir exists
    _basedir = os.path.dirname(_out)
    if not os.path.isdir(_basedir):
        try:
            os.makedirs(_basedir)
        except EnvironmentError, e:
            log.error(traceback.format_exc())
            if not os.path.exists(_basedir):
                return
Example #2
0
 def handleThumbError(self, error):
     log.error('Error processing thumb: %s' % error)