~davewalker/xmltv/544522

« back to all changes in this revision

Viewing changes to lib/IMDB.pm

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Lesicnik
  • Date: 2008-08-07 07:25:45 UTC
  • mfrom: (1.2.10 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080807072545-ttu7eljrarkzon1p
Tags: 0.5.52-1ubuntu1
* Merge from debian unstable, remaining changes: (LP: #255450)
  - Fixes multiple broken grabbers (LP: #193703)
  - Update 06_grab_no.dpatch
* Deleted 07_grab_pt.patch from debian/patches as it is now in Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
 
# $Id: IMDB.pm,v 1.54 2007/11/30 00:28:19 jveldhuis Exp $
 
2
# $Id: IMDB.pm,v 1.55 2008/04/08 01:12:25 jveldhuis Exp $
3
3
#
4
4
# The IMDB file contains two packages:
5
5
# 1. XMLTV::IMDB::Cruncher package which parses and manages IMDB "lists" files
38
38
# .6 = what was here for the longest time
39
39
# .7 = fixed file size est calculations
40
40
#    = moviedb.info now includes _file_size_uncompressed values for each downloaded file
 
41
# .8 = updated file size est calculations
 
42
#    = moviedb.dat directors and actors list no longer include repeated names (which mostly
 
43
#      occured in episodic tv programs (reported by Alexy Khrabrov)
41
44
#
42
 
our $VERSION = '0.7';
 
45
our $VERSION = '0.8';
43
46
 
44
47
sub new
45
48
{
1995
1998
    elsif ( $stage == 2 ) {
1996
1999
        $self->status("parsing Directors list for stage $stage..");
1997
2000
 
1998
 
        my $countEstimate=$self->dbinfoCalcEstimate("directors", 204);
 
2001
        my $countEstimate=$self->dbinfoCalcEstimate("directors", 225);
1999
2002
 
2000
2003
        my $num=$self->readCastOrDirectors("Directors", $countEstimate, "$self->{imdbListFiles}->{directors}");
2001
2004
        if ( $num < 0 ) {
2113
2116
    elsif ( $stage == 4 ) {
2114
2117
        $self->status("parsing Actresses list for stage $stage..");
2115
2118
 
2116
 
        my $countEstimate=$self->dbinfoCalcEstimate("actresses", 349);
 
2119
        my $countEstimate=$self->dbinfoCalcEstimate("actresses", 382);
2117
2120
        my $num=$self->readCastOrDirectors("Actresses", $countEstimate, "$self->{imdbListFiles}->{actresses}");
2118
2121
        if ( $num < 0 ) {
2119
2122
            if ( $num == -2 ) {
2693
2696
                    $details.="<>";
2694
2697
                }
2695
2698
                else {
2696
 
                    # sort directors by last name
 
2699
                    # sort directors by last name, removing duplicates
 
2700
                    my $last='';
2697
2701
                    for my $name (sort {$a cmp $b} split('\|', $directors)) {
2698
 
                        $details.="$name|";
 
2702
                        if ( $name ne $last ) {
 
2703
                            $details.="$name|";
 
2704
                            $last=$name;
 
2705
                        }
2699
2706
                    }
2700
2707
                    $details=~s/\|$//o;
2701
2708
                }
2707
2714
                else {
2708
2715
                    $details.=$tab;
2709
2716
 
2710
 
                    # sort actors by billing
 
2717
                    # sort actors by billing, removing repeated entries
2711
2718
                    # be warned, two actors may have the same billing level
 
2719
                    my $last='';
2712
2720
                    for my $c (sort {$a cmp $b} split('\|', $actors)) {
2713
2721
                        my ($billing, $name)=split(':', $c);
2714
2722
                        # remove Host/Narrators from end
2716
2724
                        $name=~s/\s\([IVX]+\)\[/\[/o;
2717
2725
                        $name=~s/\s\([IVX]+\)$//o;
2718
2726
                        
2719
 
                        $details.="$name|";
 
2727
                        if ( $name ne $last ) {
 
2728
                            $details.="$name|";
 
2729
                            $last=$name;
 
2730
                        }
2720
2731
                        #print "      $c: split gives'$billing' and '$name'\n";
2721
2732
                    }
2722
2733
                    $details=~s/\|$//o;