guessit
guessit copied to clipboard
SVG handling
SVG's are partially understood, with the correct mime type.
e.g. https://upload.wikimedia.org/wikipedia/commons/e/e9/Brodnopis_i_pioro.svg results are
$ guessit Brodnopis_i_pioro.svg
For: Brodnopis_i_pioro.svg
GuessIt found: {
"title": "Brodnopis i pioro svg",
"mimetype": "image/svg+xml",
"type": "movie"
}
However it isn't a movie, and the title
should not contain svg
as that was from the extension.
This is possibly related to #273
why do you try to feed guessit with svg files ? I'm not sure it's guessit responsibility to filter out image filetypes.
It would be nice to use guessit
as part of heuristics to guess whether a file (on a remote server) of an unknown type is likely to be a movie, or some other class, as it is incredibly cheap to run guessit compared to downloading and analysing the file. .svg is just an example. It would be great if guessit said 'unknown' for types it doesnt recognise. If you're not interested, feel free to close.
I think it was the behavior in guessit 1.x, but this "feature" has been dropped during the 2.x rewriting. I let the issue open, i'll think about it.
@Toilal detection of image media types would be helpful for show-art
I understand and it make sense. It could be based on mimetype, but i fear that it may leads to inconsistent results because mimetype property is delegated to native implementation, and various OS may lead to various results.
Maybe we could use a pure python library for mimetype guessing, and then rely on this to solve this issue.
Maybe this can be useful: https://github.com/cdgriffith/puremagic
Shouldn't we detect image extensions as containers as well?
Kinda forgot about this issue, but @Toilal for filenames you could use mimetypes
from the standard library to create your own mimetype registry so results are consistent across all platforms. It would take a little leg work to add any desired types, but shouldnt be too troublesome.
~~@ratoaq2 puremagic wouldn't work for instances where you just have the name but have not yet downloaded the file.~~
It looks like puremagic also does filename matching, so that could be an option too.