-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add some type file preview and more #28
Conversation
cache_path | ||
)) | ||
result = check_call( | ||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basile, pour le script scribus, le mieux est de le stocker dans un string dans ton code et de faire du «pipe» avec la commande, genre echo $content | scribus ...`
Ne le change pas maintenant mais crees un ticket pour refactoriser ça
|
||
""" | ||
abstract function to transform a file given in bytes to pdf | ||
:param file_content: stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Abstract class, not function... en fait la docstring est pas au bon endroit
tests/input/sla/the_double_sla.sla
Outdated
@@ -0,0 +1,162 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<SCRIBUSUTF8NEW Version="1.4.6"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a file with.images inside ? If not, please change the file for a more complete one
setup.py
Outdated
@@ -33,7 +33,9 @@ | |||
'Wand', | |||
'PyPDF2', | |||
'Pillow', | |||
'Sweepatic-PyExifTool==0.2' | |||
'wand', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated dependency
cache_file = os.path.join(cache_path, preview_name) | ||
|
||
if self._cache_file_process_already_running(cache_file): | ||
# Note - Basile - infinite recursion protection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes must contain date, tale a look at https://algoo.trac.im/workspaces/11/folders/1194/pages/2043 , section "Commentaires".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
complete_path = file_path + '.' + file_ext | ||
str, encoding = mimetypes.guess_type(complete_path) | ||
_str, encoding = mimetypes.guess_type(complete_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If y have a good reading of PEP8:
single_trailing_underscore_: used by convention to avoid conflicts with Python keyword, e.g.
You should name str_
instead _str
.
if not os.path.exists(intermediate_pdf_file_path): | ||
if os.path.exists(intermediate_pdf_file_path + '_flag'): | ||
# Wait 2 seconds, then retry | ||
time.sleep(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why waiting for 2 sec ? This may cause a process who use preview_generator to hang more than 2 second ?
An "INFO" comment may be nice here explaining the goal of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right that an explanation is a good idea.
The use case is the following one:
you ask for a jpeg preview of a libreoffice document. the first step is to convert odt to full pdf. If at the same time you ask for a jpeg preview of another page, then the full pdf will be geenrated twice, resulting in a corrupt file (and loss of time). Waiting 2 seconds let the running transformation to finish (the 2s delay is only executed in case a preview is already running)
@basilelegal could you add a comment explaining this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Author of this code is not @basilelegal (it's a move of code). But, maybe he is able to respond ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's coming with the next push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…pe should be use for svg
@buxx @basilelegal my point of view is that code is in a stable / managed state. Not perfect but problems are identified (and should be written in new issues - @basilelegal did you write these issues?) My feeling is we can merge this and start from new branches for fixes remaining problems. @buxx what do you think? |
Agree with that, ready to merge ! |
Adds preview for scribus file
.sla
. fix #25Adds test for gimp file
.xfc
. fix #26Refactor openoffice and scribus preview builder.
Complete README.
Fix bug with exif tool. fix #21
Adds some PEP8.