def get_parms():
    """ Query the user for the CDM library and manifold
        Keyword arguments:
            None
        Returns:
            None
    """
    if not ARG.LIBRARY:
        print("Select a library:")
        cdmlist = list()
        for cdmlib in CDM:
            if CDM[cdmlib]['name'] not in cdmlist:
                cdmlist.append(CDM[cdmlib]['name'])
        terminal_menu = TerminalMenu(cdmlist)
        chosen = terminal_menu.show()
        if chosen is None:
            LOGGER.error("No library selected")
            sys.exit(0)
        ARG.LIBRARY = cdmlist[chosen].replace(' ', '_')
    if not ARG.MANIFOLD:
        print("Select manifold to run on:")
        manifold = ['dev', 'prod']
        terminal_menu = TerminalMenu(manifold)
        chosen = terminal_menu.show()
        if chosen is None:
            LOGGER.error("No manifold selected")
            sys.exit(0)
        ARG.MANIFOLD = manifold[chosen]
    for cdmlib in CDM:
        if CDM[cdmlib]['name'].replace(' ', '_') == ARG.LIBRARY:
            print("Library %s was last modified on %s on %s"
                  % (CDM[cdmlib]['name'], CDM[cdmlib]['manifold'], CDM[cdmlib]['updated']))
            break
示例#2
0
def main():
    function_menu = TerminalMenu(
        ["Encriptar", "Decriptar"],
        title="Chose your destiny:",
    )
    function_index = function_menu.show()
    global salt

    if function_index == 0:  #encrypt
        entry_mode_menu = TerminalMenu(
            ["Digitar", "Arquivo"],
            title="Modo de Entrada:",
        )
        input_mode = entry_mode_menu.show()
        message = ""
        if input_mode == 0:  # input do usuario
            message = input("Mensagem: ")

        elif input_mode == 1:  # arquivo
            filePath = input("Nome do arquivo: ")
            with open(filePath, "rb") as file:
                message = file.read()
                message = message.decode("utf-8", errors="ignore")

        encrypt_mode_menu = TerminalMenu(
            ["Encrypt-then-MAC", "Encrypt-and-MAC", "MAC-then-Encrypt"],
            title="Modo de autenticação:")
        menu_entry_index = encrypt_mode_menu.show()
        password = input("Digite a senha de encriptação: ")
        key = gerar_chave(password)

        encrypted_text = encriptar(message, key, menu_entry_index)

        file_name = input("Nome do arquivo encriptado: ")
        with open(file_name, "wb") as out_file:
            out_file.write(encrypted_text)
        with open(file_name + ".salt", "wb") as out_file:
            out_file.write(salt)

    elif function_index == 1:  #decrypt
        file_name = input("Nome do arquivo: ")
        encrypt_mode_menu = TerminalMenu(
            ["Encrypt-then-MAC", "Encrypt-and-MAC", "MAC-then-Encrypt"],
            title="Modo de autenticação:")
        menu_entry_index = encrypt_mode_menu.show()
        password = input("Digite a senha: ")

        with open(file_name + ".salt", "rb") as file:
            salt = file.read()

        key = recuperar_chave(password, salt)
        encrypted_file = ""
        with open(file_name, "rb") as file:
            encrypted_file = file.read()

        decrypted_file = decriptar(encrypted_file, key, menu_entry_index)

        with open(file_name + "decrypted", "w") as out_file:
            out_file.write(decrypted_file)
示例#3
0
def main():
    main_menu_title = "  Main Menu\n"
    main_menu_items = ["Edit Menu", "Second Item", "Third Item", "Quit"]
    main_menu_cursor = "> "
    main_menu_cursor_style = ("fg_red", "bold")
    main_menu_style = ("bg_red", "fg_yellow")
    main_menu_exit = False

    main_menu = TerminalMenu(menu_entries=main_menu_items,
                             title=main_menu_title,
                             menu_cursor=main_menu_cursor,
                             menu_cursor_style=main_menu_cursor_style,
                             menu_highlight_style=main_menu_style,
                             cycle_cursor=True)

    edit_menu_title = "  Edit Menu\n"
    edit_menu_items = ["Edit Config", "Save Settings", "Back to Main Menu"]
    edit_menu_back = False
    edit_menu = TerminalMenu(edit_menu_items,
                             edit_menu_title,
                             main_menu_cursor,
                             main_menu_cursor_style,
                             main_menu_style)

    while not main_menu_exit:
        os.system('clear')
        main_sel = main_menu.show()

        if main_sel == 0:
            while not edit_menu_back:
                os.system('clear')
                edit_sel = edit_menu.show()
                if edit_sel == 0:
                    print("Edit Config Selected")
                    time.sleep(5)
                elif edit_sel == 1:
                    print("Save Selected")
                    time.sleep(5)
                elif edit_sel == 2:
                    edit_menu_back = True
                    print("Back Selected")
            edit_menu_back = False
        elif main_sel == 1:
            print("option 2 selected")
            time.sleep(5)
        elif main_sel == 2:
            print("option 3 selected")
            time.sleep(5)
        elif main_sel == 3:
            main_menu_exit = True
            print("Quit Selected")
