Skip to content

dwarflabs/pyseq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PySeq

Mon Mar 14 15:45:29 PDT 2011


1 Overview
~~~~~~~~~~

PySeq is a python module that finds groups of items that follow a naming convention containing a numerical sequence index (e.g. fileA.001.png, fileA.002.png, fileA.003.png...) and serializes them into a compressed sequence string representing the entire sequence (e.g. fileA.1-3.png). It should work regardless of where the numerical sequence index is embedded in the name. For examples, see basic usage below.

  * README	    this file
  * LICENSE	    the license under which pyseq is released
  * pyseq.py	pyseq python module
  * lss         a python script to be installed to /usr/local/bin
  * /tests   	example file sequences
  * /doc		html docs


2 Installation
~~~~~~~~~~~~~~

  % sudo easy_install pyseq


3 Basic Usage
~~~~~~~~~~~~~

Using the "z1" file sequence example in the "tests" directory:

	% ls tests/z1*
	tests/z1_001_v1.1.png	tests/z1_001_v1.4.png	tests/z1_002_v1.3.png	tests/z1_002_v2.2.png
	tests/z1_001_v1.2.png	tests/z1_002_v1.1.png	tests/z1_002_v1.4.png	tests/z1_002_v2.3.png
	tests/z1_001_v1.3.png	tests/z1_002_v1.2.png	tests/z1_002_v2.1.png	tests/z1_002_v2.4.png

	% lss tests/z1*
	   4 z1_001_v1.%d.png 1-4
	   4 z1_002_v1.%d.png 1-4
	   4 z1_002_v2.%d.png 1-4

	% lss tests/z1* -f "%h%r%t"
	z1_001_v1.1-4.png
	z1_002_v1.1-4.png
	z1_002_v2.1-4.png


3.1 API Examples
================

*Compression, or serialization, of lists of items*

	>>> s = Sequence(['file.0001.jpg', 'file.0002.jpg', 'file.0003.jpg'])
	>>> print s
	file.1-3.jpg
	>>> s.append('file.0006.jpg')
	>>> print s.format("%h%p%t %R")
	file.%04d.jpg 1-3 6
	>>> s.contains('file.0009.jpg')
	True
	>>> s.contains('file.0009.pic')
	False
	
*Uncompression, or deserialization, of compressed sequences strings*
	
	>>> s = uncompress('012_vb_110_v002.1-150.dpx', format="%h%r%t")
	>>> len(s)
	150
	>>> seq = uncompress('./tests/012_vb_110_v001.%04d.png 1-10', format='%h%p%t %r')
	>>> print seq.format('%04l %h%p%t %R')
	  10 012_vb_110_v001.%04d.png 1-10

About

Compressed sequence string module for Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%