示例#1
0
def getMoveDestination(episode):
    """Constructs the location to move/copy the file
    """

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

    # Calls makeValidFilename on series name, as it must valid for a filename
    if isinstance(episode, DatedEpisodeInfo):
        print Config['move_files_destination_date']
        destdir = Config['move_files_destination_date'] % {
            'seriesname': makeValidFilename(episode.seriesname),
            'year': episode.episodenumbers[0].year,
            'month': episode.episodenumbers[0].month,
            'day': episode.episodenumbers[0].day,
            'originalfilename': episode.originalfilename,
        }
    elif isinstance(episode, NoSeasonEpisodeInfo):
        destdir = Config['move_files_destination'] % {
            'seriesname':
            wrap_validfname(episode.seriesname),
            'episodenumbers':
            wrap_validfname(formatEpisodeNumbers(episode.episodenumbers)),
            'originalfilename':
            episode.originalfilename,
        }
    else:
        destdir = Config['move_files_destination'] % {
            'seriesname':
            wrap_validfname(episode.seriesname),
            'seasonnumber':
            episode.seasonnumber,
            'episodenumbers':
            wrap_validfname(formatEpisodeNumbers(episode.episodenumbers)),
            'originalfilename':
            episode.originalfilename,
        }
    return destdir
示例#2
0
文件: main.py 项目: Port3M5/tvnamer
def getDestinationFolder(episode):
    """Constructs the location to move/copy the file
    """

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


    # Calls makeValidFilename on series name, as it must valid for a filename
    destdir = Config['move_files_destination'] % {
        'seriesname': wrap_validfname(episode.seriesname),
        'seasonnumber': episode.seasonnumber,
        'episodenumbers': wrap_validfname(formatEpisodeNumbers(episode.episodenumbers))
    }
    return destdir
示例#3
0
def getDestinationFolder(episode):
    """Constructs the location to move/copy the file
    """

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

    # Calls makeValidFilename on series name, as it must valid for a filename
    destdir = Config['move_files_destination'] % {
        'seriesname':
        wrap_validfname(episode.seriesname),
        'seasonnumber':
        episode.seasonnumber,
        'episodenumbers':
        wrap_validfname(formatEpisodeNumbers(episode.episodenumbers))
    }
    return destdir
示例#4
0
文件: main.py 项目: gizmohd/tvnamer
def getDestinationFolder(episode):
    """Constructs the location to move/copy the file
    """

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

    # Calls makeValidFilename on series name, as it must valid for a filename
    if type(episode) == NoSeasonEpisodeInfo:
        destdirpattern = Config['move_files_destination_no_season']
    else:
        destdirpattern = Config['move_files_destination']

    destdir = destdirpattern % {
        'seriesname': wrap_validfname(episode.seriesname),
        'seasonnumber': episode.seasonnumber if hasattr(episode, "seasonnumber") else 1,
        'episodenumbers': wrap_validfname(formatEpisodeNumbers(episode.episodenumbers))
    }
    return destdir
示例#5
0
文件: main.py 项目: basti1/Sick-Beard
def getDestinationFolder(episode):
    """Constructs the location to move/copy the file
    """
    destdir = Config['move_files_destination'] % {
        'seriesname': episode.seriesname,
        'seasonnumber': episode.seasonnumber,
        'episodenumbers': formatEpisodeNumbers(episode.episodenumbers)
    }
    return destdir
示例#6
0
def getMoveDestination(episode):
    """Constructs the location to move/copy the file
    """

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


    # Calls makeValidFilename on series name, as it must valid for a filename
    if isinstance(episode, DatedEpisodeInfo):
        print Config['move_files_destination_date']
        destdir = Config['move_files_destination_date'] % {
            'seriesname': makeValidFilename(episode.seriesname),
            'year': episode.episodenumbers[0].year,
            'month': episode.episodenumbers[0].month,
            'day': episode.episodenumbers[0].day,
            'originalfilename': episode.originalfilename,
            }
    elif isinstance(episode, NoSeasonEpisodeInfo):
        destdir = Config['move_files_destination'] % {
            'seriesname': wrap_validfname(episode.seriesname),
            'episodenumbers': wrap_validfname(formatEpisodeNumbers(episode.episodenumbers)),
            'originalfilename': episode.originalfilename,
            'seasonnumber': 0,
            }
    else:
        destdir = Config['move_files_destination'] % {
            'seriesname': wrap_validfname(episode.seriesname),
            'seasonnumber': episode.seasonnumber,
            'episodenumbers': wrap_validfname(formatEpisodeNumbers(episode.episodenumbers)),
            'originalfilename': episode.originalfilename,
            }
    return destdir
示例#7
0
def getDestinationFolder(episode):
    """Constructs the location to move/copy the file
    """

    # Calls makeValidFilename on series name, as it must valid for a filename
    destdir = Config['move_files_destination'] % {
        'seriesname': makeValidFilename(episode.seriesname),
        'seasonnumber': episode.seasonnumber,
        'episodenumbers': makeValidFilename(formatEpisodeNumbers(episode.episodenumbers))
    }
    return destdir
示例#8
0
文件: main.py 项目: eregon/tvnamer
def getDestinationFolder(episode):
    """Constructs the location to move/copy the file
    """

    # Calls makeValidFilename on series name, as it must valid for a filename
    destdir = Config["move_files_destination"] % {
        "seriesname": makeValidFilename(episode.seriesname),
        "seasonnumber": episode.seasonnumber,
        "episodenumbers": makeValidFilename(formatEpisodeNumbers(episode.episodenumbers)),
    }
    return destdir
示例#9
0
文件: tv.py 项目: eyezak/videonamer
 def set_episodenumbers(self, episodenumbers):
     self.episodenumbers = episodenumbers
     if self.date_based:
         self.episode = str(episodenumbers[0])
     else:
         self.episode = formatEpisodeNumbers(self.episodenumbers)