コード例 #1
0
ファイル: AVR_Miner.py プロジェクト: Tech1k/duino-coin
 def load(donation_level):
     if donation_level > 0:
         if osname == 'nt':
             if not Path(
                     f"{Settings.DATA_DIR}/Donate.exe").is_file():
                 url = ('https://server.duinocoin.com/'
                        + 'donations/DonateExecutableWindows.exe')
                 r = requests.get(url)
                 with open(f"{Settings.DATA_DIR}/Donate.exe",
                           'wb') as f:
                     f.write(r.content)
         elif osname == "posix":
             if osprocessor() == "aarch64":
                 url = ('https://server.duinocoin.com/'
                        + 'donations/DonateExecutableAARCH64')
             elif osprocessor() == "armv7l":
                 url = ('https://server.duinocoin.com/'
                        + 'donations/DonateExecutableAARCH32')
             else:
                 url = ('https://server.duinocoin.com/'
                        + 'donations/DonateExecutableLinux')
             if not Path(
                     f"{Settings.DATA_DIR}/Donate").is_file():
                 r = requests.get(url)
                 with open(f"{Settings.DATA_DIR}/Donate",
                           "wb") as f:
                     f.write(r.content)
コード例 #2
0
def Greeting():
    # Greeting message
    global greeting
    print(Style.RESET_ALL)

    if requested_diff == "LOW":
        diffName = getString("low_diff_short")
    elif requested_diff == "MEDIUM":
        diffName = getString("medium_diff_short")
    else:
        diffName = getString("net_diff_short")

    current_hour = strptime(ctime(time())).tm_hour
    if current_hour < 12:
        greeting = getString("greeting_morning")
    elif current_hour == 12:
        greeting = getString("greeting_noon")
    elif current_hour > 12 and current_hour < 18:
        greeting = getString("greeting_afternoon")
    elif current_hour >= 18:
        greeting = getString("greeting_evening")
    else:
        greeting = getString("greeting_back")

    print(Style.DIM + Fore.YELLOW + " ‖ " + Fore.YELLOW + Style.BRIGHT +
          getString("banner") + Style.RESET_ALL + Fore.MAGENTA + " (v" +
          str(MINER_VER) + ") " + Fore.RESET + "2019-2021")

    print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.YELLOW +
          "https://github.com/revoxhere/duino-coin")

    if lang != "english":
        print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.RESET +
              lang.capitalize() + " translation: " + Fore.YELLOW +
              getString("translation_autor"))

    try:
        print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.RESET +
              "CPU: " + Style.BRIGHT + Fore.YELLOW + str(threadcount) + "x " +
              str(cpu["brand_raw"]))
    except Exception as e:
        debug_output("Error displaying CPU message: " + str(e))

    if osname == "nt" or osname == "posix":
        print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.RESET +
              getString("donation_level") + Style.BRIGHT + Fore.YELLOW +
              str(donation_level))

    print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.RESET +
          getString("algorithm") + Style.BRIGHT + Fore.YELLOW + algorithm +
          " ⚙ " + diffName)

    if rig_identiier != "None":
        print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.RESET +
              getString("rig_identifier") + Style.BRIGHT + Fore.YELLOW +
              rig_identiier)

    print(Style.DIM + Fore.YELLOW + " ‖ " + Style.NORMAL + Fore.RESET +
          str(greeting) + ", " + Style.BRIGHT + Fore.YELLOW + str(username) +
          "!\n")

    if int(donation_level) > 0:
        if osname == "nt":
            if not Path(RESOURCES_DIR + "/Donate_executable.exe").is_file():
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableWindows.exe?raw=true")
                r = requests.get(url)
                with open(RESOURCES_DIR + "/Donate_executable.exe", "wb") as f:
                    f.write(r.content)
        elif osname == "posix":
            if osprocessor() == "aarch64":
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableAARCH64?raw=true")
            elif osprocessor() == "armv7l":
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableAARCH32?raw=true")
            else:
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableLinux?raw=true")
            if not Path(RESOURCES_DIR + "/Donate_executable").is_file():
                r = requests.get(url)
                with open(RESOURCES_DIR + "/Donate_executable", "wb") as f:
                    f.write(r.content)
コード例 #3
0
def greeting():
    # greeting message depending on time
    global greeting
    print(Style.RESET_ALL)

    current_hour = strptime(ctime(time())).tm_hour

    if current_hour < 12:
        greeting = get_string('greeting_morning')
    elif current_hour == 12:
        greeting = get_string('greeting_noon')
    elif current_hour > 12 and current_hour < 18:
        greeting = get_string('greeting_afternoon')
    elif current_hour >= 18:
        greeting = get_string('greeting_evening')
    else:
        greeting = get_string('greeting_back')

    # Startup message
    print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Fore.YELLOW + Style.BRIGHT +
          get_string('banner') + Style.RESET_ALL + Fore.MAGENTA + ' (v' +
          str(MINER_VER) + ') ' + Fore.RESET + '2019-2021')

    print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Style.NORMAL + Fore.MAGENTA +
          'https://github.com/revoxhere/duino-coin')

    if lang != "english":
        print(Style.DIM + Fore.MAGENTA + " ‖ " + Style.NORMAL + Fore.RESET +
              lang.capitalize() + " translation: " + Fore.MAGENTA +
              get_string("translation_autor"))

    print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Style.NORMAL + Fore.RESET +
          get_string('avr_on_port') + Style.BRIGHT + Fore.YELLOW +
          ' '.join(avrport))

    if osname == 'nt' or osname == 'posix':
        print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Style.NORMAL + Fore.RESET +
              get_string('donation_level') + Style.BRIGHT + Fore.YELLOW +
              str(donation_level))
    print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Style.NORMAL + Fore.RESET +
          get_string('algorithm') + Style.BRIGHT + Fore.YELLOW +
          'DUCO-S1A ⚙ AVR diff')

    if rig_identifier != "None":
        print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Style.NORMAL + Fore.RESET +
              get_string('rig_identifier') + Style.BRIGHT + Fore.YELLOW +
              rig_identifier)

    print(Style.DIM + Fore.MAGENTA + ' ‖ ' + Style.NORMAL + Fore.RESET +
          str(greeting) + ', ' + Style.BRIGHT + Fore.YELLOW + str(username) +
          '!\n')

    if int(donation_level) > 0:
        if osname == 'nt':
            # Initial miner executable section
            if not Path(RESOURCES_DIR + '/Donate_executable.exe').is_file():
                url = ('https://github.com/' + 'revoxhere/' +
                       'duino-coin/blob/useful-tools/' +
                       'donateExecutableWindows.exe?raw=true')
                r = requests.get(url)
                with open(RESOURCES_DIR + '/Donate_executable.exe', 'wb') as f:
                    f.write(r.content)
        elif osname == "posix":
            if osprocessor() == "aarch64":
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableAARCH64?raw=true")
            elif osprocessor() == "armv7l":
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableAARCH32?raw=true")
            else:
                url = ("https://github.com/revoxhere/" +
                       "duino-coin/blob/useful-tools/Donate_executables/" +
                       "DonateExecutableLinux?raw=true")
            if not Path(RESOURCES_DIR + "/Donate_executable").is_file():
                r = requests.get(url)
                with open(RESOURCES_DIR + "/Donate_executable", "wb") as f:
                    f.write(r.content)