tis-gyazo icon

Gazyo

Silent install package for Gazyo

4.2.1.0-0

  • package: tis-gyazo
  • name: Gazyo
  • version: 4.2.1.0-0
  • categories: Utilities
  • maintainer: WAPT Team,Tranquil IT,Kenan KILICARSLAN,Gaëtan SEGAT
  • editor: Toshiyuki Masui,Nota Inc
  • licence: GPL3
  • locale: all
  • target_os: windows
  • impacted_process: GyazoGIF,GyazoReplay,Gyazowin,GyOnboarding,GyStation
  • architecture: all
  • signature_date:
  • size: 11.21 Mo
  • installed_size: 19.84 Mo
  • homepage : https://gyazo.com/

package           : tis-gyazo
version           : 4.2.1.0-0
architecture      : all
section           : base
priority          : optional
name              : Gazyo
categories        : Utilities
maintainer        : WAPT Team,Tranquil IT,Kenan KILICARSLAN,Gaëtan SEGAT
description       : Gyazo is an open-source and free screenshot program
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 1.7
sources           : https://gyazo.com/download
installed_size    : 19841024
impacted_process  : GyazoGIF,GyazoReplay,Gyazowin,GyOnboarding,GyStation
description_fr    : Gyazo est un programme de capture d'écran gratuit et open-source
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : Toshiyuki Masui,Nota Inc
keywords          : screenshot,recorder
licence           : GPL3
homepage          : https://gyazo.com/
package_uuid      : 81ed9414-209c-4830-abd6-e661a9092609
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 6.1
max_os_version    : 
icon_sha256sum    : 73ccd3bcedf31d311fcfbb9f40664b51cbe92c87b11c442877998053263d4748
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : e1US3XI51D3T4NOXrFZBs+/maf3aHI/uq80nJWddZMkOl2NwnDqrUncWWJ7cY1PgS40CMXtXFfkftwA4acnkr4OXPuXTB9TxcY9DVW8oRyqC6f9kYosob6u//cAx49FRN4Mi+6TbGGBPKrCRN8xiVWFhc0OYvqkfPZhBN4qcWXts5Lph8cc1S9pwYs1IXJTHMXKw/F7KG1qQpKghsfcKB1tQ+UP9YkGKyg7fXSdFugkgR/fJvJKHMSlt3NVj8jNmwUDghZLLDtQJQEtGIbqD67LNAUhg14zKj+Wh7UbplrwjzJP9dmQWPqZPozMpvqL7seTCLQsoqMPcHQUjbGRKCw==
signature_date    : 2022-01-09T04:07:30.976893
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform

uninstallkey = []

# Defining variables
bin_name_sub = 'Gyazo-%s.exe'
silent_args = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART'
app_uninstallkey = '{6DB8C365-E719-4BA5-9594-10DFC244D3FD}_is1'
app_dir = makepath(programfiles32, 'Gyazo')
app_exe = ['Gyazowin.exe','GyazoGIF.exe','GyazoReplay.exe']


def install():
    # Initializing variables
    package_version = control.version.split('-')[0]
    bin_name = bin_name_sub % package_version

    def get_version_soft(key):
        return key['name'].split(' ')[1]


    # Installing the package
    print('Installing: %s' % bin_name)
    install_exe_if_needed(bin_name,
        silentflags=silent_args,
        key=app_uninstallkey,
        min_version=package_version,
        get_version=get_version_soft)

    if not installed_softwares(uninstallkey=app_uninstallkey)[0]['version']:
        # Create silent uninstall command in registry
        app_uninstallkey_quiet = installed_softwares(uninstallkey=app_uninstallkey)[0]['uninstall_string'] + '/VERYSILENT'
        # Add in registry
        register_uninstall(app_uninstallkey,
            app_uninstallkey_quiet,
            display_version=package_version)
    # Remove updater
    remove_file(makepath(app_dir, 'GyazoUpdate.exe'))

    for soft in app_exe :
        create_programs_menu_shortcut(soft.split('.exe')[0],makepath(app_dir,soft))
    create_programs_menu_shortcut('Gyazo Settings', makepath(app_dir, 'GyStation.exe'), '/option')


def uninstall():

    for soft in app_exe :
        remove_programs_menu_shortcut(soft.split('.exe')[0])
    remove_programs_menu_shortcut('Gyazo Settings')

