コード例 #1
0
def test_multiep_different_names():
    """Default config - two different names are joined with 'multiep_join_name_with', 'multiep_format' doesn't matter
    """

    conf = """
    {
    "output_filename_replacements": [
        {"is_regex": false,
        "match": ":",
        "replacement": " -"}
    ],

    "multiep_join_name_with": ", ",
    "batch": true,
    "multiep_format": "%(foo)s"}
    """

    out_data = run_tvnamer(with_files=["star.trek.enterprise.s01e03e04.avi"],
                           with_config=conf,
                           with_input="")

    expected_files = [
        'Star Trek - Enterprise - [01x03-04] - Fight or Flight, Strange New World.avi'
    ]

    verify_out_data(out_data, expected_files)
コード例 #2
0
def test_multiep_same_names_without_number():
    """Default config - same names, ensure that missing number doesn't matter
    """

    conf = """
    {
    "output_filename_replacements": [
        {"is_regex": false,
        "match": ":",
        "replacement": " -"}
    ],

    "multiep_join_name_with": ", ",
    "batch": true,
    "multiep_format": "%(epname)s (Parts %(episodemin)s-%(episodemax)s)"}
    """

    out_data = run_tvnamer(
        with_files=["star.trek.deep.space.nine.s01e01e02.avi"],
        with_config=conf,
        with_input="")

    expected_files = [
        'Star Trek - Deep Space Nine - [01x01-02] - Emissary (Parts 1-2).avi'
    ]

    verify_out_data(out_data, expected_files)
コード例 #3
0
def test_multiep_same_names():
    """Default config - same names, format according to 'multiep_format', 'multiep_join_name_with' doesn't matter
    """

    conf = """
    {
    "output_filename_replacements": [
        {"is_regex": false,
        "match": ":",
        "replacement": " -"}
    ],
    "multiep_join_name_with": ", ",
    "batch": true,
    "multiep_format": "%(epname)s (%(episodemin)s-%(episodemax)s)"}
    """

    out_data = run_tvnamer(with_files=["star.trek.enterprise.s01e01e02.avi"],
                           with_config=conf,
                           with_input="")

    expected_files = [
        'Star Trek - Enterprise - [01x01-02] - Broken Bow (1-2).avi'
    ]

    verify_out_data(out_data, expected_files)
コード例 #4
0
def test_skipping_after_replacements():
    """When custom-replacement is specified, should still skip file if name is correct
    """

    conf = """
    {"select_first": true,
    "input_filename_replacements": [
        {"is_regex": false,
        "match": "v",
        "replacement": "u"}
    ],
    "output_filename_replacements": [
        {"is_regex": false,
        "match": "u",
        "replacement": "v"}
    ]
    }
    """

    out_data = run_tvnamer(with_files=['Scrvbs - [01x01] - My First Day.avi'],
                           with_config=conf,
                           with_input="")

    expected_files = ['Scrvbs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #5
0
def test_replacements_mulitple_Files():
    """Test for https://github.com/dbr/tvnamer/issues/150 - need to test replacement with multiple files specified
    """

    conf = r"""
    {"always_rename": true,
    "select_first": true,
    "skip_file_on_error": false,
    "input_series_replacements": {
        "Example": 153021
    }
    }
    """

    out_data = run_tvnamer(
        with_files=['Example.s01e01.avi', 'Scrubs.s01e01.avi'],
        with_config=conf,
        with_input="",
        run_on_directory=True)

    expected_files = [
        'The Walking Dead - [01x01] - Days Gone Bye.avi',
        'Scrubs - [01x01] - My First Day.avi'
    ]

    verify_out_data(out_data, expected_files)
コード例 #6
0
ファイル: test_configfunctional.py プロジェクト: dbr/tvnamer
def test_resolve_absoloute_episode():
    """Test resolving by absolute episode number
    """

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

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

    expected_files = ['[Bleachverse] Bleach - 310 - Ichigo\'s Resolution.avi']

    verify_out_data(out_data, expected_files)

    print("Checking output files are re-parsable")
    out_data = run_tvnamer(
        with_files = expected_files,
        with_config = conf,
        with_input = "")

    expected_files = ['[Bleachverse] Bleach - 310 - Ichigo\'s Resolution.avi']

    verify_out_data(out_data, expected_files)
コード例 #7
0
def test_resolve_absoloute_episode():
    """Test resolving by absolute episode number
    """

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

    out_data = run_tvnamer(
        with_files = ['[Bleachverse]_BLEACH_310.avi'],
        with_config = conf,
        with_flags=["--series-id=74796"], # Forcing series as `Bleach Kai` currently appears above Bleach in search results
        with_input = "")

    expected_files = ['[Bleachverse] Bleach - 310 - Ichigo\'s Resolution.avi']

    verify_out_data(out_data, expected_files)

    print("Checking output files are re-parsable")
    out_data = run_tvnamer(
        with_files = expected_files,
        with_config = conf,
        with_input = "")

    expected_files = ['[Bleachverse] Bleach - 310 - Ichigo\'s Resolution.avi']

    verify_out_data(out_data, expected_files)
コード例 #8
0
def test_extension_pattern_default():
    """Test default extension handling, no language codes
    """

    conf = r"""
    {"extension_pattern": "(\\.[a-zA-Z0-9]+)$",
    "batch": true,
    "valid_extensions": ["avi", "srt"]}
    """

    input_files = [
        "scrubs.s01e01.hdtv.fake.avi",
        "scrubs.s01e01.hdtv.fake.srt",
        "my.name.is.earl.s01e01.fake.avi",
        "my.name.is.earl.s01e01.some.other.fake.eng.srt",
    ]
    expected_files = [
        "Scrubs - [01x01] - My First Day.avi",
        "Scrubs - [01x01] - My First Day.srt",
        "My Name Is Earl - [01x01] - Pilot.avi",
        "My Name Is Earl - [01x01] - Pilot.srt",
    ]

    out_data = run_tvnamer(with_files=input_files,
                           with_config=conf,
                           with_input="")

    verify_out_data(out_data, expected_files)
コード例 #9
0
def test_replacements_applied_before_force_name():
    """input_filename_replacements apply to filename, before --name=SeriesName takes effect
    """

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

    "force_name": "Scrubs",

    "input_filename_replacements": [
        {"is_regex": true,
        "match": "S01E02 - ",
        "replacement": ""}
    ]
    }
    """

    out_data = run_tvnamer(
        with_files = ['S01E02 - Some File.avi'],
        with_config = conf)

    expected_files = ['S01E02 - Some File.avi']

    verify_out_data(out_data, expected_files, expected_returncode = 2)
コード例 #10
0
def test_extension_pattern_custom():
    """Test custom extension pattern, multiple language codes
    """

    conf = r"""
    {"extension_pattern": "((\\.|-)(eng|cze|EN|CZ)(?=\\.(sub|srt)))?(\\.[a-zA-Z0-9]+)$",
    "batch": true,
    "valid_extensions": ["avi", "srt"]}
    """

    input_files = [
        "scrubs.s01e01.hdtv.fake.avi",
        "scrubs.s01e01.hdtv.fake.srt",
        "scrubs.s01e01.hdtv.fake-CZ.srt",
        "scrubs.s01e01.hdtv.fake-EN.srt",
        "my.name.is.earl.s01e01.fake.avi",
        "my.name.is.earl.s01e01.some.other.fake.eng.srt",
        "my.name.is.earl.s01e01.fake.cze.srt",
    ]
    expected_files = [
        "Scrubs - [01x01] - My First Day.avi",
        "Scrubs - [01x01] - My First Day.srt",
        "Scrubs - [01x01] - My First Day-CZ.srt",
        "Scrubs - [01x01] - My First Day-EN.srt",
        "My Name Is Earl - [01x01] - Pilot.avi",
        "My Name Is Earl - [01x01] - Pilot.eng.srt",
        "My Name Is Earl - [01x01] - Pilot.cze.srt",
    ]

    out_data = run_tvnamer(with_files=input_files,
                           with_config=conf,
                           with_input="")

    verify_out_data(out_data, expected_files)
コード例 #11
0
ファイル: test_functional.py プロジェクト: Bernt87/tvnamer
def test_skipping_after_replacements():
    """When custom-replacement is specified, should still skip file if name is correct
    """

    conf = """
    {"select_first": true,
    "input_filename_replacements": [
        {"is_regex": false,
        "match": "v",
        "replacement": "u"}
    ],
    "output_filename_replacements": [
        {"is_regex": false,
        "match": "u",
        "replacement": "v"}
    ]
    }
    """

    out_data = run_tvnamer(
        with_files = ['Scrvbs - [01x01] - My First Day.avi'],
        with_config = conf,
        with_input = "")

    expected_files = ['Scrvbs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #12
0
def test_name_arg_skips_replacements():
    """Should not apply input_filename_replacements to --name=SeriesName arg value
    """

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

    "force_name": "Scrubs",

    "input_filename_replacements": [
        {"is_regex": true,
        "match": "Scrubs",
        "replacement": "Blahblahblah"}
    ]
    }
    """

    out_data = run_tvnamer(
        with_files = ['S01E02 - Some File.avi'],
        with_config = conf)

    expected_files = ['Scrubs - [01x02] - My Mentor.avi']

    verify_out_data(out_data, expected_files)
コード例 #13
0
def test_move_interactive_somefiles():
    """Tests interactive UI allows not renaming some files, renaming/moving others

    Rename and move first file, don't rename second file (so no move), and
    rename but do not move last file (Input is: y/y, n, y/n)
    """

    conf = """
    {"move_files_enable": true,
    "move_files_destination": "test",
    "select_first": true}
    """

    out_data = run_tvnamer(with_files=[
        'scrubs.s01e01.avi', 'scrubs.s01e02.avi', 'scrubs.s01e03.avi'
    ],
                           with_config=conf,
                           with_input="y\ny\nn\ny\nn\n")

    expected_files = [
        'test/Scrubs - [01x01] - My First Day.avi', 'scrubs.s01e02.avi',
        'Scrubs - [01x03] - My Best Friend\'s Mistake.avi'
    ]

    verify_out_data(out_data, expected_files)
コード例 #14
0
def test_replacing_ands():
    """Tests removind "and" and "&" from input files
    """
    out_data = run_tvnamer(
        with_files = ['Law & Order s01e01.avi'],
        with_config = """
{
    "input_filename_replacements": [
        {"is_regex": true,
        "match": "( and | & )",
        "replacement": " "}
    ],
    "output_filename_replacements": [
        {"is_regex": false,
        "match": " & ",
        "replacement": " and "}
    ],
    "always_rename": true,
    "select_first": true
}
""")

    expected_files = ['Law and Order - [01x01] - Prescription for Death.avi']

    verify_out_data(out_data, expected_files)
コード例 #15
0
def test_partial_blacklist_using_mix():
    """Tests single match of filename blacklist using a mix of regex and simple match
    """

    conf = """
    {"always_rename": true,
    "select_first": true,
    "filename_blacklist": [
        {"is_regex": true,
         "match": ".*s02e01.*"},
        {"is_regex": false,
         "match": "s02e02"}
        ]
    }
    """

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

    expected_files = [
        'Scrubs - [01x01] - My First Day.avi',
        'scrubs.s02e01.avi',
        'scrubs.s02e02.avi']

    verify_out_data(out_data, expected_files)
コード例 #16
0
def test_multiep_different_names():
    """Default config - two different names are joined with 'multiep_join_name_with', 'multiep_format' doesn't matter
    """

    conf = """
    {
    "output_filename_replacements": [
        {"is_regex": false,
        "match": ":",
        "replacement": " -"}
    ],

    "multiep_join_name_with": ", ",
    "batch": true,
    "multiep_format": "%(foo)s"}
    """

    out_data = run_tvnamer(
        with_files = ["star.trek.enterprise.s01e03e04.avi"],
        with_config = conf,
        with_input = "")

    expected_files = ['Star Trek - Enterprise - [01x03-04] - Fight or Flight, Strange New World.avi']

    verify_out_data(out_data, expected_files)
コード例 #17
0
def test_multiep_same_names_without_number():
    """Default config - same names, ensure that missing number doesn't matter
    """

    conf = """
    {
    "output_filename_replacements": [
        {"is_regex": false,
        "match": ":",
        "replacement": " -"}
    ],

    "multiep_join_name_with": ", ",
    "batch": true,
    "multiep_format": "%(epname)s (Parts %(episodemin)s-%(episodemax)s)"}
    """

    out_data = run_tvnamer(
        with_files = ["star.trek.deep.space.nine.s01e01e02.avi"],
        with_config = conf,
        with_input = "")

    expected_files = ['Star Trek - Deep Space Nine - [01x01-02] - Emissary (Parts 1-2).avi']

    verify_out_data(out_data, expected_files)
コード例 #18
0
def test_replacing_ands():
    """Tests removind "and" and "&" from input files
    """
    out_data = run_tvnamer(with_files=['Law & Order UK s01e01.avi'],
                           with_config="""
{
    "input_filename_replacements": [
        {"is_regex": true,
        "match": "( and | & )",
        "replacement": " "}
    ],
    "output_filename_replacements": [
        {"is_regex": false,
        "match": " & ",
        "replacement": " and "}
    ],
    "custom_filename_character_blacklist": ":",
    "always_rename": true,
    "select_first": true
}
""")

    expected_files = ['Law and Order_ UK - [01x01] - Care.avi']

    verify_out_data(out_data, expected_files)
コード例 #19
0
def test_extension_pattern_default():
    """Test default extension handling, no language codes
    """

    conf = r"""
    {"extension_pattern": "(\\.[a-zA-Z0-9]+)$",
    "batch": true,
    "valid_extensions": ["avi", "srt"]}
    """

    input_files = [
        "scrubs.s01e01.hdtv.fake.avi",
        "scrubs.s01e01.hdtv.fake.srt",
        "my.name.is.earl.s01e01.fake.avi",
        "my.name.is.earl.s01e01.some.other.fake.eng.srt",
    ]
    expected_files = [
        "Scrubs - [01x01] - My First Day.avi",
        "Scrubs - [01x01] - My First Day.srt",
        "My Name Is Earl - [01x01] - Pilot.avi",
        "My Name Is Earl - [01x01] - Pilot.srt",
    ]

    out_data = run_tvnamer(
        with_files = input_files,
        with_config = conf,
        with_input = "")

    verify_out_data(out_data, expected_files)
コード例 #20
0
def test_skip_behaviour_error():
    """An error with skip_behaviour 'exit' should end process
    """

    conf = """
    {"batch": true,
    "skip_behaviour": "exit"}
    """

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

    # Files are processed alphabetically, so file starting wiht S is never touched
    expected_files = ['scrubs.s01e01.avi', 'a.nonsense.fake.episode.s01e01.avi']

    verify_out_data(out_data, expected_files, expected_returncode=2)


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

    # Files are processed alphabetically, so file starting wiht S is never touched
    expected_files = ['Scrubs - [01x01] - My First Day.avi', 'z.fake.episode.s01e01.avi']

    verify_out_data(out_data, expected_files, expected_returncode=2)
コード例 #21
0
def test_dvd_order():
    """Tests TvDB dvd order naming
    """

    input_files = ['batman the animated series s01e01.xvid']

    expected_files = [
        'Batman - The Animated Series - [01x01] - On Leather Wings.xvid'
    ]

    conf = r"""
    {
      "output_filename_replacements": [
        {"is_regex": true,
        "match": ": ",
        "replacement": " - "}
      ]
    }
    """

    out_data = run_tvnamer(with_files=input_files,
                           with_flags=["--order", 'dvd'],
                           with_input="1\ny\n",
                           with_config=conf)

    verify_out_data(out_data, expected_files)
コード例 #22
0
def test_extension_pattern_custom():
    """Test custom extension pattern, multiple language codes
    """

    conf = r"""
    {"extension_pattern": "((\\.|-)(eng|cze|EN|CZ)(?=\\.(sub|srt)))?(\\.[a-zA-Z0-9]+)$",
    "batch": true,
    "valid_extensions": ["avi", "srt"]}
    """

    input_files = [
        "scrubs.s01e01.hdtv.fake.avi",
        "scrubs.s01e01.hdtv.fake.srt",
        "scrubs.s01e01.hdtv.fake-CZ.srt",
        "scrubs.s01e01.hdtv.fake-EN.srt",
        "my.name.is.earl.s01e01.fake.avi",
        "my.name.is.earl.s01e01.some.other.fake.eng.srt",
        "my.name.is.earl.s01e01.fake.cze.srt",
    ]
    expected_files = [
        "Scrubs - [01x01] - My First Day.avi",
        "Scrubs - [01x01] - My First Day.srt",
        "Scrubs - [01x01] - My First Day-CZ.srt",
        "Scrubs - [01x01] - My First Day-EN.srt",
        "My Name Is Earl - [01x01] - Pilot.avi",
        "My Name Is Earl - [01x01] - Pilot.eng.srt",
        "My Name Is Earl - [01x01] - Pilot.cze.srt",
    ]

    out_data = run_tvnamer(
        with_files = input_files,
        with_config = conf,
        with_input = "")

    verify_out_data(out_data, expected_files)
コード例 #23
0
def test_simple_blacklist_mixed():
    """Blacklist with simple strings, mixed with the more complex dict
    option (which allows regexs and matching against extension)
    """

    conf = """
    {"always_rename": true,
    "select_first": true,
    "filename_blacklist": [
            "scrubs.s02e01.avi",
            {"is_regex": true,
             "match": ".*s\\\\d+e02.*"}
        ]
    }
    """

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

    expected_files = [
        'Scrubs - [01x01] - My First Day.avi',
        'scrubs.s02e01.avi',
        'scrubs.s02e02.avi']

    verify_out_data(out_data, expected_files)
コード例 #24
0
ファイル: test_functional.py プロジェクト: Deathnerd/tvnamer
def test_dvd_order():
    """Tests TvDB dvd order naming
    """

    input_files = [
        'batman the animated series s01e01.xvid']

    expected_files = [
        'Batman - The Animated Series - [01x01] - On Leather Wings.xvid']

    conf = r"""
    {
      "output_filename_replacements": [
        {"is_regex": true,
        "match": ": ",
        "replacement": " - "}
      ]
    }
    """

    out_data = run_tvnamer(
        with_files = input_files,
        with_flags = ["--order", 'dvd'],
        with_input = "1\ny\n",
        with_config = conf)

    verify_out_data(out_data, expected_files)
コード例 #25
0
def test_partial_blacklist_using_mix():
    """Tests single match of filename blacklist using a mix of regex and simple match
    """

    conf = """
    {"always_rename": true,
    "select_first": true,
    "filename_blacklist": [
        {"is_regex": true,
         "match": ".*s02e01.*"},
        {"is_regex": false,
         "match": "s02e02"}
        ]
    }
    """

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

    expected_files = [
        'Scrubs - [01x01] - My First Day.avi',
        'scrubs.s02e01.avi',
        'scrubs.s02e02.avi']

    verify_out_data(out_data, expected_files)
コード例 #26
0
def test_resolve_absoloute_episode():
    """Test resolving by absolute episode number
    """

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

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

    expected_files = ['[Bleachverse] Bleach - 310 - Ichigo\'s Resolution.avi']

    verify_out_data(out_data, expected_files)

    print "Checking output files are re-parsable"
    out_data = run_tvnamer(with_files=expected_files,
                           with_config=conf,
                           with_input="")

    expected_files = ['[Bleachverse] Bleach - 310 - Ichigo\'s Resolution.avi']

    verify_out_data(out_data, expected_files)
コード例 #27
0
ファイル: test_configfunctional.py プロジェクト: dbr/tvnamer
def test_replace_ands_in_output_also():
    """Test replace "and" "&" for search, and replace & in output filename
    """

    conf = r"""
    {"always_rename": true,
    "select_first": true,
    "input_filename_replacements": [
        {"is_regex": true,
        "match": "(\\Wand\\W| & )",
        "replacement": " "}
    ],
    "output_filename_replacements": [
        {"is_regex": true,
        "match": " & ",
        "replacement": " and "}
    ]
    }
    """

    out_data = run_tvnamer(
        with_files = ['Brothers.and.Sisters.S05E16.HDTV.XviD-LOL.avi'],
        with_config = conf,
        with_input = "",
        run_on_directory = True)

    expected_files = ['Brothers and Sisters - [05x16] - Home Is Where The Fort Is.avi']

    verify_out_data(out_data, expected_files)
コード例 #28
0
def test_replace_ands_in_output_also():
    """Test replace "and" "&" for search, and replace & in output filename
    """

    conf = r"""
    {"always_rename": true,
    "select_first": true,
    "input_filename_replacements": [
        {"is_regex": true,
        "match": "(\\Wand\\W| & )",
        "replacement": " "}
    ],
    "output_filename_replacements": [
        {"is_regex": true,
        "match": " & ",
        "replacement": " and "}
    ]
    }
    """

    out_data = run_tvnamer(
        with_files = ['Brothers.and.Sisters.S05E16.HDTV.XviD-LOL.avi'],
        with_config = conf,
        with_input = "",
        run_on_directory = True)

    expected_files = ['Brothers and Sisters - [05x16] - Home Is Where The Fort Is.avi']

    verify_out_data(out_data, expected_files)
コード例 #29
0
ファイル: test_functional.py プロジェクト: Valodim/tvnamer
def test_simple_single_file():
    """Test most simple usage
    """

    out_data = run_tvnamer(with_files=["scrubs.s01e01.avi"], with_input="1\ny\n")

    expected_files = ["Scrubs - [01x01] - My First Day.avi"]

    verify_out_data(out_data, expected_files)
コード例 #30
0
ファイル: test_functional.py プロジェクト: Valodim/tvnamer
def test_filename_already_exists():
    """If the filename is already correct, don't prompt
    """

    out_data = run_tvnamer(with_files=["Scrubs - [01x01] - My First Day.avi", "scrubs.s01e01.avi"], with_input="1\ny\n")

    expected_files = ["Scrubs - [01x01] - My First Day.avi", "scrubs.s01e01.avi"]

    verify_out_data(out_data, expected_files)
コード例 #31
0
ファイル: test_invalid_files.py プロジェクト: sall/tvnamer
def test_simple_single_file():
    """Files without series name should be skipped
    """

    out_data = run_tvnamer(with_files=["S01E02 - Some File.avi"], with_flags=["--batch"])

    expected_files = ["S01E02 - Some File.avi"]

    verify_out_data(out_data, expected_files, expected_returncode=2)
コード例 #32
0
def test_simple_single_file():
    """Boring example
    """

    out_data = run_tvnamer(with_files=['Some File.avi'],
                           with_flags=["--batch"])

    expected_files = ['Some File.avi']

    verify_out_data(out_data, expected_files, expected_returncode=2)
コード例 #33
0
def test_simple_single_file_with_forced_seriesnames():
    """Specifying 's01e01.avi' should parse when --name=SeriesName arg is specified
    """

    out_data = run_tvnamer(with_files=['S01E02 - Some File.avi'],
                           with_flags=["--batch", '--name', 'Scrubs'])

    expected_files = ['Scrubs - [01x02] - My Mentor.avi']

    verify_out_data(out_data, expected_files)
コード例 #34
0
def test_no_series_name():
    """File without series name should be skipped (unless '--name=MySeries' arg is supplied)
    """

    out_data = run_tvnamer(with_files=['s01e01 Some File.avi'],
                           with_flags=["--batch"])

    expected_files = ['s01e01 Some File.avi']

    verify_out_data(out_data, expected_files, expected_returncode=2)
コード例 #35
0
def test_simple_single_file():
    """Files without series name should be skipped, unless --name=MySeries is specified
    """

    out_data = run_tvnamer(with_files=['S01E02 - Some File.avi'],
                           with_flags=["--batch"])

    expected_files = ['S01E02 - Some File.avi']

    verify_out_data(out_data, expected_files, expected_returncode=2)
コード例 #36
0
ファイル: test_functional.py プロジェクト: Valodim/tvnamer
def test_unicode_in_search_results():
    """Show with unicode in search results
    """
    input_files = ["psych.s04e11.avi"]

    expected_files = ["Psych - [04x11] - Thrill Seekers & Hell Raisers.avi"]

    out_data = run_tvnamer(with_files=input_files, with_input="1\ny\n")

    verify_out_data(out_data, expected_files)
コード例 #37
0
ファイル: test_functional.py プロジェクト: Valodim/tvnamer
def test_renaming_always_doesnt_overwrite():
    """If trying to rename a file that exists, should not create new file
    """
    input_files = ["Scrubs.s01e01.avi", "Scrubs - [01x01] - My First Day.avi"]

    expected_files = ["Scrubs.s01e01.avi", "Scrubs - [01x01] - My First Day.avi"]

    out_data = run_tvnamer(with_files=input_files, with_flags=["--batch"])

    verify_out_data(out_data, expected_files)
