def get_move_destination(episode):
    # type: (BaseInfo) -> str
    """Constructs the location to move/copy the file
    """

    # TODO: Write functional test to ensure this valid'ifying works
    def wrap_validfname(fname):
        # type: (str) -> str
        """Wrap the make_valid_filename function as it's called twice
        and this is slightly long..
        """
        if Config["move_files_lowercase_destination"]:
            fname = fname.lower()
        return make_valid_filename(
            fname,
            windows_safe=Config["windows_safe_filenames"],
            custom_blacklist=Config["custom_filename_character_blacklist"],
            replace_with=Config["replace_invalid_characters_with"],
        )

    # Calls make_valid_filename on series name, as it must valid for a filename
    if isinstance(episode, DatedEpisodeInfo):
        dest_dir = Config["move_files_destination_date"] % {
            "seriesname": make_valid_filename(episode.seriesname),
            "year": episode.episodenumbers[0].year,
            "month": episode.episodenumbers[0].month,
            "day": episode.episodenumbers[0].day,
            "originalfilename": episode.originalfilename,
        }
    elif isinstance(episode, NoSeasonEpisodeInfo):
        dest_dir = Config["move_files_destination"] % {
            "seriesname": wrap_validfname(episode.seriesname),
            "episodenumbers": wrap_validfname(
                format_episode_numbers(episode.episodenumbers)
            ),
            "originalfilename": episode.originalfilename,
        }
    elif isinstance(episode, EpisodeInfo):
        dest_dir = Config["move_files_destination"] % {
            "seriesname": wrap_validfname(episode.seriesname),
            "seasonnumber": episode.seasonnumber,
            "episodenumbers": wrap_validfname(
                format_episode_numbers(episode.episodenumbers)
            ),
            "originalfilename": episode.originalfilename,
        }
    else:
        raise RuntimeError("Unhandled episode subtype of %s" % type(episode))

    return dest_dir
Constructs the location to move/copy the file
    
tvnamer/main.py