def process_file(tvdb_instance, episode):
    # type: (tvdb_api.Tvdb, BaseInfo) -> None
    """Gets episode name, prompts user for input
    """
    print("#" * 20)
    print("# Processing file: %s" % episode.fullfilename)

    if len(Config["input_filename_replacements"]) > 0:
        replaced = _apply_replacements_input(episode.fullfilename)
        print("# With custom replacements: %s" % (replaced))

    # Use force_name option. Done after input_filename_replacements so
    # it can be used to skip the replacements easily
    if Config["force_name"] is not None:
        episode.seriesname = Config["force_name"]

    print("# Detected series: %s (%s)" % (episode.seriesname, episode.number_string()))

    try:
        episode.populate_from_tvdb(
            tvdb_instance,
            force_name=Config["force_name"],
            series_id=Config["series_id"],
        )
    except (DataRetrievalError, ShowNotFound) as errormsg:
        if Config["always_rename"] and Config["skip_file_on_error"] is True:
            if Config["skip_behaviour"] == "exit":
                warn("Exiting due to error: %s" % errormsg)
                raise SkipBehaviourAbort()
            warn("Skipping file due to error: %s" % errormsg)
            return
        else:
            warn("%s" % (errormsg))
    except (SeasonNotFound, EpisodeNotFound, EpisodeNameNotFound) as errormsg:
        # Show was found, so use corrected series name
        if Config["always_rename"] and Config["skip_file_on_error"]:
            if Config["skip_behaviour"] == "exit":
                warn("Exiting due to error: %s" % errormsg)
                raise SkipBehaviourAbort()
            warn("Skipping file due to error: %s" % errormsg)
            return

        warn("%s" % (errormsg))

    cnamer = Renamer(episode.fullpath)

    should_rename = False

    if Config["move_files_only"]:

        new_name = episode.fullfilename
        should_rename = True

    else:
        new_name = episode.generate_filename()
        if new_name == episode.fullfilename:
            print("#" * 20)
            print("Existing filename is correct: %s" % episode.fullfilename)
            print("#" * 20)

            should_rename = True

        else:
            print("#" * 20)
            print("Old filename: %s" % episode.fullfilename)

            if len(Config["output_filename_replacements"]) > 0:
                # Show filename without replacements
                print(
                    "Before custom output replacements: %s"
                    % (episode.generate_filename(preview_orig_filename=True))
                )

            print("New filename: %s" % new_name)

            if Config["dry_run"]:
                print("%s will be renamed to %s" % (episode.fullfilename, new_name))
                if Config["move_files_enable"]:
                    print(
                        "%s will be moved to %s"
                        % (new_name, get_move_destination(episode))
                    )
                return
            elif Config["always_rename"]:
                do_rename_file(cnamer, new_name)
                if Config["move_files_enable"]:
                    if Config["move_files_destination_is_filepath"]:
                        do_move_file(
                            cnamer=cnamer, dest_filepath=get_move_destination(episode)
                        )
                    else:
                        do_move_file(cnamer=cnamer, dest_dir=get_move_destination(episode))
                return

            ans = confirm("Rename?", options=["y", "n", "a", "q"], default="y")

            if ans == "a":
                print("Always renaming")
                Config["always_rename"] = True
                should_rename = True
            elif ans == "q":
                print("Quitting")
                raise UserAbort("User exited with q")
            elif ans == "y":
                print("Renaming")
                should_rename = True
            elif ans == "n":
                print("Skipping")
            else:
                print("Invalid input, skipping")

            if should_rename:
                do_rename_file(cnamer, new_name)

    if should_rename and Config["move_files_enable"]:
        new_path = get_move_destination(episode)
        if Config["dry_run"]:
            print("%s will be moved to %s" % (new_name, get_move_destination(episode)))
            return

        if Config["move_files_destination_is_filepath"]:
            do_move_file(cnamer=cnamer, dest_filepath=new_path, get_path_preview=True)
        else:
            do_move_file(cnamer=cnamer, dest_dir=new_path, get_path_preview=True)

        if not Config["batch"] and Config["move_files_confirmation"]:
            ans = confirm("Move file?", options=["y", "n", "q"], default="y")
        else:
            ans = "y"

        if ans == "y":
            print("Moving file")
            do_move_file(cnamer, new_path)
        elif ans == "q":
            print("Quitting")
            raise UserAbort("user exited with q")
Gets episode name, prompts user for input
    
tvnamer/main.py