Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ordering of images in video sequence #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

korabelnikov
Copy link

#2

Comment on lines +72 to +80
images_info = [(x.file.url, x.width, x.height) for x in files]

def get_num(im_info):
url = im_info[0]
name = os.path.split(url)[-1]
num = os.path.splitext(name)[0]
return int(num)

images_info = sorted(images_info, key=get_num)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution might fail when some one uploads set of images with names having character and numbers.
e.g. : image_0001.jpg, image_002.jpg etc.
In such a case, int(image_001) would give a ValueError: invalid literal for int( )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed this fix for video, so some modification like single if-else may be needed to work with images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants