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

Extract video filenames correctly from URLs #6428

Merged
merged 6 commits into from Nov 16, 2023

Conversation

112292454
Copy link
Contributor

Description

before cannot process url like "https:/example.com/avatar/xxxx.mp4?se=2023-11-16T06:51:23Z&sp=r" correctly, will get format as "mp4?se=2023-11-16T06:51:23Z&sp=r", and go to unnecessary format convert

cannot process url like "https:/example.com/avatar/xxxx.mp4?se=2023-11-16T06:51:23Z&sp=r" correctly, will get format like"mp4?se=2023-11-16T06:51:23Z&sp=r", and do unnecessary convert
@112292454 112292454 changed the title Update video.py fix(component.video): set video type correctly Nov 15, 2023
@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 15, 2023

🪼 branch checks and previews

Name Status URL
🦄 Changes detected! Details

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 15, 2023

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Extract video filenames correctly from URLs

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs
Copy link
Member

Thanks @112292454! This looks good. I wonder if there's a way to get the base filepath in a URL without having to do manual parsing of the string?

Would you be able to add a test to test_components.py?

@112292454
Copy link
Contributor Author

Thanks @112292454! This looks good. I wonder if there's a way to get the base filepath in a URL without having to do manual parsing of the string?

Would you be able to add a test to test_components.py?

now use urllib and os.path
I don’t often write py , may be some specification issues
The urls may be can used for other tests

@abidlabs abidlabs added the v: patch A change that requires a patch release label Nov 16, 2023
@abidlabs abidlabs changed the title fix(component.video): set video type correctly Extract video name properly from URLs Nov 16, 2023
@abidlabs abidlabs changed the title Extract video name properly from URLs Extract video filenames correctly from URLs Nov 16, 2023
@abidlabs
Copy link
Member

Thanks @112292454 I refactored this out to be a separate util function and added a test. Merging!

@abidlabs abidlabs merged commit ac4ca59 into gradio-app:main Nov 16, 2023
11 of 15 checks passed
@pngwn pngwn mentioned this pull request Nov 16, 2023
@112292454
Copy link
Contributor Author

@abidlabs 😭 i'm sorry, i has did some change when last comment, but i commit it incorrectly(merge from my another branch. but didn't put that code into this pr)
i check it an commit again?

@abidlabs
Copy link
Member

Its okay, I think my changes should have covered everything, right? Unless I missed something?

@112292454
Copy link
Contributor Author

you're right, just different in test case, and if it end with /
maybe no need to change it
that commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants