-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rework app for compatibility with PyInstaller
Changes: - Make package compatible with PyInstaller to enable creation of a onefile executable - New 'utils' module with function to get the correct resource paths for the frozen PyInstaller executable - Use multiprocessing module with freeze support instead of subprocess for compatibility with PyInstaller - Use absolute import in main module for compatibility with PyInstaller - Use a separate logger instance for each module with the name of the module - Update initialise_logging() function to handle log file directory creation and add a check for existing handlers to allow the function to be called multiple times for the same logger without adding duplicate handlers - Use a queue to store a serialisable dictionary representation of each log record, then convert it back to a log record and handle the record with the main logger - Add QueueHandler to the root logger to put gallery-dl logs in the log queue, ensuring each log record is converted into a dictionary with non-serialisable values removed, the correct level set, and the message set to the formatted record - Make sure QueueHandler has the same formatter as configured by gallery-dl and remove the existing StreamHandler from the root logger to prevent logs being sent to stderr - Make sure the main logger only handles records with a log level greater than or equal to its own log level, as the handle() method does not filter log records based on the logger's level before sending them to the handlers - Capture writes to stdout and stderr and log the output instead - Use a custom formatter to remove ANSI escape sequences from log messages - Make log message level names lower case - Remove level names from the default gallery-dl log format configuration as these are now accurately labelled by the main logger - Use StreamingResponse instead of FileResponse to avoid setting a Content-Length header and avoid exceptions when the size of the log file changes between when the size is calculated and the response is sent - Make sure log file is streamed with the media type for plain text - Handle generic exceptions for gallery-dl downloads and return -1 exit code - Add docstrings for functions and classes - Update .ignore files with PyInstaller files and directories - Update README to clarify running with Python and as a standalone executable - Update LICENSE copyright duration - General code organisation and formatting improvements
- Loading branch information
Showing
11 changed files
with
290 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,8 @@ SECURITY.md | |
drafts/ | ||
gallery-dl/ | ||
logs/ | ||
|
||
# PyInstaller | ||
build/ | ||
dist/ | ||
*.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,8 @@ venv/ | |
drafts/ | ||
gallery-dl/ | ||
logs/ | ||
|
||
# PyInstaller | ||
build/ | ||
dist/ | ||
*.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.