示例#4
0
def main():
    # define different menus and helper
    main_menu = TerminalMenu([
        "Generate band name", "Choose adjective and noun from database",
        "Generate band members", "Count adjectives and nouns in database"
    ],
                             title="Rock Band Generator v1.0\nSelect option:")
    adj_menu = TerminalMenu(fetch_adj, title="Choose adjective:")
    noun_menu = TerminalMenu(fetch_noun, title="Choose noun:")
    band_names_menu = TerminalMenu(
        fetch_band_names,
        title="Choose band name you wish to assign new band members")
    main_menu_exit = False
    menu_entry_index = main_menu.show()

    # main logic for each main menu option
    while not main_menu_exit:
        if menu_entry_index == 0:
            random_band_name()
            main_menu_exit = True
        elif menu_entry_index == 1:
            adj_menu_entry_index = adj_menu.show()
            global chosen_adj
            global chosen_noun
            chosen_adj = fetch_adj[adj_menu_entry_index]
            noun_menu_entry_index = noun_menu.show()
            chosen_noun = fetch_noun[noun_menu_entry_index]
            main_menu_exit = True
            user_generated_name()
        elif menu_entry_index == 2:
            band_names_menu_index = band_names_menu.show()
            v = vocalist.fetch_name()
            b = bass_guitarist.fetch_name()
            d = drummer.fetch_name()
            e = electric_guitarist.fetch_name()
            bi = band_names_menu_index + 1
            insert_members = f"INSERT OR REPLACE INTO bandmembers (vocalist,bass_guitarist,drummer,electric_guitarist, band_name_id) VALUES ('{v}','{b}','{d}','{e}',{bi})"
            cursor.execute(insert_members)
            conn.commit()
            main_menu_exit = True
            print(
                f"You've added:\n Vocalist: {v}\n Bass Guitarist: {b}\n Drummer: {d}\n Electric Guitarist: {e}\n To {fetch_band_names[band_names_menu_index]} band! :)"
            )
        elif menu_entry_index == 3:
            print(
                f"Currently, there is {fetch_adj_count} adjective(s) and {fetch_noun_count} noun(s) in the database"
            )
            main_menu_exit = True
        else:
            print("Nothing selected!")
示例#5
0
def main():
    main_menu_exit = False
    while not main_menu_exit:
        print('Seleccione una opcion: ')
        terminal_menu = TerminalMenu(
            ["Clima por ciudad", "Clima por coordenadas", "Pronostico por ciudad", "Pronostico por coordenadas", 'Salir'])
        menu_entry_index = terminal_menu.show()
        if(menu_entry_index == 0):
            city = input(str("Ingrese ciudad: "))
            data = get_weather(city)
            show_weather(data)
            input(menu)
        elif(menu_entry_index == 1):
            lat = input("Ingrese latitud: ")
            lon = input("Ingrese longitud: ")
            data = get_weather(None, lat, lon)
            show_weather(data)
            input(menu)
        elif(menu_entry_index == 2):
            city = input(str("Ingrese ciudad: "))
            data = get_forecast(city)
            show_forecast(data)
            input(menu)
        elif(menu_entry_index == 3):
            lat = input("Ingrese latitud: ")
            lon = input("Ingrese longitud: ")
            data = get_forecast(None, lat, lon)
            show_forecast(data)
            input(menu)
        elif(menu_entry_index == 4):
            main_menu_exit = True
            print("Saliendo")
示例#6
0
def get_options():
    parser = argparse.ArgumentParser(description='Generate a bind/reverse shell')
    # Can't choose bind shell and reverse shell
    shelltype = parser.add_mutually_exclusive_group()
    shelltype.add_argument('-b', '--bind-shell', dest='SHELLTYPE', action='store_const', const='bind', help='Generate a bind shell (you connect to the target)')
    shelltype.add_argument('-r', '--reverse-shell', dest='SHELLTYPE', action='store_const', const='reverse', help='Generate a reverse shell (the target connects to you) (Default)')
    # Sets reverse shell as default value for SHELLTYPE (https://stackoverflow.com/questions/38507675/python-argparse-mutually-exclusive-group-with-default-if-no-argument-is-given)
    parser.set_defaults(SHELLTYPE = 'reverse')
    # Creates group of options for bindshell
    bindshell = parser.add_argument_group('Bind shell options')
    # typeoptions and portoption are two options either bindshell or revshell will need (https://stackoverflow.com/questions/23775378/allowing-same-option-in-different-argparser-group)
    typeoption = bindshell.add_argument('-t', '--type', dest='TYPE', type=str.lower, help='Type of the shell to generate (Bash, Powershell, Java...)')
    portoption = bindshell.add_argument('-p', '--port', dest='LPORT', type=int, help='Listener Port (required for reverse shells)')
    revshell = parser.add_argument_group('Reverse shell options')
    revshell._group_actions.append(typeoption)
    revshell.add_argument('-i', '--ip', dest='LHOST', type=str, help='Listener IP address (required for reverse shells)')
    revshell._group_actions.append(portoption)
    options = parser.parse_args()
    if options.SHELLTYPE == 'reverse' and not options.LHOST:
        parser.error('Listener IP address not supplied')
    if not options.LPORT:
        parser.error('Listener IP port not supplied')
    if not options.TYPE:
        if options.SHELLTYPE == 'reverse':
            shells_dict = revshells
        elif options.SHELLTYPE == 'bind':
            shells_dict = bindshells
        menu = TerminalMenu(list(shells_dict.keys()), title='What type of shell do you want?')
        selection = menu.show()
        options.TYPE = list(shells_dict.keys())[selection]
    return options
示例#7
0
def fixup(*, cli_args: str = None, doc: str = None):
    global log
    args = hedgehog.init(
        _init_fixup,
        arguments=cli_args,
        logger=True,
        argp_kwargs=dict(description=doc,
                         usage="%(prog)s [opts] [git-commit args]"),
    )
    log = logging.getLogger(args.prog_name)
    log.debug(args)
    lines = (common.git_command("log", "--oneline", "--decorate", "-n",
                                args.max_count).strip().splitlines())
    commits = [(line, line.split(maxsplit=1)[0]) for line in lines]
    log.debug_obj(commits, "Commits")
    menu = TerminalMenu(
        ("|".join(c) for c in commits),
        preview_command="git log -1 {}",
        cycle_cursor=False,
        preview_size=0.4,
        show_search_hint=True,
    )
    index = menu.show()
    if index is None:
        return
    log.debug("Selected index: %s, commit: %s", index, commits[index])

    git_args = [
        "commit",
        *args.remainder,
        args.commit_type,
        commits[index][1],
    ]
    common.print_git_command(git_args, f"   # ({commits[index][0]})")
    common.git_command(*git_args)
示例#8
0
def main():
    #tick_str = input("Ticker: ")
    #tick = yf.Ticker(tick_str)
    #tick_history = tick.history(period="max")
    #data = parse(tick.history(period="max"))
    #tick_history.to_csv('tmp.csv', encoding='utf-8', index=True)
    #print(tick_history)

    exit = 0
    while (exit == 0):
        title = "Select Mode"
        main_menu = TerminalMenu(
            ["Buy and Hold: Yr", "Buy and Hold: Day", "Exit"], title)
        selection = main_menu.show()
        if (selection == 0):
            min = int(input("min: "))
            max = int(input("max: ")) + 1
            range = int(input("range: "))
            buy_hold_year(min, max, range)
            #buy_hold_year(data, min, max,range)
        elif (selection == 1):
            min = int(input("min: "))
            max = int(input("max: ")) + 1
            range = int(input("range: "))
            buy_hold_day(min, max, range)
            #buy_hod_day(data, min, max, range)
        else:
            exit = 1
示例#9
0
def mainMenu():
    main_menu_title = ' Main Menu\n'
    main_menu_items = ['New room', 'Inventar', 'Teleport', 'Customize NOT WORKING PROPERLY !', 'Quit', ' ', 'Admin']

    main_menu = TerminalMenu (
        title = main_menu_title,
        menu_entries = main_menu_items,
        menu_cursor = menu_cursor,
        menu_cursor_style = menu_cursor_style,
        menu_highlight_style = menu_style,
        cycle_cursor = True,
        clear_screen = True
    )

    main_menu_exit = False

    #with open(str(player + '.purse'))

    while not main_menu_exit:
        main_sel = main_menu.show()

        if main_sel == 0:
            newRoom()
        elif main_sel == 1:
            Inventar()
        elif main_sel == 2:
            Teleport()
        elif main_sel == 3:
            Customize()
            main_menu_exit = True
        elif main_sel == 4:
            print('Quitting..')
            sys.exit()
        elif main_sel == 6:
            admin()
示例#10
0
def autodetect_codec(path):
    if re.search("h.264", path, re.IGNORECASE) != None and (
            re.search("blu", path, re.IGNORECASE) != None
            or re.search("web", path, re.IGNORECASE) == None):
        return 'h.264 Remux'
    elif re.search("h.265", path, re.IGNORECASE) != None and (
            re.search("blu", path, re.IGNORECASE) != None
            or re.search("web", path, re.IGNORECASE) == None):
        return 'x264'
    elif re.search("x265", path, re.IGNORECASE) != None:
        return 'x265'
    elif re.search("x264", path, re.IGNORECASE) != None:
        return 'x264'
    elif re.search("VC-1 Remux", path, re.IGNORECASE) != None:
        return 'VC-1 Remux'
    elif re.search("MPEG2 Remux", path, re.IGNORECASE) != None:
        return 'MPEG2 Remux'

    upstring = f"{os.path.basename(path)}\nWhat is the codec of the Upload?"
    print(upstring)

    options = [
        "x264", "h.264 Remux", "x265", "h.265 Remux", "VC-1 Remux"
        "MPEG2 Remux"
    ]

    if sys.platform != "win32":
        menu = TerminalMenu(options)
        menu_entry_index = menu.show()
    else:
        menu_entry_index = SelectionMenu.get_selection(options)
    value = options[menu_entry_index]
    return value
示例#11
0
def main():
    current_notes = _get_all_notes()
    
    def view_note(key: str): print("{0}: {1}".format(key,current_notes[key]))

    options = {}

    for k in list(current_notes.keys()):
        options[k] = view_note

    options["New Note"] = add_note
    options["Delete Note"] = remove_note
    options["Exit"] = leave

    choices: list = list(options.keys())

    menu = TerminalMenu(choices,title=colored('Notes (↑/↓)',color='blue'))

    choice = menu.show()
    choice = choices[choice]

    os.system('clear')

    if choice not in list(current_notes.keys()):
        options[choice]()
    else:
        options[choice](key=choice)
示例#12
0
def colorScheme():
    menu_title = ' Select a Color Scheme'
    menu_items = ['red', 'blue', 'back']
    menu_back = False

    menu_back = False

    menu = TerminalMenu(
        title = menu_title,
        menu_entries = menu_items,
        menu_cursor = '-> ',
        menu_cursor_style = ('fg_red', 'bold'),
        menu_highlight_style = ('bg_red', 'fg_yellow'),
        cycle_cursor = True,
        clear_screen = True
    )

    global menu_cursor_style
    global menu_style

    while not menu_back:
        menu_sel = menu.show()
        if menu_sel == 0:
            menu_style = ('bg_red', 'fg_yellow')
            menu_cursor_style = ('bg_red', 'bold')
        elif menu_sel == 1:
            menu_style = ('bg_blue', 'fg_gray')
            menu_cursor_style = ('bg_blue', 'bold')
        if menu_sel == 2:
            menu_back = True
            Customize()
示例#13
0
def menu(items,
         backFunc=exit,
         preview_command=None,
         preview_size=0.25,
         title=None):
    items.insert(0, '<--')
    items = [
        '{} | {}'.format(item, str(index)) for index, item in enumerate(items)
    ]

    terminal_menu = TerminalMenu(items,
                                 title,
                                 show_search_hint=True,
                                 preview_command=preview_command,
                                 preview_size=preview_size,
                                 clear_screen=True)
    selected_index = terminal_menu.show()

    if selected_index == 0:
        backFunc()

    if not selected_index:
        exit()

    return selected_index - 1
示例#14
0
def shader(fn, width, height, shader, ten_bit, outname):
    clear()  
    files = []
    if os.path.isdir(fn):   
        for file in glob.glob(os.path.join(fn, "*.mkv")):
            files.append(os.path.join(file))
    else:
        remove_audio_and_subs(fn)
        fn = "temp.mkv"
        clear()


    cg_menu = TerminalMenu(
        ["CPU (only x264 4:4:4) - needs to be converted to x265 later with ffmpeg", 
        "GPU (NVENC HEVC/X265 - may result in lower quality than CPU) - NVIDIA ONLY - no conversation necessary" 
        ],
        title="Choose what to use when encoding after applying shaders."
    )
    cg_choice = cg_menu.show()
    if cg_choice == 0:
        cpu_shader(fn, width, height, shader, ten_bit, outname, files=files)
    elif cg_choice == 1:
        gpu_shader(fn, width, height, shader, ten_bit, outname, files=files)
    else:
        print("Cancel")
        sys.exit(-2)
    
    if os.path.isdir(fn):
        os.remove("temp.mkv")
    else:
        os.remove(fn)
示例#15
0
 def navigate_questions_panel(self, playbook=False):
     # Code for navigating through the question panel
     if playbook:
         message = 'Playbook Questions'
         instructions = ". Press 'd' to delete from playbook"
         keys = ('enter', 'd')
     else:
         message = 'Relevant Questions'
         instructions = ". Press 'p' to save in playbook"
         keys = ('enter', 'p')
     console.rule('[bold blue] {}'.format(message), style="bold red")
     console.print("[yellow] Use arrow keys to navigate." +
                    "'q' or 'Esc' to quit. 'Enter' to open in a browser" +
                   instructions)
     console.print()
     options = ["|".join(map(str, question)) for question in self.questions_data]
     question_menu = TerminalMenu(options,
                                  preview_command=self.return_formatted_ans,
                                  preview_size=0.75, accept_keys=keys)
     quitting = False
     while not(quitting):
         options_index = question_menu.show()
         try:
             question_link = self.questions_data[options_index][2]
         except Exception:
             return sys.exit() if playbook else None
         else:
             if(question_menu.chosen_accept_key == 'enter'):
                 webbrowser.open(question_link)
             elif(question_menu.chosen_accept_key == 'p'):
                 self.playbook.\
                 add_to_playbook(self, self.questions_data[options_index][1])
             elif(question_menu.chosen_accept_key == 'd' and playbook):
                 self.playbook.\
                 delete_from_playbook(self, self.questions_data[options_index][1])
示例#16
0
    def mainMenu(self):
        """Menu for the application."""
        main_menu_title = "DBA Price predictor for Bang & Olufsen items\n             By Casper P\n"
        main_menu_items = ["Scrape DBA", "Train model", "Predict price", "Quit"]
        main_menu_cursor = "           > "
        main_menu_cursor_style = ("fg_red", "bold")
        main_menu_style = ("bg_blue", "fg_yellow")
        main_menu_exit = False

        main_menu = TerminalMenu(menu_entries=main_menu_items,
                                 title=main_menu_title,
                                 menu_cursor=main_menu_cursor,
                                 menu_cursor_style=main_menu_cursor_style,
                                 menu_highlight_style=main_menu_style,
                                 cycle_cursor=True,
                                 clear_screen=True)
        while not main_menu_exit:
            main_sel = main_menu.show()

            if main_sel == 0:
                self.scrape()
                time.sleep(3)
            elif main_sel == 1:
                self.train()
            elif main_sel == 2:
                self.trainer.predict()
                input("Press enter for main menu")
            elif main_sel == 3:
                main_menu_exit = True
示例#17
0
def confirmSelection():
    options = buildMenuOptions(["Yes", "No"])
    terminal_menu = TerminalMenu(
        options,
        title="Do you want to confirm project initialization?")  # noqa: E501
    menu_entry_index = terminal_menu.show()
    return scaffold() if menu_entry_index == 1 else True
示例#18
0
def choose():
     """!!!this is f*****g wrong intendet!!!"""
     menu_title = ' Choose what you want to choose'
     menu_items = ['weapons', 'armor', 'back']
     menu_back = False

     menu = TerminalMenu (
         title = menu_title,
         menu_entries = menu_items,
         menu_cursor = menu_cursor,
         menu_cursor_style = menu_cursor_style,
         menu_highlight_style = menu_style,
         cycle_cursor = True,
         clear_screen = True
     )

     while not menu_back:
         menu_sel = menu.show()
         if menu_sel == 0:
             chooseWeapon()
         elif menu_sel == 1:
             chooseArmor()
         elif menu_sel == 2:
             print('going back')
             menu_back = True
示例#19
0
def search_video_yt(options):
    youtube = build(config.YT_API_SERVICE_NAME,
                    config.YT_API_VERSION,
                    developerKey=config.DEVELOPER_KEY)

    search_response = youtube.search().list(q=options.q,
                                            part='id, snippet',
                                            maxResults=int(options.max_results) + 1)\
                                      .execute()
    videos = []
    videos_id = []

    for search_result in search_response.get("items", []):
        if search_result["id"]["kind"] == "youtube#video":
            videos.append(search_result["snippet"]["title"])
            videos_id.append(search_result["id"]["videoId"])

    video_titles_without_emojis = []

    for video in videos:
        removing_emoji = remove_emoji(video)
        video_titles_without_emojis.append(removing_emoji)

    print(colored("Choose your video:", 'grey', 'on_white'))

    terminal_menu = TerminalMenu(video_titles_without_emojis)
    menu_entry_index = terminal_menu.show()

    return videos_id[menu_entry_index]
示例#20
0
def _view_test():
    """Test function for view"""
    ar = aruco.Dictionary_get(aruco.DICT_6X6_250)
    param = aruco.DetectorParameters_create()
    # fname="../datasets/P2/images/093440.jpg"   # ids[4,3,8,9,11]
    fname = "../datasets/P2/images/093428.jpg"  # ids[0,4,5,6,7,9,11]
    img = cv2.imread(fname)
    cam = Camera("mobile")
    cam.read_param()
    v = View(fname, img, ar, param, 171 / 1000, cam)
    print(v)
    print("Show image")
    cv2.imwrite("../logs/temp.jpg", v.img)
    tmen = TerminalMenu(['No', 'Yes'])
    if tmen.show() == 1:
        print("Showing image")
        scale_percent = 40  # percent of original size
        width = int(v.img.shape[1] * scale_percent / 100)
        height = int(v.img.shape[0] * scale_percent / 100)
        dim = (width, height)
        # resize image
        resized = cv2.resize(v.img, dim, interpolation=cv2.INTER_AREA)
        cv2.imshow(fname, resized)
        cv2.waitKey(0)
    else:
        print("Did not show menu")
示例#21
0
def menu(title, menu_list):
    if platform.system() == 'Windows':
        selection = SelectionMenu.get_selection(menu_list, title=title, show_exit_option=False)
    else:
        menu = TerminalMenu(menu_list, title=title)
        selection = menu.show()
    return menu_list[selection]
示例#22
0
def encode_to_hevc(fn, out):
    param_line = "crf=18.0:limit-sao=1:bframes=8:aq-mode=3:psy-rd=1.0"

    detail_menu = TerminalMenu([
        "(Recommended if you dont know) One Setting to rule them all",
        "(e.g Your Name) Flat, slow anime (slice of life, everything is well lit)",
        "(e.g Kimetsu no Yaiba) Some dark scene, some battle scene (shonen, historical, etc.)",
        "(Rarely used) [TV Series] Movie-tier dark scene, complex grain/detail",
        "(Rarely used) [Movie] Movie-tier dark scene, complex grain/detail",
    ],
                               title="Choose the encode options")

    choice = detail_menu.show()
    # Flat, slow anime (slice of life, everything is well lit)
    if choice == 1:
        param_line = "crf=19.0:bframes=8:aq-mode=3:psy-rd=1:aq-strength=0.8:deblock=1,1"
    #Some dark scene, some battle scene (shonen, historical, etc.)
    elif choice == 2:
        param_line = "crf=18.0:bframes=8:aq-mode=3:psy-rd=1.5:psy-rdoq=2"
    #[TV Series] Movie-tier dark scene, complex grain/detail
    elif choice == 3:
        param_line = "crf=18.0:limit-sao=1:bframes=8:aq-mode=3:psy-rd=1.5:psy-rdoq=3.5"
    #[Movie] Movie-tier dark scene, complex grain/detail
    elif choice == 4:
        param_line = "crf=16.0:limit-sao=1:bframes=8:aq-mode=3:psy-rd=1.5:psy-rdoq=3.5"

    if is_tool("ffmpeg-bar"):
        binary = "ffmpeg-bar"
    else:
        binary = "ffmpeg"

    files = []
    if os.path.isdir(fn):
        for file in glob.glob(os.path.join(fn, "*.mkv")):
            files.append(os.path.join(file))
    if len(files) == 0:
        cmd = [
            binary, "-hide_banner", "-i", fn, "-c:v", "libx265", "-profile:v",
            "main10", "-pix_fmt", "yuv420p10le", "-preset", "slow",
            "-x265-params", param_line, "-map", "0:v:0", "-f", "matroska",
            '-vf', 'scale=out_color_matrix=bt709', '-color_primaries', 'bt709',
            '-color_trc', 'bt709', '-colorspace', 'bt709', out
        ]
        subprocess.call(cmd)
    else:
        for f in files:
            clear()
            name = f.split("/")
            name = name[len(name) - 1]
            cmd = [
                binary, "-hide_banner", "-i", f, "-c:v", "libx265",
                "-profile:v", "main10", "-pix_fmt", "yuv420p10le", "-preset",
                "slow", "-x265-params", param_line, "-map", "0:v:0", "-f",
                "matroska", '-vf', 'scale=out_color_matrix=bt709',
                '-color_primaries', 'bt709', '-color_trc', 'bt709',
                '-colorspace', 'bt709',
                os.path.join(out, name)
            ]
            subprocess.call(cmd)
def choose_nb(directory):
    """ show select menu on command line to pick notebook """
    nbs = glob.glob(f"{directory}/*.ipynb")
    terminal_menu = TerminalMenu(nbs)
    idx = terminal_menu.show()

    if idx != None:
        return Path(nbs[idx])
示例#24
0
 def __analyze_saved(self):
     '''Analyzes a saved search'''
     menu = []
     for file in listdir('saved_searches/'):
         menu.append(file)
     if menu:
         menu.append('Exit')
         terminal_menu = TerminalMenu(
             menu, title='\nSelect a file you wish to analyze\n')
         menu_entry_index = terminal_menu.show()
         for file in listdir('saved_searches/'):
             if menu_entry_index == menu.index(file):
                 df = pd.read_csv(f'saved_searches/{file}')
                 while True:
                     menu = [
                         '1. Average price', '2. Types of properties',
                         '3. 2B/2B or more', '4. Exit'
                     ]
                     terminal_menu = TerminalMenu(
                         menu,
                         title=
                         '\nSelect the type of analysis you wish to perform\n'
                     )
                     menu_entry_index = terminal_menu.show()
                     # going over the menu choices
                     if menu_entry_index == 0:
                         print(
                             f"\n\t\tThe average price of property in your search is: ${round(df['Price'].mean(), 2)}\n"
                         )
                     elif menu_entry_index == 1:
                         print(
                             f"\n{df['Property Type'].value_counts().to_string()}\n"
                         )
                     elif menu_entry_index == 2:
                         mask = df['Bedrooms'] >= 2
                         mask1 = df['Bathrooms'] >= 2
                         print(
                             tabulate(df[mask & mask1],
                                      headers='keys',
                                      tablefmt='psql'))
                     elif menu_entry_index == 3:
                         break
             else:
                 pass
     elif not menu:
         print('\nYou have no saved searches.\n')
示例#25
0
def select_file():
    file_select_menu = TerminalMenu(["[1] File 1","[2] File 2","[3] File 3",
    "[4] File 4","[5] File 5","[6] File 6","[7] File 7","[8] File 8","[9] File 9","[a] File 10",
    "[b] File 11","[c] File 12","[d] File 13","[e] File 14","[f] File 15","[g] File 16"])
    result = file_select_menu.show()
    selected_save = f"file{result+1}.json"
    
    return selected_save
