コード例 #1
0
ファイル: main.py プロジェクト: catesandrew/tvnamer
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
ファイル: main.py プロジェクト: averissimo/tvnamer
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
ファイル: main.py プロジェクト: chainsawbike/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
コード例 #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)