-
Notifications
You must be signed in to change notification settings - Fork 424
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
Incomplete mime_type data for several ContentTypes #816
Comments
Thanks for reporting! If a content type that is actually used by any of the model has any of the metadata set to None, that's not by design. But I just checked MKV, and it has the correct mime_type (see https://github.com/google/magika/blob/main/assets/content_types_kb.min.json)? where did you see its mime_type to None? Are you maybe checking an old version of the metadata? |
Well I'm using the magika Python package (version This is the code I used to print all the MIME Types. from magika.content_types import ContentTypesManager
def get_mime_type_list() -> list[str]:
return list({
str(content_type.mime_type)
for name, content_type
in ContentTypesManager().cts.items()
if content_type.mime_type is not None
})
if __name__ == '__main__':
for mime_type in get_mime_type_list():
print(mime_type) Also second question, I see that on |
[Sorry for late reply, was on holidays.] Thanks for clarifying. And yes, the ContentTypesManager class has been refactored out (and it was never supposed to be used by external clients). The same information is now in a private field One thing to keep in mind: there is a list of "content types a given model supports" vs. "the full list of content types we are aware of" (which is a super set of the former, and for which the metadata may not be ready for consumption). What would be your use case for using it? If we were to add it, which kind of APIs would you like to have? |
All good, thanks for replying at all. I send it out to the frontend of my app because a user can type in a mime type into a field and this is how I verify it actually exists. Might be quite a niche use case though and there are probably better solutions. |
I see, interesting. In general I believe the knowledge base of types may useful for use cases like yours, so I see a good argument to expose it in some way or another. Maybe we could add some methods to the |
I do no know if this is by design, but some
ContentType
s seem to be missing their associatedmime_type
values.e.g. the MKV content type specifies its
mime_type
asNone
instead ofvideo/x-matroska
The text was updated successfully, but these errors were encountered: