diff --git a/README.md b/README.md index 51e352e..276e864 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # WebPicDownloader + diff --git a/autopy-conf.json b/autopy-conf.json index b8ba9be..6e4e147 100644 --- a/autopy-conf.json +++ b/autopy-conf.json @@ -45,6 +45,10 @@ "optionDest": "disable_windowed_traceback", "value": false }, + { + "optionDest": "version_file", + "value": "C:/Users/super/Documents/Developpement/Python/WebPicDownloader/versionfile.txt" + }, { "optionDest": "embed_manifest", "value": true diff --git a/autopy-run.py b/autopy-run.py index a17659c..e2a6710 100644 --- a/autopy-run.py +++ b/autopy-run.py @@ -1,5 +1,11 @@ from auto_py_to_exe import __main__ as apte +import pyinstaller_versionfile - -apte.__name__ = '__main__' -apte.run() \ No newline at end of file +if __name__ == '__main__': + pyinstaller_versionfile.create_versionfile_from_input_file( + output_file="versionfile.txt", + input_file="metadata.yml", + #version="1.2.3.4" # optional, can be set to overwrite version information (equivalent to --version when using the CLI) + ) + apte.__name__ = '__main__' + apte.run() \ No newline at end of file diff --git a/metadata.yml b/metadata.yml new file mode 100644 index 0000000..cecc53b --- /dev/null +++ b/metadata.yml @@ -0,0 +1,7 @@ +Version: 1.0.0.1 +CompanyName: EndMove Corp. +FileDescription: Scraping tool to recover all the images of a website. +InternalName: webpic +LegalCopyright: © Copyright 2022 EndMove. All rights reserved. +OriginalFilename: WebPicDownloader.exe +ProductName: WebPicDownloader \ No newline at end of file diff --git a/model/WebPicDownloader.py b/model/WebPicDownloader.py index 6dd25d8..a7dd980 100644 --- a/model/WebPicDownloader.py +++ b/model/WebPicDownloader.py @@ -38,7 +38,9 @@ class WebPicDownloader(Thread): integrated entry point allowing it to be directly executed in terminal mode. @author EndMove + @link https://git.endmove.eu/EndMove/WebPicDownloader @version 1.2.1 + @since 2022-09-05 """ # Variables __callbacks: dict = None # Callback dictionary @@ -63,9 +65,9 @@ class WebPicDownloader(Thread): * :success: -> Callback function success (see setter). * :failure: -> Callback function failure (see setter). """ - super().__init__(daemon=True) + super().__init__(daemon=True, name='WebPic download worker') self.__callbacks = { - 'messenger': messenger if messenger else lambda msg: print(msg), + 'messenger': messenger if messenger else lambda msg, type: print(msg), 'success': success if success else lambda: print("Success!"), 'failure': failure if failure else lambda: print("failure!") } @@ -306,13 +308,26 @@ class WebPicDownloader(Thread): if __name__ == "__main__": - # Internal entry point for testing and consol use. - wpd = WebPicDownloader() - while True: - url = input("Website URL ? ") - name = input("Folder name ? ") - wpd.start_downloading(url, name) - if "n" == input("Do you want to continue [Y/n] ? ").lower(): - break - wpd.stop_downloading(block=True) - print("Good bye !") \ No newline at end of file + # Internal entry point for testing and console use. + import time + + wpd = WebPicDownloader() # Instance of webpic + + # Callback functions + def success(): + print("\nDownload completed with success.") + + def failed(): + print("\nDownload completed with errors.") + + # Set-up callback functions for webpic + wpd.set_success_callback(success) + wpd.set_failure_callback(failed) + + # Ask for download + print("\nWelcome to WebPicDownloader!") + url = input("Website URL ? ") + name = input("Folder name ? ") + wpd.start_downloading(url, name) # Start downloading + time.sleep(1) # We wait for the download to start before ask to stop it + wpd.stop_downloading(block=True) # Stop downloading but block till the download end. \ No newline at end of file diff --git a/versionfile.txt b/versionfile.txt new file mode 100644 index 0000000..be560d6 --- /dev/null +++ b/versionfile.txt @@ -0,0 +1,44 @@ +# UTF-8 +# +# For more details about fixed file info 'ffi' see: +# http://msdn.microsoft.com/en-us/library/ms646997.aspx + +VSVersionInfo( + ffi=FixedFileInfo( + # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) + # Set not needed items to zero 0. Must always contain 4 elements. + filevers=(1,0,0,1), + prodvers=(1,0,0,1), + # Contains a bitmask that specifies the valid bits 'flags'r + mask=0x3f, + # Contains a bitmask that specifies the Boolean attributes of the file. + flags=0x0, + # The operating system for which this file was designed. + # 0x4 - NT and there is no need to change it. + OS=0x40004, + # The general type of file. + # 0x1 - the file is an application. + fileType=0x1, + # The function of the file. + # 0x0 - the function is not defined for this fileType + subtype=0x0, + # Creation date and time stamp. + date=(0, 0) + ), + kids=[ + StringFileInfo( + [ + StringTable( + u'040904B0', + [StringStruct(u'CompanyName', u'EndMove Corp.'), + StringStruct(u'FileDescription', u'Scraping tool to recover all the images of a website.'), + StringStruct(u'FileVersion', u'1.0.0.1'), + StringStruct(u'InternalName', u'webpic'), + StringStruct(u'LegalCopyright', u'© Copyright 2022 EndMove. All rights reserved.'), + StringStruct(u'OriginalFilename', u'WebPicDownloader.exe'), + StringStruct(u'ProductName', u'WebPicDownloader'), + StringStruct(u'ProductVersion', u'1.0.0.1')]) + ]), + VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) + ] +) \ No newline at end of file