Beispiel #1
0
    def view_downloads(self):
        """
        *****************************************
        View Log

        *****************************************
        """
        prev_combined = ""
        Stuff_metadata = dict
        while True:

            # Load All the Stuff Being download
            list_of_downloads = Config.LIST_IN_PROGRESS_LIB + Config.LIST_PENDING_LIB
            # Get Informations about their library if not exist

            combined = "\nPENDING DOWNLOAD\n--> {}\n\nDOWNLOAD IN PROGRESS\n--> {}\n\nDOWNLOADED\n--> {} \n\n\n\n".format(
                str(Config.LIST_PENDING_LIB), str(Config.LIST_IN_PROGRESS_LIB),
                str(Config.LIST_DOWNLOADED_LIB))

            if prev_combined != combined:
                Console.app_title()
                Console.menu_title("View Downloads")
                print("{}\n\n  Press <Enter> to quit log ...".format(combined))
                if Auxiliaries.input_timeout(1) == "":
                    break
                prev_combined = combined
            else:
                if Auxiliaries.input_timeout(2) == "":
                    break
Beispiel #2
0
    def about(self):
        """
        *****************************************
        View Log

        *****************************************
        """
        Console.app_title()
        Console.menu_title("About")

        message = "EMMA Torrent V1.0 \nUniversity Jean Monnet \nGroup I\n"
        print("{}\n\n  Press <Enter> to quit log ...".format(message))
        Auxiliaries.input_timeout(15)
Beispiel #3
0
    def settings(self):
        """
        *****************************************
        Setting menu

        *****************************************
        """
        Console.app_title()
        Console.menu_title("Settings")

        all_config_vars = dict(Config.view_global_var())
        for key in all_config_vars:
            print("[ {} ] = {} ".format(str(key), all_config_vars[str(key)]))

        print("\n Enter <exit> to quit \n")

        while True:
            choice = input("Enter key to modify: ")
            choice = choice.strip().upper()

            if choice == "EXIT":
                return

            elif choice not in all_config_vars.keys():
                print("Unknown key [ {} ] provided.".format(choice))

            elif choice == "":
                print("No option provided")

            elif choice in all_config_vars.keys():
                value = input("Provide new value  for [{}]: ".format(choice))
                value = value.strip().upper()
                if value == "EXIT":
                    return self.settings()
                else:
                    Console.start_loading("Updating Config")
                    status, msg = Config.update_global_var(choice, value)
                    time.sleep(2)
                    Console.stop_loading()
                    if status is True:
                        print("[ SUCCESS ] - Config successfully set ")
                        time.sleep(3)
                    else:
                        print("[ FAILURE ] - {}".format(msg))
                        Auxiliaries.input_timeout(5)
                    return self.settings()
            else:
                print("Unknown key [ {} ] provided.".format(choice))
Beispiel #4
0
    def view_log(self):
        """
        *****************************************
        View Log

        *****************************************
        """

        prev_combined = ""
        while True:
            combined = ""
            for line in Auxiliaries.LOG_BUFFER:
                combined += "\n" + str(line[0])

            if prev_combined != combined:
                Console.clear_screen()
                print("{}\n\n  Press <Enter> to quit log ...".format(combined))
                if Auxiliaries.input_timeout(5) == "":
                    break
                prev_combined = combined
            else:
                if Auxiliaries.input_timeout(5) == "":
                    break
Beispiel #5
0
    def view_services(self):
        """
        *****************************************
        View Log

        *****************************************
        """
        prev_combined = ""

        while True:
            maestro_status = "OFF"
            distributor_status = "OFF"
            requestor_status = "OFF"

            if Maestro.get_service_status() is True:
                maestro_status = "RUNNING"
            if Distributor.get_service_status() is True:
                distributor_status = "RUNNING"
            if Requestor.get_service_status() is True:
                requestor_status = "RUNNING"

            maestro_last_message = Maestro.get_last_message()
            combined = "--> Maestro Service ({}) - {}\n\t|\t\n\t|--> Distributor service ( {} )\n\t|\n\t|--> Requestor Service ( {} ) \n\n\n".format(
                maestro_status, maestro_last_message, distributor_status,
                requestor_status)

            if prev_combined != combined:
                Console.app_title()
                Console.menu_title("Services")
                print("{}\n\n  Press <Enter> to quit log ...".format(combined))
                if Auxiliaries.input_timeout(5) == "":
                    break
                prev_combined = combined
            else:
                if Auxiliaries.input_timeout(5) == "":
                    break