コード例 #38
0
ファイル: test_functional.py プロジェクト: Valodim/tvnamer
def test_not_recursive():
    """Tests the nested files aren't found when not recursive
    """
    input_files = ["Scrubs.s01e01.avi", "nested/subdir/Scrubs.s01e02.avi"]

    expected_files = ["Scrubs - [01x01] - My First Day.avi", "nested/subdir/Scrubs.s01e02.avi"]

    out_data = run_tvnamer(with_files=input_files, with_flags=["--not-recursive", "--batch"], run_on_directory=True)

    verify_out_data(out_data, expected_files)
コード例 #39
0
ファイル: test_functional.py プロジェクト: Valodim/tvnamer
def test_unicode_in_inputname():
    """Tests parsing a file with unicode in the input filename
    """
    input_files = [u"The Big Bang Theory - S02E07 - The Panty Pin\u0303ata Polarization.avi"]

    expected_files = [u"The Big Bang Theory - [02x07] - The Panty Pin\u0303ata Polarization.avi"]

    out_data = run_tvnamer(with_files=input_files, with_flags=["--batch"])

    verify_out_data(out_data, expected_files)
コード例 #40
0
def test_simple_single_file():
    """Test most simple usage
    """

    out_data = run_tvnamer(with_files=['scrubs.s01e01.avi'],
                           with_input="1\ny\n")

    expected_files = ['Scrubs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #41
0
def test_correct_filename():
    """If the filename is already correct, don't prompt
    """

    out_data = run_tvnamer(with_files=['Scrubs - [01x01] - My First Day.avi'],
                           with_input="1\ny\n")

    expected_files = ['Scrubs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #42
0
def test_no_seasonnumber():
    """Test episode with no series number
    """

    out_data = run_tvnamer(with_files=['scrubs.e01.avi'],
                           with_flags=['--batch'])

    expected_files = ['Scrubs - [01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #43
0
def test_unicode_in_search_results():
    """Show with unicode in search results
    """
    input_files = ['psych.s04e11.avi']

    expected_files = ['Psych - [04x11] - Thrill Seekers & Hell Raisers.avi']

    out_data = run_tvnamer(with_files=input_files, with_input='1\ny\n')

    verify_out_data(out_data, expected_files)
コード例 #44
0
 def _the_test():
     out_data = run_tvnamer(
         with_files=[
             curtest['in'],
         ],
         with_flags=['--batch'],
     )
     verify_out_data(out_data, [
         curtest['expected'],
     ])
コード例 #45
0
def test_cli_destination():
    """Tests specifying the destination via command line argument
    """

    out_data = run_tvnamer(
        with_files = ['scrubs.s01e01.avi'],
        with_flags = ['--batch', '--move', '--movedestination=season %(seasonnumber)d/'])

    expected_files = ['season 1/Scrubs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #46
0
ファイル: test_invalid_files.py プロジェクト: Bernt87/tvnamer
def test_simple_single_file():
    """Boring example
    """

    out_data = run_tvnamer(
        with_files = ['Some File.avi'],
        with_flags = ["--batch"])

    expected_files = ['Some File.avi']

    verify_out_data(out_data, expected_files, expected_returncode = 2)
コード例 #47
0
ファイル: test_invalid_files.py プロジェクト: Bernt87/tvnamer
def test_no_series_name():
    """File without series name should be skipped (unless '--name=MySeries' arg is supplied)
    """

    out_data = run_tvnamer(
        with_files = ['s01e01 Some File.avi'],
        with_flags = ["--batch"])

    expected_files = ['s01e01 Some File.avi']

    verify_out_data(out_data, expected_files, expected_returncode = 2)
コード例 #48
0
def test_simple_single_file_with_forced_seriesnames():
    """Specifying 's01e01.avi' should parse when --name=SeriesName arg is specified
    """

    out_data = run_tvnamer(
        with_files = ['S01E02 - Some File.avi'],
        with_flags = ["--batch", '--name', 'Scrubs'])

    expected_files = ['Scrubs - [01x02] - My Mentor.avi']

    verify_out_data(out_data, expected_files)
コード例 #49
0
ファイル: test_functional.py プロジェクト: Bernt87/tvnamer
def test_no_seasonnumber():
    """Test episode with no series number
    """

    out_data = run_tvnamer(
        with_files = ['scrubs.e01.avi'],
        with_flags = ['--batch'])

    expected_files = ['Scrubs - [01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #50
0
ファイル: test_functional.py プロジェクト: Bernt87/tvnamer
def test_correct_filename():
    """If the filename is already correct, don't prompt
    """

    out_data = run_tvnamer(
        with_files = ['Scrubs - [01x01] - My First Day.avi'],
        with_input = "1\ny\n")

    expected_files = ['Scrubs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #51
0
ファイル: test_movingfiles.py プロジェクト: oracal/tvnamer
def test_cli_destination():
    """Tests specifying the destination via command line argument
    """

    out_data = run_tvnamer(
        with_files = ['scrubs.s01e01.avi'],
        with_flags = ['--batch', '--move', '--movedestination=season %(seasonnumber)d/'])

    expected_files = ['season 1/Scrubs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)
コード例 #52
0
def test_renaming_always_doesnt_overwrite():
    """If trying to rename a file that exists, should not create new file
    """
    input_files = ['Scrubs.s01e01.avi', 'Scrubs - [01x01] - My First Day.avi']

    expected_files = [
        'Scrubs.s01e01.avi', 'Scrubs - [01x01] - My First Day.avi'
    ]

    out_data = run_tvnamer(with_files=input_files, with_flags=['--batch'])

    verify_out_data(out_data, expected_files)
コード例 #53
0
def test_ambigious():
    invalid_files = [
        'show.123.avi',  # Maybe s01e23 but too ambigious. #140
        'Scrubs.0101.avi',  # Ambigious. #140
    ]

    for f in invalid_files:
        out_data = run_tvnamer(with_files=[f], with_flags=["--batch"])

        expected_files = [f]

        verify_out_data(out_data, expected_files, expected_returncode=2)
コード例 #54
0
def test_unicode_in_inputname():
    """Tests parsing a file with unicode in the input filename
    """
    input_files = [
        u'The Big Bang Theory - S02E07 - The Panty Pin\u0303ata Polarization.avi'
    ]

    expected_files = [
        u'The Big Bang Theory - [02x07] - The Panty Pin\u0303ata Polarization.avi'
    ]

    out_data = run_tvnamer(with_files=input_files, with_flags=["--batch"])

    verify_out_data(out_data, expected_files)
コード例 #55
0
def test_no_blacklist():
    """Tests empty list of filename regexps is parsed as expected
    """

    conf = """
    {"batch": true,
    "filename_blacklist": []}
    """

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

    expected_files = ["Scrubs - [01x01] - My First Day.avi", "Scrubs - [01x02] - My Mentor.avi"]

    verify_out_data(out_data, expected_files)
コード例 #56
0
def test_temp_override():
    """Test --name argument
    """

    conf = """
    {"batch": true}
    """

    out_data = run_tvnamer(
        with_files=["scrubs.s01e01.avi"], with_config=conf, with_flags=["--name", "lost"], with_input=""
    )

    expected_files = ["Lost - [01x01] - Pilot (1).avi"]

    verify_out_data(out_data, expected_files)
コード例 #57
0
def test_group_no_epname():
    """Anime filename, on episode with no name [#100]
    """
    out_data = run_tvnamer(
        with_files = ['[Some Group] Somefakeseries - 01 [A1B2C3].avi'],
        with_config = """
{
    "batch": true,

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

    expected_files = ['[Some Group] Somefakeseries - 01 [A1B2C3].avi']

    verify_out_data(out_data, expected_files)
コード例 #58
0
ファイル: test_movingfiles.py プロジェクト: lahwaacz/tvnamer
def test_dynamic_destination():
    """Move file to simple relative static dir
    """

    conf = """
    {"move_files_destination": "tv/%(seriesname)s/season %(seasonnumber)d/",
    "batch": true}
    """

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

    expected_files = ['tv/Scrubs/season 1/Scrubs - [01x01] - My First Day.avi']

    verify_out_data(out_data, expected_files)