diff --git a/README.md b/README.md index ea59bc6..0f65f85 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ python3 WebPicDownloader.py First of all you have to know that WebPicDownloader has a deamon worker that downloads all the images asynchronously (this allows you not to block your program when a download is in progress). This same worker will be automatically killed as soon as your program finishes. WebPicDownloader therefore provides a blocking stop function allowing you to wait for the end of the download. See the information below. The prerequisites are the same as if you were running the script from the command line, see [prerequisites](#cli-run-requirements). -#### Step #1 +#### Step 1 Instantiate your WebPicDownloader object like this: @@ -56,7 +56,7 @@ webpic = WebPicDownloader() The constructor can take several parameters (`path: str, headers: dict, messenger, success, failure`) (see the documentation). -#### Step #2 +#### Step 2 Define the WebPicDownloader callback functions. There are 3 main ones, the first (messenger callback) will be called at each system event and takes the following parameters (`message: str, type: MessageType`). The second (success callback) will be called at the end of processing if no major errors occur, it takes the following parameters (`message: str`). The third and last function (failure callback) will be called if a major error occurs or the download fails, it takes the following parameter (`message: str`). @@ -74,7 +74,7 @@ webpic.set_failure_callback(lambda message: print(f"Success ! [{message}].")) webpic.set_messenger_callback(lambda message, msg_type: print(f"[{msg_type}]: {message}.")) ``` -#### Step #3 +#### Step 3 Once WebPicDownloader instantiated and the callback functions configured, we have to launch the download and stop it. It is important to know that the script does not have a function to stop a download in progress, in fact the stop function will allow you to wait for the end of the download and then turn off the program or to kill the worker automatically when the main thread dies.