mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
flame: fixing padding in collection ranges
This commit is contained in:
parent
05faaaa638
commit
dd77f7cd9b
1 changed files with 18 additions and 3 deletions
|
|
@ -848,9 +848,10 @@ class MediaInfoFile(object):
|
||||||
# we expect only one collection
|
# we expect only one collection
|
||||||
collection = collections[0]
|
collection = collections[0]
|
||||||
|
|
||||||
|
self.log.debug("__ collection: {}".format(collection))
|
||||||
|
|
||||||
if collection.is_contiguous():
|
if collection.is_contiguous():
|
||||||
# if no holes then return collection
|
return self._format_collection(collection)
|
||||||
return collection.format("{head}[{range}]{tail}")
|
|
||||||
|
|
||||||
# add `[` in front to make sure it want capture
|
# add `[` in front to make sure it want capture
|
||||||
# shot name with the same number
|
# shot name with the same number
|
||||||
|
|
@ -858,11 +859,25 @@ class MediaInfoFile(object):
|
||||||
# convert to multiple collections
|
# convert to multiple collections
|
||||||
_continues_colls = collection.separate()
|
_continues_colls = collection.separate()
|
||||||
for _coll in _continues_colls:
|
for _coll in _continues_colls:
|
||||||
coll_to_text = _coll.format("{head}[{range}]{tail}")
|
coll_to_text = self._format_collection(_coll)
|
||||||
self.log.debug("__ coll_to_text: {}".format(coll_to_text))
|
self.log.debug("__ coll_to_text: {}".format(coll_to_text))
|
||||||
if number_from_path in coll_to_text:
|
if number_from_path in coll_to_text:
|
||||||
return coll_to_text
|
return coll_to_text
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _format_collection(collection):
|
||||||
|
# if no holes then return collection
|
||||||
|
head = collection.format("{head}")
|
||||||
|
tail = collection.format("{tail}")
|
||||||
|
range_template = "[{{:0{0}d}}-{{:0{0}d}}]".format(
|
||||||
|
len(str(max(collection.indexes))))
|
||||||
|
ranges = range_template.format(
|
||||||
|
min(collection.indexes),
|
||||||
|
max(collection.indexes)
|
||||||
|
)
|
||||||
|
# if no holes then return collection
|
||||||
|
return "{}{}{}".format(head, ranges, tail)
|
||||||
|
|
||||||
def _separate_file_head(self, basename, extension):
|
def _separate_file_head(self, basename, extension):
|
||||||
""" Get only head with out sequence and extension
|
""" Get only head with out sequence and extension
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue