Skip to content

Commit

Permalink
Added support for 'H264' and 'H 264' codec tags, fixed setup_path in …
Browse files Browse the repository at this point in the history
…unit tests
  • Loading branch information
fuzeman committed Dec 6, 2013
1 parent 0735814 commit 295d152
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ tools/*.mysql
/.idea
*.iml
/.coverage
/out
/tools/test_data
6 changes: 5 additions & 1 deletion src/caper/parsers/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@

(r'(?P<codec>%s)', [
'x264',
'XViD'
'XViD',
'H264'
]),

# For 'H 264' tags
('(?P<codec>H)', '(?P<codec>264)'),

(r'(?P<language>%s)', [
'GERMAN',
'DUTCH',
Expand Down
7 changes: 5 additions & 2 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
def setup_path():
src_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'src'))

if src_path not in sys.path:
sys.path.insert(0, src_path)
if src_path in sys.path:
sys.path.remove(src_path)

sys.path.insert(0, src_path)

setup_path()

from caper import CaperFragment
Expand Down
14 changes: 13 additions & 1 deletion tests/test_scene_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,19 @@ def test_episode_source():
)


def test_episode_codec():
assert_that(
caper.parse('Show Name 2013 S01E01 720p WEB-DL H264 GROUP'),
has_info('video', {'codec': 'H264'})
)

assert_that(
caper.parse('Show Name 2013 S01E01 720p WEB-DL H 264 GROUP'),
has_info('video', {'codec': ['H', '264']})
)


def test_closures():
r = caper.parse('Show Name.S01E05.[720p]-GROUP')
assert_that(r, has_info('video', {'resolution': '720p'}))
assert_that(r, has_info('group', 'GROUP'))
assert_that(r, has_info('group', 'GROUP'))

0 comments on commit 295d152

Please sign in to comment.