def update_package():
    # Initializing variables
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    url = 'https://gyazo.com/download'
    bin_end = bin_name_sub.split('%s')[-1]
    #bin_start = bin_name_sub.split('%s')[0]

    # Getting latest version from official sources
    print('URL used is: %s' % url)
    for bs_search in bs_find_all(url, 'a', 'id', 'download_btn', headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'}, proxies=proxies):
        if bs_search['href'].split('/')[-1].endswith(bin_end):
            latest_bin = bs_search['href'].split('/')[-1]
            version = bs_search['href'].split('-')[-1].split(bin_end)[0]
            url_dl = bs_search['href']
            break

    print("Latest %s version is: %s" % (app_name, version))
    print("Download url is: %s" % url_dl)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print('Downloading: %s' % latest_bin)
        wget(url_dl, latest_bin, proxies=proxies)

        # Checking version from file
        version_from_file = get_version_from_binary(latest_bin)
        if version != version_from_file:
            os.rename(latest_bin,bin_name_sub % version_from_file)
            version = version_from_file

        # Changing version of the package
        control.version = '%s-%s' % (version, control.version.split('-', 1)[-1])
        control.save_control_to_wapt()
        print("Changing package version to: %s in WAPT\\control" % control.version)

    # Deleting outdated binaries
    remove_outdated_binaries(version)




def get_proxies():
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_proxies_from_wapt_console():
    proxies = {}
    if platform.system() == 'Windows':
        waptconsole_ini_path = makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini')
    else:
        waptconsole_ini_path = makepath(user_home_directory(), '.config', 'waptconsole', 'waptconsole.ini')
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, 'global', 'http_proxy')
        if proxy_wapt:
            proxies = {'http': proxy_wapt, 'https': proxy_wapt}
    return proxies


def get_version_from_binary(filename, parameter='ProductVersion'):
    if filename.endswith('.msi'):
        return get_msi_properties(filename)[parameter]
    else:
        return get_file_properties(filename)[parameter]


def remove_outdated_binaries(version, list_extensions=['exe','msi','deb','rpm','dmg','pkg','zip'], list_filename_contain=None):
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if list_filename_contain:
        if type(list_filename_contain) != list:
            list_filename_contain = [list_filename_contain]
    list_extensions = ['.' + ext for ext in list_extensions if ext[0] != '.']
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob('*%s' % file_ext):
            if not version in bin_in_dir:
                remove_file(bin_in_dir)
            if list_filename_contain:
                for filename_contain in list_filename_contain:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)


def bs_find(url, element, attribute=None, value=None, user_agent=None, proxies=None, features='html.parser', **kwargs):
    """"You may need to use a user agent for some websites.
    Example: user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0')
    """
    import requests
    if user_agent:
        page = requests.get(url, proxies=proxies, headers={'User-Agent':'%s' % user_agent}, **kwargs).text
    else:
        page = requests.get(url, proxies=proxies, **kwargs).text
    soup = BeautifulSoup.BeautifulSoup(page, features=features)
    if value:
        return soup.find(element, {attribute: value})
    else:
        return soup.find(element)


def bs_find_all(url, element, attribute=None, value=None, headers=None, proxies=None, features='html.parser', **kwargs):
    """"You may need to use a header for some websites. For example: headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'}
    """
    import requests
    page = requests.get(url, proxies=proxies, headers=headers, **kwargs).text
    try:
        import bs4 as BeautifulSoup
        soup = BeautifulSoup.BeautifulSoup(page, features=features)
    except:
        import BeautifulSoup
        soup = BeautifulSoup.BeautifulSoup(page)
    if value:
        return soup.findAll(element,{attribute:value})
    else:
        return soup.findAll(element)

5f30e0334200b2068e2405e9bd9d9faba563c5d8265a7bb3710ba411c05f2a13 : setup.py
73ccd3bcedf31d311fcfbb9f40664b51cbe92c87b11c442877998053263d4748 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
6e887d68022aef3b4ae4514158adc66082e208b87a247db230ae32ac71849c59 : luti.json
a3475c506287530995359ae10df0ee4adec8eadbe8bf34d6d9b83fe701f008e3 : Gyazo-4.2.1.0.exe
affb97f6a76df09a395b01a0e73e01f6d809d3c6692f79557b89ad39c2dcbd48 : WAPT/control