示例#26
0
 def __init__(self):
     '''initialize a search menu'''
     self.__search_input = {'offset': '0', 'limit': '50'}
     self.__search_results = {}
     # getting the api key from key chain
     self.__api_key = keyring.get_password('realtor', 'realtor')
     # Run the search menu
     print(
         '\n\tUse the search filters to customize your search. You can use City and State in combination or just a Zip Code.'
     )
     print(
         '\tYou cannot use both at the same time and they are required. The last value you submit from both will take precedence.\n'
     )
     while True:
         menu = [
             '1. City*', '2. State Code*', '3. Zip Code*', '4. Beds Min',
             '5. Bath Min', '6. Price Max', '7. Submit', '8. Exit'
         ]
         terminal_menu = TerminalMenu(menu, title='\nSearch Filters\n')
         menu_entry_index = terminal_menu.show()
         # going over the menu choices
         if menu_entry_index == 0:
             self.__search_input['city'] = input(
                 '\nEnter the name of the city you wish to search in: ')
             # if there is a zip value it gets removed from the dict
             if 'postal_code' in self.__search_input.keys():
                 del self.__search_input['postal_code']
         elif menu_entry_index == 1:
             self.__search_input['state_code'] = input(
                 '\nEnter the state code you wish to search in: ').upper()
             # if there is a zip value it gets removed from the dic
             if 'postal_code' in self.__search_input.keys():
                 del self.__search_input['postal_code']
         elif menu_entry_index == 2:
             self.__search_input['postal_code'] = input(
                 '\nEnter the zip code you wish to search in: ')
             # if there is city and state values they get removed form the dict
             if 'city' in self.__search_input.keys():
                 del self.__search_input['city']
             if 'state_code' in self.__search_input.keys():
                 del self.__search_input['state_code']
         elif menu_entry_index == 3:
             self.__search_input['beds_min'] = input(
                 '\nEnter minimum number of bedrooms: ')
         elif menu_entry_index == 4:
             self.__search_input['baths_min'] = input(
                 '\nEnter minimum number of bathrooms: ')
         elif menu_entry_index == 5:
             self.__search_input['price_max'] = input(
                 '\nEnter the maximum price: ')
         elif menu_entry_index == 6:
             if self.__submit_search():
                 df = pd.DataFrame(self.__search_results)
                 print(tabulate(df, headers='keys', tablefmt='psql'))
                 print('\nYou have successfully submitted your search.\n')
                 break
         elif menu_entry_index == 7:
             break
示例#27
0
 def __init__(self):
     '''Initializes a menu'''
     while True:
         menu = [
             '1. Analyze a new search', '2. Analyze a saved search',
             '3. Exit'
         ]
         terminal_menu = TerminalMenu(menu, title='\nANALYSIS MENU\n')
         menu_entry_index = terminal_menu.show()
         # going over the menu choices
         if menu_entry_index == 0:
             super().__init__()
             df = pd.DataFrame(self._Search__search_results)
             while True:
                 menu = [
                     '1. Average price', '2. Types of properties',
                     '3. 2B/2B or more', '4. Exit'
                 ]
                 terminal_menu = TerminalMenu(
                     menu,
                     title=
                     '\nSelect the type of analysis you wish to perform\n')
                 menu_entry_index = terminal_menu.show()
                 # going over the menu choices
                 if menu_entry_index == 0:
                     print(
                         f"\n\t\tThe average price of property in your search is: ${round(df['Price'].mean(), 2)}\n"
                     )
                 elif menu_entry_index == 1:
                     print(
                         f"\n{df['Property Type'].value_counts().to_string()}\n"
                     )
                 elif menu_entry_index == 2:
                     mask = df['Bedrooms'] >= 2
                     mask1 = df['Bathrooms'] >= 2
                     print(
                         tabulate(df[mask & mask1],
                                  headers='keys',
                                  tablefmt='psql'))
                 elif menu_entry_index == 3:
                     break
         elif menu_entry_index == 1:
             self.__analyze_saved()
         elif menu_entry_index == 2:
             break
示例#28
0
def start_app():
    print(f"{green_color}starting scripts app{black_color}")
    print("available apps: ")
    terminal_options = ['Image detection app', 'teste 2', 'teste 3']
    terminal_menu = TerminalMenu(terminal_options)
    selected_option_index = terminal_menu.show()

    if selected_option_index == 0:
        start_color_detection_app()
示例#29
0
def printMenu():
    try:
        menuOptionsConfig = menuOptions.optionsMenu
        menuOptionsTermnial = TerminalMenu(menuOptionsConfig,
                                           title="Select one option:")
        selectionIndex = menuOptionsTermnial.show()
        selectionMenu(selectionIndex)
    except ValueError:
        exceptions.printException(__name__)
示例#30
0
def main():
    if os.path.isdir('.git') is False:
        print('{}: not in a git repo'.format(name))
        return

    branches = os.listdir('.git/refs/heads')
    terminal_menu = TerminalMenu(branches, 'Checkout branch')
    result = terminal_menu.show()
    os.system('git checkout {}'.format(branches[result]))