fixing webpic internal run + add executable metadata

This commit is contained in:
Jérémi N ‘EndMove’ 2022-09-06 14:30:04 +02:00
parent 25f10a8c50
commit 87ab654f55
Signed by: EndMove
GPG Key ID: 65C4A02E1F5371A4
6 changed files with 92 additions and 15 deletions

View File

@ -1 +1,2 @@
# WebPicDownloader

View File

@ -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

View File

@ -1,5 +1,11 @@
from auto_py_to_exe import __main__ as apte
import pyinstaller_versionfile
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()

7
metadata.yml Normal file
View File

@ -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

View File

@ -38,7 +38,9 @@ class WebPicDownloader(Thread):
integrated entry point allowing it to be directly executed in terminal mode.
@author EndMove <contact@endmove.eu>
@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:
# 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)
if "n" == input("Do you want to continue [Y/n] ? ").lower():
break
wpd.stop_downloading(block=True)
print("Good bye !")
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.

44
versionfile.txt Normal file
View File

@ -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])])
]
)