Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fb2f54a
Major code restructuration, improved file renaming/copying/moving.
Mar 3, 2013
cdd576f
Changed tests to pass recent changes. Problems only with 'test_forcef…
Mar 3, 2013
798a3d4
code cleanup
Mar 9, 2013
20fe883
Better lowercase and valid filename generation
Mar 9, 2013
4cc5829
Fix tests for change in lowercase handling
Mar 9, 2013
7d61417
wrap makeValidFilename() calls, fix test_with_invalid_seriesname and …
Mar 9, 2013
dd89b1a
Better episodename formatting
Mar 9, 2013
708fc07
Revert part of 05561eec760c57c43190762d4f7079782406fd91 - apply lower…
Mar 9, 2013
f2c7c83
Split test_functional.py into multiple files, fix some existing tests
Mar 9, 2013
33d2a1c
remove obsolete test - 'absoluteepisode' key is gone for a long time
Mar 9, 2013
34c7f29
Fixed test_forcefully_moving_default and test_forcefully_moving_disab…
Mar 9, 2013
affde31
Simplified EpisodeInfo classes - better attribute handling
Mar 9, 2013
a209e5a
Improved logging, support for logging into file and console at the sa…
Mar 10, 2013
ed1b685
Use 'atexit' module to automatically cleanup dummy files (in case the…
Mar 10, 2013
5049908
Major code rewrite - backward incompatible changes to config file!
Mar 10, 2013
963e386
Check config file version and notify users to merge updates; added Ch…
Mar 10, 2013
090637b
Simplify creating EpisodeInfo instances
Mar 11, 2013
c87b4a3
fixed test_series_id_with_nameless_series
Apr 14, 2013
04773de
Got rid of DatedEpisodeInfo, NoSeasonEpisodeInfo, AnimeEpisodeInfo ob…
May 15, 2013
e558e72
Moved some functions into formatting.py (utils.py is too long)
May 15, 2013
166bacc
added EpisodeInfo.getNewFullPath() method (moved from main.py), FileP…
May 16, 2013
9ca9d8e
fixed tests for lahwaacz/tvnamer@166bacc
May 16, 2013
5eb6939
fixed test: messed up with 'NFL Total Access'
May 16, 2013
13af39b
automatic property handling for EpisodeInfo class
May 17, 2013
18e04bb
explicitly convert seasonnumber to int
May 17, 2013
42d2570
corrected several typos, cleaned unused imports etc.
May 17, 2013
1d5cbaa
TVDB data change
dbr Aug 8, 2013
17d681e
Unicode normalization of filenames causes problems on OS X
dbr Aug 8, 2013
16adc27
move tvnamer started/exited messages to debug level
May 29, 2013
89f825a
UI: make sure displayed new path is absolute
May 29, 2013
aeeb375
UI: improved filename info output
May 29, 2013
c99e916
PEP-8 formatting
May 31, 2013
3d67701
quote seriesname in message texts to improve readability
Jun 7, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
3.0.0
* added 'dry_run' config option
* removed 'always_rename' and 'select_first' config options, simply 'batch'
mode is enough (in interactive mode you can still select to autorename files
from now on)
* added support for logging into file ('log_file' config option)
* 'titlecase_filename' and 'move_files_lowercase_destination' options
replaced with 'titlecase_dynamic_parts' and 'lowercase_dynamic_parts'
respectively
* In 'move_files_destination' variable, %(episodenumbers)s format parameter
is replaced with %(episode)s (as is used in 'filename_*' variables)
* Removed 'move_files_only' config option (all files are moved actualy, not
renamed). For preserving old behavior use %(originalfilename)s in
'move_files_destination' and set 'move_files_destination_is_filepath' to True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from setuptools import setup
setup(
name = 'tvnamer',
version=".".join(str(x) for x in __version__),
version=__version__,

author='dbr/Ben',
description='Automatic TV episode namer',
Expand Down
20 changes: 8 additions & 12 deletions tests/functional_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import shutil
import tempfile
import subprocess
import atexit

from tvnamer.unicode_helper import p, unicodify
from tvnamer import __version__


try:
Expand Down Expand Up @@ -113,13 +115,6 @@ def make_dummy_files(files, location):
return dummies


def clear_temp_dir(location):
"""Removes file or directory at specified location
"""
p("Clearing %s" % unicode(location))
shutil.rmtree(location)


def run_tvnamer(with_files, with_flags = None, with_input = "", with_config = None, run_on_directory = False):
"""Runs tvnamer on list of file-names in with_files.
with_files is a list of strings.
Expand All @@ -132,10 +127,16 @@ def run_tvnamer(with_files, with_flags = None, with_input = "", with_config = No
# Create dummy files (config and episodes)
tvnpath = get_tvnamer_path()
episodes_location = make_temp_dir()
# register cleanup function
atexit.register(shutil.rmtree, episodes_location)
dummy_files = make_dummy_files(with_files, episodes_location)

if with_config is not None:
# insert correct version into config
with_config = with_config.replace("{", """{"__version__": "%s",\n""" % __version__, 1)
configfname = make_temp_config(with_config)
# register cleanup function
atexit.register(os.unlink, configfname)
conf_args = ['-c', configfname]
else:
conf_args = []
Expand Down Expand Up @@ -173,11 +174,6 @@ def run_tvnamer(with_files, with_flags = None, with_input = "", with_config = No

created_files.extend(curlist)

# Clean up dummy files and config
clear_temp_dir(episodes_location)
if with_config is not None:
os.unlink(configfname)

return {
'output': output,
'files': created_files,
Expand Down
3 changes: 1 addition & 2 deletions tests/test_absolute_number_ambiguity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def test_ambiguity_fix():
"""

conf = """
{"always_rename": true,
"select_first": true}
{"batch": true}
"""

out_data = run_tvnamer(
Expand Down
10 changes: 4 additions & 6 deletions tests/test_anime_filenames.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ def test_group():
with_files = ['[Some Group] Scrubs - 01 [A1B2C3].avi'],
with_config = """
{
"always_rename": true,
"select_first": true,
"batch": true,

"filename_anime_with_episode": "[%(group)s] %(seriesname)s - %(episodenumber)s - %(episodename)s [%(crc)s]%(ext)s"
"filename_anime_with_episode": "[%(group)s] %(seriesname)s - %(episode)s - %(episodename)s [%(crc)s]%(ext)s"
}
""")

Expand All @@ -35,10 +34,9 @@ def test_group_no_epname():
with_files = ['[Some Group] Somefakeseries - 01 [A1B2C3].avi'],
with_config = """
{
"always_rename": true,
"select_first": true,
"batch": true,

"filename_anime_without_episode": "[%(group)s] %(seriesname)s - %(episodenumber)s [%(crc)s]%(ext)s"
"filename_anime_without_episode": "[%(group)s] %(seriesname)s - %(episode)s [%(crc)s]%(ext)s"
}
""")

Expand Down
88 changes: 14 additions & 74 deletions tests/test_configfunctional.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from functional_runner import run_tvnamer, verify_out_data
from nose.plugins.attrib import attr
from helpers import expected_failure


@attr("functional")
Expand All @@ -14,8 +13,7 @@ def test_batchconfig():
"""

conf = """
{"always_rename": true,
"select_first": true}
{"batch": true}
"""

out_data = run_tvnamer(
Expand All @@ -35,7 +33,7 @@ def test_skip_file_on_error():

conf = """
{"skip_file_on_error": true,
"always_rename": true}
"batch": true}
"""

out_data = run_tvnamer(
Expand All @@ -55,7 +53,7 @@ def test_do_not_skip_file_on_error():

conf = """
{"skip_file_on_error": false,
"always_rename": true}
"batch": true}
"""

out_data = run_tvnamer(
Expand All @@ -75,8 +73,7 @@ def test_lowercase_names():

conf = """
{"lowercase_filename": true,
"always_rename": true,
"select_first": true}
"batch": true}
"""

out_data = run_tvnamer(
Expand All @@ -97,8 +94,7 @@ def test_replace_with_underscore():
conf = """
{"custom_filename_character_blacklist": " ",
"replace_blacklisted_characters_with": "_",
"always_rename": true,
"select_first": true}
"batch": true}
"""

out_data = run_tvnamer(
Expand All @@ -111,38 +107,13 @@ def test_replace_with_underscore():
verify_out_data(out_data, expected_files)


@attr("functional")
@expected_failure
def test_abs_epnmber():
"""Ensure the absolute episode number is available for custom
filenames in config
"""


conf = """
{"filename_with_episode": "%(seriesname)s - %(absoluteepisode)s%(ext)s",
"always_rename": true,
"select_first": true}
"""

out_data = run_tvnamer(
with_files = ['scrubs.s01e01.avi'],
with_config = conf,
with_input = "")

expected_files = ['Scrubs - 01.avi']

verify_out_data(out_data, expected_files)


@attr("functional")
def test_resolve_absoloute_episode():
"""Test resolving by absolute episode number
"""

conf = """
{"always_rename": true,
"select_first": true}
{"batch": true}
"""

out_data = run_tvnamer(
Expand Down Expand Up @@ -171,8 +142,7 @@ def test_valid_extension_recursive():
"""

