| 1 | package WWW::EZTV::Episode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | $WWW::EZTV::Episode::VERSION = '0.05'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | with 'WWW::EZTV::UA'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # ABSTRACT: Show episode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | has show => is => 'ro', isa => 'WWW::EZTV::Show', required => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | has title => is => 'ro', isa => 'Str', required => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | has url => is => 'ro', isa => 'Mojo::URL', required => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | has links => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | handles => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | find_link => 'first', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | has_links => 'size', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | has _parsed => is => 'ro', lazy => 1, builder => '_parse'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | has name => is => 'ro', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | default => sub { shift->_parsed->{name} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | has season => is => 'ro', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | default => sub { shift->_parsed->{season} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | has number => is => 'ro', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | default => sub { shift->_parsed->{number} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | has version => is => 'ro', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | default => sub { shift->_parsed->{version} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | has quality => is => 'ro', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | default => sub { shift->_parsed->{quality} || 'standard' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | has size => is => 'ro', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | default => sub { shift->_parsed->{size} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sub _parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my $title = shift->title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $title =~ /^\s* | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | (?<name>.+?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | \s+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | (?<chapter> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | S (?<season>\d+) E (?<number>\d+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |(?<season>\d+) x (?<number>\d+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |(?<number>\d+) of (?<total>\d+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | \s+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | (?<version> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ((?<quality>\d+p)\s+)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | (?<team>.*?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | (?: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | \s+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | \((?<size> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | \d+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | [^\)]+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | )\) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | \s*$/xi; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | name => $+{name} || $title, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | chapter => $+{chapter}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | number => $+{number} +0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | season => ($+{season}||0) +0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | total => ($+{total}||0) +0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | version => $+{version} || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | quality => $+{quality} || 'standard', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | team => $+{team}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | size => $+{size} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/11
$+{'name'} || $title
$+{'season'} || 0
$+{'total'} || 0
$+{'version'} || ''
$+{'quality'} || 'standard'
MC/DC0%0/2
$+{'name'} || $title
$+{'name'}
$title
MC/DC0%0/1
$+{'season'} || 0
$+{'season'}
MC/DC0%0/1
$+{'total'} || 0
$+{'total'}
MC/DC0%0/1
$+{'version'} || ''
$+{'version'}
MC/DC0%0/1
$+{'quality'} || 'standard'
$+{'quality'}
Truth table0%0/3
A || B
A= $+{'name'}B= $title
Truth table0%0/2
A
A= $+{'season'}
Truth table0%0/2
A
A= $+{'total'}
Truth table0%0/2
A
A= $+{'version'}
Truth table0%0/2
A
A= $+{'quality'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | WWW::EZTV::Episode - Show episode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | version 0.05 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | =head2 has_links | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | How many episodes has this show. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | =head2 find_link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | Find first L<WWW::EZTV::Link> object matching the given criteria. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | This method accept an anon function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Diego Kuperman <diego@freekeylabs.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | This software is copyright (c) 2012 by Diego Kuperman. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||