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

Improve M4A file upload detection #1115

Merged
merged 9 commits into from
Feb 7, 2023

Conversation

kunwarj
Copy link
Collaborator

@kunwarj kunwarj commented Jan 25, 2023

This fix checks for the media streams of audio or video files after getting the MIME type from Tika library. If the streams has only one stream and its codec type is audio then it treats as audio, else if multiple streams with video codec type, then is treats as video.

@alexgao1
Copy link
Contributor

alexgao1 commented Feb 1, 2023

Changes made look good, m4a files worked

Copy link
Collaborator

@billingb billingb left a comment

Choose a reason for hiding this comment

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

Looks good, a few small issues noted in comments.


public class FileStream {

public String codecType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be private right?

JSONArray streams = json.getJSONArray("streams");

List<FileStream> fileStreams = new ArrayList<FileStream>();
for (int i = 0; i < streams.length(); i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could consider using streams, would make it cleaner IMO but not a big deal if you prefer this appraoch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor

@alexgao1 alexgao1 left a comment

Choose a reason for hiding this comment

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

Looks great now!

@alexgao1 alexgao1 changed the title Possible fix for .m4a file upload Improve M4A file upload detection Feb 6, 2023
@billingb billingb merged commit 4a7e257 into GCRC:master Feb 7, 2023
alexgao1 pushed a commit that referenced this pull request Feb 7, 2023
* fix the issue with .m4a file upload

* fix issue with .m4a file upload

* check media stream if the file has audio//video streams

* fix logs

* fix the code reviews comments

* code refactor

---------

Co-authored-by: Nunaliit <nunaliit@lunageo-asus>
Co-authored-by: Jagdish Kunwar <jkunawr@lunageo.com>
Co-authored-by: Jagdish Kunwar <jkunwar@luageo.com>
alexgao1 added a commit that referenced this pull request Feb 7, 2023
* fix the issue with .m4a file upload

* fix issue with .m4a file upload

* check media stream if the file has audio//video streams

* fix logs

* fix the code reviews comments

* code refactor

---------

Co-authored-by: kunwarj <121902036+kunwarj@users.noreply.github.com>
Co-authored-by: Nunaliit <nunaliit@lunageo-asus>
Co-authored-by: Jagdish Kunwar <jkunawr@lunageo.com>
Co-authored-by: Jagdish Kunwar <jkunwar@luageo.com>
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.

3 participants