conf = """
{"always_rename": true,
"select_first": true,
{"batch": true,
"valid_extensions": ["avi","mp4","m4v","wmv","mkv","mov","srt"],
"recursive": true}
"""
Expand All @@ -194,8 +164,7 @@ def test_replace_ands():
"""

conf = r"""
{"always_rename": true,
"select_first": true,
{"batch": true,
"input_filename_replacements": [
{"is_regex": true,
"match": "(\\Wand\\W| & )",
Expand All @@ -221,8 +190,7 @@ def test_replace_ands_in_output_also():
"""

conf = r"""
{"always_rename": true,
"select_first": true,
{"batch": true,
"input_filename_replacements": [
{"is_regex": true,
"match": "(\\Wand\\W| & )",
Expand Down Expand Up @@ -253,9 +221,8 @@ def test_force_overwrite_enabled():
"""

conf = r"""
{"always_rename": true,
"select_first": true,
"overwrite_destination_on_rename": true
{"batch": true,
"overwrite_destination": true
}
"""

Expand All @@ -276,9 +243,8 @@ def test_force_overwrite_disabled():
"""

conf = r"""
{"always_rename": true,
"select_first": true,
"overwrite_destination_on_rename": false
{"batch": true,
"overwrite_destination": false
}
"""

Expand All @@ -299,9 +265,7 @@ def test_force_overwrite_default():
"""

conf = r"""
{"always_rename": true,
"select_first": true
}
{"batch": true}
"""

out_data = run_tvnamer(
Expand All @@ -313,27 +277,3 @@ def test_force_overwrite_default():
expected_files = ['Scrubs - [01x01] - My First Day.avi', 'scrubs - [01x01].avi']

verify_out_data(out_data, expected_files)


@attr("functional")
def test_titlecase():
"""Tests Title Case Option To Make Episodes Like This
"""

conf = r"""
{"always_rename": true,
"select_first": true,
"skip_file_on_error": false,
"titlecase_filename": true
}
"""

out_data = run_tvnamer(
with_files = ['this.is.a.fake.episode.s01e01.avi'],
with_config = conf,
with_input = "",
run_on_directory = True)

expected_files = ['This Is a Fake Episode - [01x01].avi']

verify_out_data(out_data, expected_files)
Loading