def test_format_filename(self): self.CONF.set_override( 'filename_format_ep', 'S%(seasonnumber)02dE%(episode)s-%(episodename)s%(ext)s') self.CONF.set_override('output_filename_replacements', []) self.assertEqual( formatter.format_filename(None, 2, [2], ['The Codpiece Topology'], '.avi'), 'S02E02-The Codpiece Topology.avi') self.CONF.set_override( 'filename_format_ep', '%(seriesname)s - S%(seasonnumber)02dE%(episode)s-%(episodename)s%(ext)s' ) # noqa self.assertEqual( formatter.format_filename('the big bang theory', 2, [2], ['The Codpiece Topology'], '.avi'), 'The Big Bang Theory - S02E02-The Codpiece Topology.avi') # noqa self.CONF.set_override( 'filename_format_ep', '%(seriesname)s - S%(seasonnumber)02dE%(episode)s-%(episodename)s%(ext)s' ) # noqa self.CONF.set_override('output_filename_replacements', [{ 'match': 'Heartland (2007) (CA)', 'replacement': 'Heartland (CA)' }]) self.assertEqual( formatter.format_filename('Heartland (2007) (CA)', 2, [2], ['Letting Go'], '.mp4'), 'Heartland (CA) - S02E02-Letting Go.mp4')
def test_format_filename(self): self.CONF.set_override( 'filename_format_ep', 'S%(seasonnumber)02dE%(episode)s-%(episodename)s%(ext)s') self.CONF.set_override('output_filename_replacements', []) self.assertEqual(formatter.format_filename(None, 2, [2], ['The Codpiece Topology'], '.avi'), 'S02E02-The Codpiece Topology.avi') self.CONF.set_override( 'filename_format_ep', '%(seriesname)s - S%(seasonnumber)02dE%(episode)s-%(episodename)s%(ext)s') # noqa self.assertEqual(formatter.format_filename('the big bang theory', 2, [2], ['The Codpiece Topology'], '.avi'), 'The Big Bang Theory - S02E02-The Codpiece Topology.avi') # noqa self.CONF.set_override( 'filename_format_ep', '%(seriesname)s - S%(seasonnumber)02dE%(episode)s-%(episodename)s%(ext)s') # noqa self.CONF.set_override('output_filename_replacements', [{'match': 'Heartland (2007) (CA)', 'replacement': 'Heartland (CA)'}]) self.assertEqual(formatter.format_filename('Heartland (2007) (CA)', 2, [2], ['Letting Go'], '.mp4'), 'Heartland (CA) - S02E02-Letting Go.mp4')
def format_name(self): """Formats the media file based on enhanced metadata. The actual name of the file and even the name of the directory structure where the file is to be stored. """ self.formatted_filename = formatter.format_filename( self.series_name, self.season_number, self.episode_numbers, self.episode_names, self.extension) self.formatted_dirname = self.location if cfg.CONF.move_files_enabled: self.formatted_dirname = formatter.format_location( self.series_name, self.season_number) self.out_location = os.path.join(self.formatted_dirname, self.formatted_filename)