Closed AbhijitKulkarni95 closed 3 years ago
Hello and thank you for using our package.
it's seems that the file you are trying to get a previews of is guessed as a "message/rfc822" file. No preview_generator builder does support preview for this kind of file. If your file is really a rfc822 message, you may want to create a specific builder for it.
It will help us to know more about what are you trying to achieve. What is your original file (if possible to provide it) ? On which system are you running (result of mimetype guess depend heavily on underlying system) ?
sure, I am trying to create a preview for a file with .eml extension. Sample: [http://file.fyicenter.com/97_EML-File_Extension_for_Email_Message_Files.html].
Any idea on how to create a builder for .eml extension?
Any idea on how to create a builder for .eml extension?
It really depend what you are expecting from an .eml preview.
I will suggest you to try a poc by just adding message/rfc822
to get_supported_mimetypes
of plain_text builder.
https://github.com/algoo/preview-generator/blob/e61675f276e1375d82ef8f2f27c017cf7d0e8272/preview_generator/preview/builder/plain_text.py
This should normally use libreoffice to generate pdf/jpeg preview of your eml file.
If you have any idea of what you .eml builder should do, and success to make things work, be free to suggest a patch.
sure I will try that.
Also, I am getting an error when I am trying to generate a preview for a PNG file.
Error message: Command '['convert', 'png:/home/ubuntu/Screenshot 2020-12-14 at 4-1599486e2b684e87858a94d9a9079c88.png', '-layers', 'merge', '/tmp/preview-generator-wngqi0rl.png']' returned non-zero exit status 1.
Is my file corrupted or am I doing sm thing wrong?
code:
from preview_generator.manager import PreviewManager manager = PreviewManager(current_dir + 'preview_cache', create_folder= True) path_to_file = manager.get_jpeg_preview(current_dir + file_name)
Hi, "I will suggest you to try a poc by just adding message/rfc822 to get_supported_mimetypes of plain_text builder."
This worked for me. Thank You so much. 👍
Hi,
Here is that png file.
Error message: Command '['convert', 'png:/home/ubuntu/org_pic', '-layers', 'merge', '/tmp/preview-generator-wngqi0rl.png']' returned non-zero exit status 1.
Is my file corrupted or am I doing sm thing wrong?
code:
from preview_generator.manager import PreviewManager manager = PreviewManager(current_dir + 'preview_cache', create_folder= True) path_to_file = manager.get_jpeg_preview(current_dir + file_name)
Is my file corrupted or am I doing sm thing wrong?
try rename your file with .jpg
extension. We don't handle this kind of "fake png" case properly.
ok, u think this fake png?
Did it work for You in your system?
sure I will rename and try.
Thanks for such an amazing package. 🥇
Command '['convert', 'png:/home/ubuntu/org_pic', '-layers', 'merge', '/tmp/preview-generator-wngqi0rl.png']' returned non-zero exit status 1.
I can see at in source dest path 'png:/home/ubuntu/org_pic' . "png:" is getting appended to file path.
But I am not able to figure out where this is happening.
Hi,
Line number 159 in https://github.com/algoo/preview-generator/blob/develop/preview_generator/preview/builder/image__imconvert.py
why are we doing 'explicit_source_path' for the file?
Hi,
Line number 159 in https://github.com/algoo/preview-generator/blob/develop/preview_generator/preview/builder/image__imconvert.py
why are we doing 'explicit_source_path' for the file?
To handle some of our internal usage, we do have had support for separated extension from the filename. We do wanted to be able to support both "/tmp/file.arw" and "/tmp/file" + ".arw" extension. This complicate some stuff and we may not need it later, so i'm not sure we will keep the feature in the long run.
This code force to explictly tell the file extension we do have in input to imagemagick. Without it, we would not being able to support preview for case like "/tmp/file" + ".arw" case (imagemagick will make wrong guess).
Another solution to solve these kind of issue could be use of temporary copy file just to get the correct file extension, but this mean create copy of the original file just for a naming problem.
Got it. Thank you 👍
Hi, I am getting this error (Unsupported mimetype: message/rfc822). Am I missing something?