Skip to main content

ls-like command for image frame sequences

Project description

About lsseq

lsseq is a Unix/Linux command-line utility that lists directory contents (akin to /bin/ls) while condensing image sequences (or cache sequences) to one entry each and listing the sequence in a helpful way. Filenames that are part of sequences are assumed to be of the form:

    <descriptiveName>.<frameNum>.<imgExtension>

where <imgExtension> is drawn from a default list of image extensions or an environment variable that can be set to override the default list. (see lsseq --help and in particular --imgExt). Note that lsseq can also handle the case that the dot-separator between the <descriptiveName> and the <frameNum> is an underscore (see lsseq --help for --looseNumSeparator, -l).

lsseq can print the image sequence in a variety of formats useful for nuke, houdini or rv and can also print a glob pattern for use in the shell. It also has it's own native format which is nicer to read, and also used by another command-line tool called renumseq.

For example:

    $ ls
    aaa.097.tif  aaa.098.tif  aaa.100.tif  aaa.101.tif  aaa.102.tif  aaa.103.tif
    $ lsseq
    aaa.[097-103].tif m:[99]

What lsseq tells us here is that there is a sequence of tif files named aaa with frames 97 through 103 (three padded) and frame 99 is missing.

lsseq is designed to have the flavor of the unix/linux/osx ls command as much as possible. The idea is to make it easier on the user when switching back and forth between using lsseq and regular ls so that the look of the output as well as several command-line-arguments are the same (where possible and it makes sense).

Furthermore it was written to be as robust as possible. For example, it handles negative frames properly and has been extensively tested and used at several production studios. There is a regression test program included with the source here on github to help test any changes, additions, bug fixes etc.

Lastly some useful options have been added beyond what /bin/ls does that extend lsseq's capability.

For example:

    1$ ls -F
    aaa/  bbb/  ccc.0101.exr  nonImage.file

    2$ ls *
    ccc.0101.exr  nonImage.file

    aaa:
    aaa.097.tif  aaa.098.tif  aaa.100.tif  aaa.101.tif  aaa.102.tif  aaa.103.tif  nonImage_A.file

    bbb:
    bbx.0097.tif  bbx.0100.tif  bbx.0103.tif  bby.0199.tif  bby.0202.tif      nonImage_B2.file
    bbx.0098.tif  bbx.0101.tif  bby.0197.tif  bby.0200.tif  bby.0203.tif
    bbx.0099.tif  bbx.0102.tif  bby.0198.tif  bby.0201.tif  nonImage_B1.file

    3$ lsseq *
    nonImage.file
    ccc.[0101].exr

    aaa:
    nonImage_A.file
    aaa.[097-103].tif m:[99]

    bbb:
    nonImage_B1.file  nonImage_B2.file
    bbx.[0097-0103].tif
    bby.[0197-0203].tif

    4$ lsseq --prependPathRel *
    ccc.[0101].exr
    aaa/aaa.[097-103].tif m:[99]
    bbb/bbx.[0097-0103].tif
    bbb/bby.[0197-0203].tif

    5$ lsseq --prependPathAbs --skipMissing --format rv *
    /user/jrowellfx/test/ccc.0101.exr
    /user/jrowellfx/test/aaa/aaa.97-103@@@.tif
    /user/jrowellfx/test/bbb/bbx.97-103#.tif
    /user/jrowellfx/test/bbb/bby.197-203#.tif

The first thing to note above is how close lsseq is to mimicking /bin/ls in labelling directories and listing directory contents etc. (compare the output of command 2 to 3). One difference being that lsseq first lists all non-sequence images in a directory exactly as ls would list them (minus the sequences) then lists all the sequences in their condensed form.

Secondly note the two useful options in commands 4 and 5 above, --prependPathRel and --prependPathAbs which can be very useful when creating lists of sequences to pipe into other scripts.

It's recommended to review the capabilities of lsseq in how it can sort sequences, especially with respect to how it handles sorting by time. See lsseq --help for --time, -t and --onlyShow options.

Installing lsseq

    python3 -m pip install lsseq

I have written more helpful installation-information below in an addendum. You may find it helpful when trying to install this command on your system, be it Linux or macOS.

Testing lsseq

To test lsseq, cd into a directory containing frames from an image sequence then lsseq the contents of the directory.

If you don't have one handy you can try this to test it.

    $ cd ~
    $ mkdir tmp
    $ cd tmp
    $ touch aaa.001.tif aaa.002.tif aaa.003.tif aaa.004.tif aaa.005.tif
    $ lsseq
    aaa.[001-005].tif z:[1-5]

Note the z:[1-5] which is telling you that the frames aaa.[001-005].tif have zero length, and if you had generated those with a renderer I'm guessing you'd need to rerender them.

Type:

    $ lsseq --help

for much more useful info.

Addendum - more on installing command-line tools

Here's the process that I've followed to install lsseq, as well as my other python-based command-line tools (i.e., expandseq, condenseseq and renumseq) so that they are accessible to all users. This works on both macOS and Linux.

    $ su -
    # cd /usr/local
    # python3 -m venv venv
    # cd venv
    # source bin/activate
    # python3 -m pip install --upgrade pip
    # deactivate
    # bin/pip install lsseq
    # bin/pip install expandSeq
    # bin/pip install renumSeq
    # ln -s /usr/local/venv/bin/lsseq /usr/local/bin/lsseq
    # ln -s /usr/local/venv/bin/expandseq /usr/local/bin/expandseq
    # ln -s /usr/local/venv/bin/condenseseq /usr/local/bin/condenseseq
    # ln -s /usr/local/venv/bin/renumseq /usr/local/bin/renumseq
    # exit
    $ lsseq --version
    2.4.4

At this point any user should be able to run any of the commands linked in the example above. Note that updates are easy now too. Say there's an update to lsseq that you want to install.

    $ su -
    # cd /usr/local/venv
    # bin/pip install lsseq --upgrade
    # exit
    $ lsseq --version
    99.99.99

Just kidding about the version number, maybe in the year 2159? Will Unix still be a thing!?

Contact

Please contact j a m e s <at> a l p h a - e l e v e n . c o m with any bug reports, suggestions or praise as the case may be.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsseq-2.5.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

lsseq-2.5.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file lsseq-2.5.0.tar.gz.

File metadata

  • Download URL: lsseq-2.5.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9

File hashes

Hashes for lsseq-2.5.0.tar.gz
Algorithm Hash digest
SHA256 f2c16f1cbf7e99c4e9e9924696a6dc0c7a5448f866383529743a53df4d50a93c
MD5 6356efc6c6a35fc7a0ed9e9f29934a84
BLAKE2b-256 3e5684d22acf50a7891fb4f169ea978a01e6e5a570afbf8b7dd96a23316b3ff1

See more details on using hashes here.

File details

Details for the file lsseq-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: lsseq-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9

File hashes

Hashes for lsseq-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8f4f3a3063dd59e69d15c7a56e246f81c90ef95225d6fc0e39ae3b274c76fdd
MD5 8750eb2b71142623f248cc06ca2cb356
BLAKE2b-256 e4c9560e66546a4373b941226e2c115ebd93a84009ecf3020c470025b1e42ecc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page