Re: [cgkit-user] Sequences - Pattern for equal name
Brought to you by:
mbaas
|
From: Matthias B. <mat...@gm...> - 2009-12-17 22:48:42
|
Hi Ygor, > I tried to use the dstName pointing to a destination dir, and it > works like a charm for most cases. Unfortunately, Im getting errors > from the OutputNameGenerator when instancing to the CopySequence > class for certain sequence names. In this case > 'shot001_v01_YGO.#.tif', which is a very common name pattern that I > generally use for outputs. Is there any workaround on this? Can you give me some more information about that (so that I can reproduce that error. Looks like it's a bug/oversight)? How did you build the Sequence objects that you passed to the CopySequence object and what did the sequences contain? (you can just print sequence objects to see what's inside them) I'm assuming there was not just a single sequence like the above, but also one with a different shot number or version number (so that you have at least two varying numbers). In such a case, having a single substitution pattern doesn't work because then the class doesn't know which varying number to pick. > you could explain it to me. Why does the class attempts to substitute > patterns on the sequence name if it is a 'simple' copy to a different > directory? Well, the class is supposed to handle renaming and renumbering sequences and it always runs the whole machinery even when you only provide a new directory without a sequence pattern. > Another question I have, lets assume that I have a sequence list that > contains sequences from different directories, should I need to > create an instance of sequence.CopySequence for each sequence that > resides into a different path? As I need to supply a string for > dstName, it is difficult for me to imagine how could I change the > dstName pattern (which on my case will always be folders) accordingly > to the path of the current source sequence that I want to copy. Do you want to copy all those sequences into the same output directory or should they all go in different directories? In the former case, you might be able to get away with a single CopySequence object whereas in the latter case, you should rather create a new object for every sequence. But as I said before, if everything you need is copying sequences into new directories, then you might not need the CopySequence class at all. If you already have the code to produce the Sequence objects, then you can just iterate over those sequences: >>> seqs = buildSequences(["spam1_1.tif", "spam1_2.tif", "spam1_5.tif"]) >>> for name in seqs[0]: ... print name ... spam1_1.tif spam1_2.tif spam1_5.tif The names will be SeqString classes, but you can just convert them to Python strings using str(). Then you can use the os.path module to construct your target path and the shutil module to copy the files. Cheers, - Matthias - |