How to use the fileseq.utils.asString function in Fileseq

To help you get started, we’ve selected a few Fileseq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github justinfx / fileseq / src / fileseq / filesequence.py View on Github external
if frame:
                seqs[key].add(frame)

        for (dirname, basename, ext), frames in iteritems(seqs):
            # build the FileSequence behind the scenes, rather than dupe work
            seq = FileSequence.__new__(FileSequence)
            seq._dir = dirname or ''
            seq._base = basename or ''
            seq._ext = ext or ''
            if frames:
                seq._frameSet = FrameSet(set(map(int, frames))) if frames else None
                seq._pad = FileSequence.getPaddingChars(min(map(len, frames)))
            else:
                seq._frameSet = None
                seq._pad = ''
            seq.__init__(utils.asString(seq))
            yield seq
github justinfx / fileseq / src / fileseq / filesequence.py View on Github external
def setDirname(self, dirname):
        """
        Set a new directory name for the sequence.

        Args:
            dirname (str): the new directory name
        """
        # Make sure the dirname always ends in
        # a path separator character
        dirname = utils.asString(dirname)
        sep = utils._getPathSep(dirname)
        if not dirname.endswith(sep):
            dirname = futils.native_str(dirname) + sep

        self._dir = dirname
github justinfx / fileseq / src / fileseq / filesequence.py View on Github external
def __str__(self):
        """
        String representation of this :class:`FileSequence`.

        Returns:
            str:
        """
        frameSet = utils.asString(self._frameSet or "")
        return "".join((
            self._dir,
            self._base,
            frameSet,
            self._pad if frameSet else "",
            self._ext))
github justinfx / fileseq / src / fileseq / filesequence.py View on Github external
Examples:
            >>> seq.frame(1)
            /foo/bar.0001.exr
            >>> seq.frame("#")
            /foo/bar.#.exr

        Args:
            frame (int or str): the desired frame number or a char to pass
                through (ie. #)

        Returns:
            str:
        """
        try:
            zframe = utils.asString(int(frame)).zfill(self._zfill)
        except ValueError:
            zframe = frame

        # There may have been no placeholder for frame IDs in
        # the sequence, in which case we don't want to insert
        # a frame ID

        if self._zfill == 0:
            zframe = ""

        return futils.native_str("".join((self._dir, self._base, zframe, self._ext)))
github justinfx / fileseq / src / fileseq / filesequence.py View on Github external
def setBasename(self, base):
        """
        Set a new basename for the sequence.

        Args:
            base (str): the new base name
        """
        self._base = utils.asString(base)