From 126bb8cb6b93240bb4d3a2b816b74c286c3d422b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Jul 2014 15:20:38 +0200 Subject: Imported Upstream version 1.7.0 --- lib/gcstar/GCPlugins/GCfilms/GCAlapage.pm | 267 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCAllmovie.pm | 431 +++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCAllocine.pm | 403 ++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCAlpacineES.pm | 435 +++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCAmazon.pm | 281 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCAmazonDE.pm | 291 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCAmazonFR.pm | 304 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCAmazonUK.pm | 264 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCAniDB.pm | 279 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCAnimator.pm | 236 +++++++ lib/gcstar/GCPlugins/GCfilms/GCAnimeNfoA.pm | 266 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCAnimeka.pm | 295 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCBeyazPerde.pm | 340 ++++++++++ .../GCPlugins/GCfilms/GCCartelesPeliculasES.pm | 351 +++++++++++ lib/gcstar/GCPlugins/GCfilms/GCCinemaClock.pm | 271 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCCinemotions.pm | 284 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCCsfd.pm | 699 +++++++++++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCCulturalia.pm | 241 +++++++ lib/gcstar/GCPlugins/GCfilms/GCDVDEmpire.pm | 427 +++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCDVDFr.pm | 374 +++++++++++ lib/gcstar/GCPlugins/GCfilms/GCDVDPost.pm | 269 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCDicshop.pm | 343 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCDoubanfilm.pm | 255 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCFilmAffinityEN.pm | 334 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCFilmAffinityES.pm | 334 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCFilmUP.pm | 252 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCFilmWeb.pm | 369 +++++++++++ lib/gcstar/GCPlugins/GCfilms/GCIbs.pm | 409 ++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCImdb.pm | 439 +++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCKinopoisk.pm | 386 ++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCMediadis.pm | 316 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCMetropoliES.pm | 382 +++++++++++ lib/gcstar/GCPlugins/GCfilms/GCMonsieurCinema.pm | 272 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCMovieMeter.pm | 429 +++++++++++++ lib/gcstar/GCPlugins/GCfilms/GCMoviecovers.pm | 246 ++++++++ lib/gcstar/GCPlugins/GCfilms/GCNasheKino.pm | 222 +++++++ lib/gcstar/GCPlugins/GCfilms/GCOFDb.pm | 304 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCOdeonHU.pm | 305 +++++++++ lib/gcstar/GCPlugins/GCfilms/GCOnet.pm | 327 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCPortHU.pm | 343 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCStopklatka.pm | 355 +++++++++++ lib/gcstar/GCPlugins/GCfilms/GCThemoviedb.pm | 337 ++++++++++ lib/gcstar/GCPlugins/GCfilms/GCThemoviedbDE.pm | 56 ++ lib/gcstar/GCPlugins/GCfilms/GCThemoviedbES.pm | 56 ++ lib/gcstar/GCPlugins/GCfilms/GCThemoviedbFR.pm | 56 ++ .../GCPlugins/GCfilms/GCfilmsAmazonCommon.pm | 59 ++ lib/gcstar/GCPlugins/GCfilms/GCfilmsCommon.pm | 70 +++ 47 files changed, 14264 insertions(+) create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAlapage.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAllmovie.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAllocine.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAlpacineES.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAmazon.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAmazonDE.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAmazonFR.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAmazonUK.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAniDB.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAnimator.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAnimeNfoA.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCAnimeka.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCBeyazPerde.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCCartelesPeliculasES.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCCinemaClock.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCCinemotions.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCCsfd.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCCulturalia.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCDVDEmpire.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCDVDFr.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCDVDPost.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCDicshop.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCDoubanfilm.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCFilmAffinityEN.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCFilmAffinityES.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCFilmUP.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCFilmWeb.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCIbs.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCImdb.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCKinopoisk.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCMediadis.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCMetropoliES.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCMonsieurCinema.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCMovieMeter.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCMoviecovers.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCNasheKino.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCOFDb.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCOdeonHU.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCOnet.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCPortHU.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCStopklatka.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCThemoviedb.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCThemoviedbDE.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCThemoviedbES.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCThemoviedbFR.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCfilmsAmazonCommon.pm create mode 100644 lib/gcstar/GCPlugins/GCfilms/GCfilmsCommon.pm (limited to 'lib/gcstar/GCPlugins/GCfilms') diff --git a/lib/gcstar/GCPlugins/GCfilms/GCAlapage.pm b/lib/gcstar/GCPlugins/GCfilms/GCAlapage.pm new file mode 100644 index 0000000..604fdc4 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCfilms/GCAlapage.pm @@ -0,0 +1,267 @@ +package GCPlugins::GCfilms::GCAlapage; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# This file is part of GCstar. +# +# GCstar is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# GCstar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCstar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# +################################################### + +use strict; +use utf8; + +use GCPlugins::GCfilms::GCfilmsCommon; + +{ + + package GCPlugins::GCfilms::GCPluginAlapage; + + use base qw(GCPlugins::GCfilms::GCfilmsPluginsBase); + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + + if ($self->{parsingList}) + { + if ($tagname eq "a") + { + if ($attr->{class} eq "tx12noirbold") + { + my $url = $attr->{href}; + $self->{isMovie} = 1; + $self->{isInfo} = 1; + $self->{itemIdx}++; + $self->{itemsList}[ $self->{itemIdx} ]->{url} = $url; + } + } + elsif ($tagname eq "div") + { + if ($attr->{class} eq "acteurs") + { + $self->{isActors} = 1; + } + elsif ($attr->{class} eq "realisateur") + { + $self->{isDirector} = 1; + } + } + } + else + { + if ($tagname eq "img") + { + if ($attr->{src} =~ /^\/resize\.php\?ref=([0-9]*)/) + { + $self->{curInfo}->{image} = + "http://imgdata.echo.fr/disque_l?v$1r.jpg"; + } + } + elsif ($tagname eq "span") + { + $self->{insideName} = 1 if $attr->{style} eq "color:#414B55;"; + $self->{insideActors} = 1 if $attr->{class} eq "tx11gris"; + } + elsif ($tagname eq "div") + { + $self->{insideSynopsis} = 1 if $attr->{align} eq "justify"; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + + } + + sub text + { + my ($self, $origtext) = @_; + + return if length($origtext) < 2; + + if ($self->{parsingList}) + { + if ($self->{isMovie}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{"title"} = $origtext; + $self->{isMovie} = 0; + $self->{isInfo} = 1; + return; + } + elsif ($self->{isActors}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{"actors"} .= + $self->{itemsList}[ $self->{itemIdx} ]->{"actors"} + ? ', ' . $self->capWord($origtext) + : $self->capWord($origtext); + $self->{isActors} = 0; + } + elsif ($self->{isDirector}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{"director"} = + $self->capWord($origtext); + $self->{isDirector} = 0; + } + + } + else + { + $origtext =~ s/\s{2,}//g; + + if ($self->{insideName}) + { + $self->{curInfo}->{title} = $self->capWord($origtext); + $self->{insideName} = 0; + } + elsif ($self->{insideActors}) + { + $origtext =~ s/avec : (.*) - (?:[^-]* )?DVD/$1/; + $origtext =~ s/ - /, /g; + $self->{curInfo}->{actors} = $self->capWord($origtext) + if !$self->{curInfo}->{actors}; + $self->{insideActors} = 0; + } + elsif ($self->{insideSynopsis}) + { + $origtext =~ s/\[br\]/\n/g; + $self->{curInfo}->{synopsis} .= $origtext; + $self->{insideSynopsis} = 0; + } + elsif ($origtext =~ m/R.*alisateur :/) + { + $origtext =~ s/R.*alisateur(?: :)?(.*)/$1/; + $origtext =~ s/ - /, /g; + $self->{curInfo}->{director} = $self->capWord($origtext) + if !$self->{curInfo}->{director}; + } + elsif ($origtext =~ m/Genre :/) + { + $origtext =~ s/Genre :(.*)/$1/; + $origtext = $self->capWord($origtext); + $origtext =~ s/ \/ /,/g; + $origtext =~ s/,Video//g; + $self->{curInfo}->{genre} = $origtext if !$self->{curInfo}->{genre}; + } + elsif ($origtext =~ m/Année du film :/) + { + $origtext =~ s/Année du film :(.*)/$1/; + $self->{curInfo}->{date} = $origtext if !$self->{curInfo}->{date}; + } + elsif ($origtext =~ m/Durée du film/) + { + $origtext =~ s/Durée du film(.*)/$1/; + $self->{curInfo}->{time} = $origtext if !$self->{curInfo}->{time}; + } + } + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless($self, $class); + + $self->{hasField} = { + title => 1, + date => 0, + director => 1, + actors => 1, + }; + + $self->{isInfo} = 0; + $self->{isMovie} = 0; + $self->{curName} = undef; + $self->{curUrl} = undef; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + #Fix for character-encoding: + $html =~ s/’/'/g; + $html =~ s/…/\.\.\./g; + #' + +#<<< keep perltidy away from these lines + $html =~ s/
/\[br\]/gi; + $html =~ s/ / /g; + $html =~ s/|<\/u>||<\/b>||<\/i>//gi; + $html =~ s/([^<]*)<\/SPAN>/$1/gi; + $html =~ s|([^<]*)|
$1
|gi; + $html =~ s|([^<]*)|
$1
|gi; + $html =~ s/([^<]*)<\/A>/$1/gi; + $html =~ s|(.*?)|$1|gi; + $html =~ s/([^<]*)<\/TD>[^<]*([^<]*)<\/TD>/$1 $2<\/td>/gi; + $html =~ s/([^<]*)<\/td>[^<]*<\/TD>[^<]*([0-9]* mn)<\/td>/$1 $2<\/td>/gi; +#>>> + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + return "http://alapage.com/mx/?type=41&tp=L&fulltext=" . $word; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return "http://alapage.com" . $url; + } + + sub getName + { + return "Alapage.com"; + } + + sub getAuthor + { + return 'MeV'; + } + + sub getLang + { + return 'FR'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-1"; + } + + sub getDefaultPictureSuffix + { + return '.jpg'; + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCfilms/GCAllmovie.pm b/lib/gcstar/GCPlugins/GCfilms/GCAllmovie.pm new file mode 100644 index 0000000..e8117c5 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCfilms/GCAllmovie.pm @@ -0,0 +1,431 @@ +package GCPlugins::GCfilms::GCAllmovie; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# This file is part of GCstar. +# +# GCstar is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# GCstar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCstar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# +################################################### + +use strict; + +use GCPlugins::GCfilms::GCfilmsCommon; + +{ + + package GCPlugins::GCfilms::GCPluginAllmovie; + + use base qw(GCPlugins::GCfilms::GCfilmsPluginsBase); + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + + if ($self->{parsingEnded}) + { + return; + } + + if ($self->{parsingList}) + { + if (($tagname eq "a") && ($self->{isFilm})) + { + my $url = $attr->{href}; + $self->{isMovie} = 1; + $self->{isInfo} = 1; + $self->{itemIdx}++; + $self->{itemsList}[ $self->{itemIdx} ]->{url} = $url; + $self->{isFilm} = 0; + } + if ($tagname eq "td") + { + if ($attr->{style} =~ m/284px/) + { + $self->{isFilm} = 1; + } + elsif ($attr->{style} =~ m/70px/) + { + $self->{isYear} = 1; + } + elsif ($attr->{style} =~ m/190px/) + { + $self->{isDirector} = 1; + } + } + elsif ($tagname eq "tr") + { + $self->{isFound} = 1; + } + elsif ($tagname eq "title") + { + $self->{insideHTMLtitle} = 1; + } + } + else + { + if (($tagname eq "span") && ($attr->{class} eq "title")) + { + $self->{insideTitle} = 1; + } + elsif ( + ($tagname eq "div") + && ( ($attr->{id} eq "left-sidebar-title") + || ($attr->{id} eq "left-sidebar-title-small")) + ) + { + $self->{insideLeftSidebarTitle} = 1; + } + elsif ($tagname eq "a") + { + if ($attr->{href} =~ m/sql=B/) + { + $self->{insideActors} = 1; + } + elsif ($self->{insideDirectorList}) + { + $self->{insideDirector} = 1; + } + elsif ($self->{insideYearRuntime}) + { + $self->{insideYear} = 1; + $self->{insideYearRuntime} = 0; + } + elsif ($self->{insideCountriesRating}) + { + $self->{insideCountry} = 1; + $self->{insideCountriesRating} = 0; + } + elsif ($self->{nextIsSeries}) + { + $self->{insideSeries} = 1; + $self->{nextIsSeries} = 0; + } + } + elsif ($tagname eq "img") + { + if ($attr->{src} =~ /http\:\/\/image\.allmusic\.com/) + { + $self->{curInfo}->{image} = ($attr->{src}); + } + elsif ($self->{insideRatingStars}) + { + $attr->{title} =~ /([\d\.]+) Stars/; + $self->{curInfo}->{ratingpress} = $1 * 2; + $self->{insideRatingStars} = 0; + } + } + elsif ($tagname eq "li") + { + if ($self->{insideGenreList}) + { + $self->{insideGenre} = 1; + } + } + elsif ($tagname eq "td") + { + if ( ($self->{insideAKA}) + && ($attr->{class} =~ m/formed-sub/)) + { + $self->{insideOtherTitles} = 1; + } + elsif ($self->{nextIsRating}) + { + $self->{insideRating} = 1; + $self->{nextIsRating} = 0; + } + elsif ($self->{nextIsRuntime}) + { + $self->{insideTime} = 1; + $self->{nextIsRuntime} = 0; + } + elsif ($attr->{colspan} == 2) + { + if ($attr->{class} eq "large-list-title") + { + } + else + { + $self->{insideSynopsis} = 1; + } + } + elsif ($attr->{class} eq "rating-stars") + { + $self->{insideRatingStars} = 1; + } + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + + if ($tagname eq "td") + { + $self->{insideSynopsis} = 0; + } + if ($tagname eq "div") + { + $self->{insideLeftSidebarTitle} = 0; + } + if ($tagname eq "table") + { + $self->{insideGenreList} = 0; + $self->{insideAKA} = 0; + $self->{curInfo}->{original} =~ s/(, )$//; + } + } + + sub text + { + my ($self, $origtext) = @_; + return if ((length($origtext) == 0) || ($origtext eq " ")); + + $origtext =~ s/"/"/g; + $origtext =~ s/³/3/g; + $origtext =~ s/&#[0-9]*;//g; + $origtext =~ s/\n//g; + + return if ($self->{parsingEnded}); + + if ($self->{parsingList}) + { + if (($self->{insideHTMLtitle})) + { + if ($origtext !~ m/Results/) + { + $self->{parsingEnded} = 1; + $self->{itemIdx} = 0; + $self->{itemsList}[0]->{url} = $self->{loadedUrl}; + } + $self->{insideHTMLtitle} = 0; + } + if ($self->{isMovie}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{title} = $origtext; + $self->{isMovie} = 0; + $self->{isInfo} = 1; + return; + } + if ($self->{isYear}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{date} = $origtext + if $origtext =~ m/^[0-9]{4}?/; + $self->{isYear} = 0; + } + if ($self->{isDirector}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{director} = $origtext; + $self->{isDirector} = 0; + } + if ($self->{isInfo}) + { + $self->{itemsList}[ $self->{itemIdx} ]->{date} = $1 + if $origtext =~ m|\(([0-9]*)(/I+)?\)|; + $self->{isInfo} = 0; + } + } + else + { + if ($self->{insideLeftSidebarTitle}) + { + if ($origtext eq "Genres") + { + $self->{insideGenreList} = 1; + $self->{insideLeftSidebarTitle} = 0; + } + elsif ($origtext eq "Director") + { + $self->{insideDirectorList} = 1; + $self->{insideLeftSidebarTitle} = 0; + } + elsif ($origtext eq "Year") + { + $self->{insideYearRuntime} = 1; + $self->{insideLeftSidebarTitle} = 0; + } + elsif ($origtext eq "Countries") + { + $self->{insideCountriesRating} = 1; + $self->{insideLeftSidebarTitle} = 0; + } + elsif ($origtext eq "AKA") + { + $self->{insideAKA} = 1; + $self->{insideLeftSidebarTitle} = 0; + } + } + elsif ($origtext =~ /Is part of the series:$/) + { + $self->{nextIsSeries} = 1; + } + if ($self->{insideActors}) + { + $self->{curInfo}->{actors} .= $origtext . ', ' + if ($self->{actorsCounter} < $GCPlugins::GCfilms::GCfilmsCommon::MAX_ACTORS); + $self->{actorsCounter}++; + $self->{insideActors} = 0; + } + + if ($self->{insideYear}) + { + $self->{curInfo}->{date} = $origtext; + $self->{insideYear} = 0; + $self->{nextIsRuntime} = 1; + } + if ($self->{insideTitle}) + { + $self->{curInfo}->{title} = $origtext; + $self->{insideTitle} = 0; + } + elsif ($self->{insideGenre}) + { + $self->{curInfo}->{genre} .= $self->capWord($origtext) . ','; + $self->{insideGenre} = 0; + } + elsif ($self->{insideDirector}) + { + $self->{curInfo}->{director} = $origtext; + $self->{insideDirector} = 0; + $self->{insideDirectorList} = 0; + } + elsif ($self->{insideSynopsis}) + { + $self->{curInfo}->{synopsis} .= $origtext; + } + elsif ($self->{insideCountry}) + { + $self->{curInfo}->{country} = $origtext; + $self->{insideCountry} = 0; + $self->{nextIsRating} = 1; + } + elsif ($self->{insideTime}) + { + $self->{curInfo}->{time} = $origtext; + $self->{curInfo}->{time} =~ s/.[0-9]*?://; + $self->{insideTime} = 0; + } + elsif ($self->{insideRating}) + { + $self->{curInfo}->{age} = 1 + if ($origtext eq 'Unrated') || ($origtext eq 'Open'); + $self->{curInfo}->{age} = 2 + if ($origtext eq 'G') || ($origtext eq 'Approved'); + $self->{curInfo}->{age} = 5 + if ($origtext eq 'PG') || ($origtext eq 'M') || ($origtext eq 'GP'); + $self->{curInfo}->{age} = 13 if $origtext eq 'PG13'; + $self->{curInfo}->{age} = 17 if $origtext eq 'R'; + $self->{curInfo}->{age} = 18 + if ($origtext eq 'NC17') || ($origtext eq 'X'); + $self->{insideRating} = 0; + } + elsif ($self->{insideOtherTitles}) + { + $self->{tempOriginal} = $origtext; + $self->{tempOriginal} =~ s/\s*$//; + $self->{tempOriginal} =~ s/^\s*//; + + $self->{curInfo}->{original} .= $self->{tempOriginal} . ', '; + $self->{insideOtherTitles} = 0; + } + elsif ($self->{insideSeries}) + { + $self->{curInfo}->{serie} = $origtext; + $self->{curInfo}->{serie} =~ s/( \[.*\])//; + $self->{insideSeries} = 0; + } + } + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless($self, $class); + + $self->{hasField} = { + title => 1, + date => 1, + director => 1, + actors => 0, + }; + + $self->{isInfo} = 0; + $self->{isMovie} = 0; + $self->{curName} = undef; + $self->{curUrl} = undef; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + $self->{parsingEnded} = 0; + + $html =~ s/""/'"/g; + $html =~ s/""/"'/g; + $html =~ s|

|
|; + + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + my $wordFiltered = $word; + + # Allmovie doesn't return correct results if searching with a prefix like 'the' + $wordFiltered =~ s/^(the|a)?[+\s]+[^ a-zA-Z0-9]*\s*//i; +# return ('http://allmovie.com/search/all', ['q' => $wordFiltered,'submit' => 'SEARCH']); + return ('http://allmovie.com/search/all/' . $wordFiltered); + + } + + sub getItemUrl + { + my ($self, $url) = @_; + return $url if $url =~ /^http:/; + return "http://allmovie.com" . $url; + } + + sub getName + { + return "Allmovie"; + } + + sub getAuthor + { + return 'Zombiepig'; + } + + sub getLang + { + return 'EN'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCfilms/GCAllocine.pm b/lib/gcstar/GCPlugins/GCfilms/GCAllocine.pm new file mode 100644 index 0000000..db37774 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCfilms/GCAllocine.pm @@ -0,0 +1,403 @@ +package GCPlugins::GCfilms::GCAllocine; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# This file is part of GCstar. +# +# GCstar is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# GCstar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCstar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# +################################################### + +use strict; +use utf8; + +use GCPlugins::GCfilms::GCfilmsCommon; + +{ + + package GCPlugins::GCfilms::GCPluginAllocine; + + use base qw(GCPlugins::GCfilms::GCfilmsPluginsBase); + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + $self->{inside}->{$tagname}++; + + if ($self->{parsingList}) + { + if ($self->{insideResults} eq 1) + { + if ( ($tagname eq "a") + && ($attr->{href} =~ /^\/film\/fichefilm_gen_cfilm=/) + && ($self->{isMovie} eq 0)) + { + my $url = $attr->{href}; + $self->{isMovie} = 1; + $self->{isInfo} = 0; + $self->{itemIdx}++; + $self->{itemsList}[ $self->{itemIdx} ]->{url} = $url; + } + elsif (($tagname eq "td") && ($self->{isMovie} eq 1)) + { + $self->{isMovie} = 2; + } + elsif (($tagname eq "a") && ($self->{isMovie} eq 2)) + { + $self->{isMovie} = 3; + } + elsif (($tagname eq "br") && ($self->{isMovie} eq 3)) + { + $self->{itemsList}[ $self->{itemIdx} ]->{title} =~ s/^\s*//; + $self->{itemsList}[ $self->{itemIdx} ]->{title} =~ s/\s*$//; + $self->{itemsList}[ $self->{itemIdx} ]->{title} =~ s/\s+/ /g; + $self->{isMovie} = 4; + } + elsif (($tagname eq "span") + && ($attr->{class} eq "fs11") + && ($self->{isMovie} eq 4)) + { + $self->{isInfo} = 1; + $self->{isMovie} = 0; + } + elsif (($tagname eq "br") && ($self->{isInfo} eq 1)) + { + $self->{isInfo} = 2; + } + elsif (($tagname eq "br") && ($self->{isInfo} eq 2)) + { + $self->{isInfo} = 3; + } + } + } + else + { + if (($tagname eq "div") && ($attr->{class} eq "poster")) + { + $self->{insidePicture} = 1; + } + elsif (($tagname eq "img") && ($self->{insidePicture} eq 1)) + { + my $src = $attr->{src}; + if (!$self->{curInfo}->{image}) + { + if ($src =~ /r_160_240/) + { + $self->{curInfo}->{image} = $src; + } + else + { + $self->{curInfo}->{image} = "empty"; + } + } + } + elsif ($tagname eq "h1") + { + $self->{insideTitle} = 1; + } + elsif (($tagname eq "span") && ($self->{insideDate} eq 1)) + { + $self->{insideDate} = 2; + } + elsif (($tagname eq "span") && ($attr->{itemprop} eq "duration")) + { + $self->{insideTime} = 1; + } + elsif (($tagname eq "span") && ($self->{insideDirector} eq 1)) + { + $self->{insideDirector} = 2; + } + elsif (($tagname eq "a") && ($self->{insideActor} eq 1)) + { + $self->{insideActor} = 2; + } + elsif (($tagname eq "span") && ($self->{insideGenre} eq 1)) + { + $self->{insideGenre} = 2; + } + elsif (($tagname eq "span") && ($self->{insideCountry} eq 1)) + { + $self->{insideCountry} = 2; + } + elsif (($tagname eq "span") && ($attr->{class} eq "note") && ($self->{insidePressRating} eq 1)) + { + $self->{insidePressRating} = 2; + } + elsif (($tagname eq "div") && ($attr->{class} eq "breaker")) + { + $self->{insidePressRating} = 0; + } + elsif (($tagname eq "p") && ($attr->{itemprop} eq "description")) + { + $self->{insideSynopsis} = 1; + } + elsif (($tagname eq "td") && ($self->{insideOriginal} eq 1)) + { + $self->{insideOriginal} = 2; + } + + } + } + + sub end + { + my ($self, $tagname) = @_; + $self->{inside}->{$tagname}--; + + if ($tagname eq "li") + { + $self->{insideDirector} = 0; + $self->{insideActor} = 0; + $self->{insideGenre} = 0; + } + elsif ($tagname eq "div") + { + $self->{insideCountry} = 0; + $self->{insideSynopsis} = 0; + $self->{insideActor} = 0; + } + elsif ($tagname eq "th") + { + $self->{insideSynopsis} = 0; + } + elsif ($tagname eq "table") + { + $self->{insideResults} = 0; + } + + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if (($origtext =~ m/(\d+) r..?sultats? trouv..?s? dans les titres de films/) && ($1 > 0)) + { + $self->{insideResults} = 1; + } + if ($self->{isMovie} eq 3) + { + $self->{itemsList}[ $self->{itemIdx} ]->{title} .= $origtext; + } + if ($self->{isInfo} eq 1) + { + if ($origtext =~ /\s*([0-9]{4})/) + { + $self->{itemsList}[ $self->{itemIdx} ]->{date} = $1; + } + } + elsif ($self->{isInfo} eq 2) + { + if ($origtext =~ /^\s*de (.*)/) + { + $self->{itemsList}[ $self->{itemIdx} ]->{director} = $1; + } + } + elsif ($self->{isInfo} eq 3) + { + if ( ($origtext =~ m/^\s*avec (.*)/) + && (!$self->{itemsList}[ $self->{itemIdx} ]->{actors})) + { + $self->{itemsList}[ $self->{itemIdx} ]->{actors} = $1; + } + $self->{isInfo} = 0; + } + } + else + { + my ($self, $origtext) = @_; + $origtext =~ s/[\r\n]//g; + $origtext =~ s/^\s*//; + $origtext =~ s/\s*$//; + + if ($self->{insideTitle} eq 1) + { + $self->{curInfo}->{title} = $origtext; + $self->{insideTitle} = 0; + } + elsif (($self->{insideDate} eq 2) && (length($origtext) > 1)) + { + $self->{curInfo}->{date} = $origtext + if !($origtext =~ /inconnu/); + $self->{insideDate} = 0; + } + elsif (($origtext =~ /^Date de sortie/) + && (!$self->{curInfo}->{date})) + { + $self->{insideDate} = 1; + } + elsif (($origtext =~ /^Date de reprise/) + && (!$self->{curInfo}->{date})) + { + $self->{insideDate} = 1; + } + elsif ($self->{insideTime} eq 1) + { + $origtext =~ /(\d+)h\s*(\d+)m/; + my $time = ($1*60) + $2; + $self->{curInfo}->{time} = $time." m."; + $self->{insideTime} = 0; + } + elsif ($self->{insideDirector} eq 2) + { + $origtext = ", " if $origtext =~ m/^,/; + $self->{curInfo}->{director} .= $origtext; + } + elsif ($origtext =~ /^R..?alis..? par/) + { + $self->{insideDirector} = 1; + } + elsif ($self->{insideActor} eq 2) + { + $origtext =~ s/plus//; + $origtext = "," if $origtext =~ m/^,/; + $self->{curInfo}->{actors} .= $origtext; + } + elsif ($origtext =~ /^Avec/) + { + $self->{insideActor} = 1; + } + elsif ($self->{insideGenre} eq 2) + { + $origtext = "," if $origtext =~ m/^,/; + $self->{curInfo}->{genre} .= $origtext; + } + elsif ($origtext =~ /^[\s\n]*Genre/) + { + $self->{insideGenre} = 1; + } + elsif ($self->{insideCountry} eq 2) + { + $origtext = "," if $origtext =~ m/^,/; + $self->{curInfo}->{country} .= $origtext; + } + elsif ($origtext =~ /Nationalité/) + { + $self->{insideCountry} = 1; + } + elsif ($origtext =~ /^Presse$/) + { + $self->{insidePressRating} = 1; + } + elsif ($self->{insidePressRating} eq 2) + { + $origtext =~ s/,/./; + $self->{curInfo}->{ratingpress} .= $origtext * 2; + } + elsif ($origtext =~ /^Interdit aux moins de (\d+) ans/) + { + $self->{curInfo}->{age} = $1; + } + elsif ($self->{insideSynopsis} eq 1) + { + $self->{curInfo}->{synopsis} .= $origtext; + } + elsif ($self->{insideOriginal} eq 2) + { + $self->{curInfo}->{original} = $origtext; + $self->{insideOriginal} = 0; + } + elsif ($origtext =~ /^Titre original/) + { + $self->{insideOriginal} = 1; + } + + + + } + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + + $self->{hasField} = { + title => 1, + date => 1, + director => 1, + actors => 1, + }; + + $self->{isInfo} = 0; + $self->{isMovie} = 0; + $self->{insideResults} = 0; + $self->{curName} = undef; + $self->{curUrl} = undef; + $self->{actorsCounter} = 0; + + bless($self, $class); + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + # f=3 ? + # return "http://www.allocine.fr/recherche/?q=$word&f=3&rub=1"; + return "http://www.allocine.fr/recherche/1/?q=$word"; + } + + sub getSearchCharset + { + my $self = shift; + + # Need urls to be double character encoded + return "utf8"; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return "http://www.allocine.fr" . $url; + } + + sub getName + { + return "Allocine.fr"; + } + + sub getAuthor + { + return 'Tian'; + } + + sub getLang + { + return 'FR'; + } + + sub getCharset + { + # return "UTF-8"; # For 1.5.0 Win32 + return "ISO-8859-1"; # For 1.5.0 Win32 with /lib/gcstar/GCPlugins/ ver.1.5.9svn + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCfilms/GCAlpacineES.pm b/lib/gcstar/GCPlugins/GCfilms/GCAlpacineES.pm new file mode 100644 index 0000000..75c6854 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCfilms/GCAlpacineES.pm @@ -0,0 +1,435 @@ +package GCPlugins::GCfilms::GCAlpacineES; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# This file is part of GCstar. +# +# GCstar is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# GCstar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCstar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# +################################################### + +use strict; +use utf8; + +use GCPlugins::GCfilms::GCfilmsCommon; + +{ + package GCPlugins::GCfilms::GCPluginAlpacineES; + + use base qw(GCPlugins::GCfilms::GCfilmsPluginsBase); + + + # text + # Called each time some plain text (between tags) is processed. + # $origtext is the read text. + sub text + { + my ($self, $origtext) = @_; + + return if length($origtext) < 2; + + # Código para procesar el resultado de la busqueda + if ($self->{parsingList}){ + # Guardamos la fecha. + if ($self->{inside}->{li} && $self->{insideInfos}){ + $origtext =~ /. \(([0-9]{4})\)/; + $self->{itemsList}[$self->{itemIdx}]->{date} = $origtext; + } + # Guardamos el título + if ($self->{inside}->{a} && $self->{insideInfos}){ + $self->{itemsList}[$self->{itemIdx}]->{title} = $origtext; + } + } + + else{ + # Eliminamos espacios iniciales, espacios dobles y espacios finales del texto + $origtext =~ s/^\s*|\s{2,}|\s*$//g; + # Estamos procesando el titulo + if ($self->{insideTitle}) + { + # Obtenemos titulo y fecha + $origtext =~ /(.*) \(([0-9]{4})\)/; + $self->{curInfo}->{title} = $1; + $self->{curInfo}->{date} = $2; + $self->{insideTitle} = 0; + return; + } + + # Si existe el hipervinculo "Ampliar" cambiamos la imagen por la ampliada + if ($self->{inside}->{a} && $origtext eq "Ampliar"){ + $self->{curInfo}->{image} =~ /(http:\/\/img.alpacine.com\/carteles\/.*)-[0-9]*(\.jpg)/; + $self->{curInfo}->{image} = $1 . $2; + return; + } + # Estamos en la puntuación real + if($self->{insideRating}){ + $self->{curInfo}->{ratingpress} = int( $origtext + 0.5 ); + $self->{insideRating} = 0; + } + # No hay puntuación real, asignamos 0 por defecto + if($self->{inside}->{div}){ + if($origtext =~ /Esperando \d votos/){ + $self->{curInfo}->{ratingpress} = 0; + } + } + # Procesamos el titulo original + if ($self->{isOrigTit} eq 1) { + $self->{isOrigTit} = 0; + $self->{curInfo}->{original} = $origtext; + return; + } + # Procesamos los generos (gen, gen, gen, gen...) + if ($self->{isGenres} eq 1) { + if($origtext ne ""){ + # hacemos uso de sus propias comas + $self->{curInfo}->{genre} .= $origtext; + } + else{ + $self->{isGenres} = 0; + } + return; + } + # Procesamos el país + if ($self->{isCountry} eq 1) { + $self->{isCountry} = 0; + $self->{curInfo}->{country} = $origtext; + return; + } + # Procesamos la duración + if ($self->{isTime} eq 1) { + $self->{isTime} = 0; + $self->{curInfo}->{time} = $origtext; + return; + } + # Procesamos los directores + if ($self->{isDirector} eq 1) { + if($origtext ne ""){ + if($self->{curInfo}->{director} eq ""){ + $self->{curInfo}->{director} .= $origtext; + } + else{ + $self->{curInfo}->{director} .= ", $origtext"; + } + } + else{ + $self->{isDirector} = 0; + } + return; + } + # Actores + if ($self->{isActors} eq 1) { + if($origtext ne ""){ + if($self->{curInfo}->{actors} eq ""){ + $self->{curInfo}->{actors} .= $origtext; + } + else{ + $self->{curInfo}->{actors} .= ", $origtext"; + } + } + else{ + $self->{isActors} = 0; + } + return; + } + # Procesamos la Sinopsis + if ($self->{isSynopsis} eq 1) { + $self->{isSynopsis} = 0; + $self->{curInfo}->{synopsis} = $origtext; + return; + } + # Procesamos los premios + if ($self->{isAwards} eq 1) { + $self->{isAwards} = 0; + $self->{curInfo}->{synopsis} = $self->{curInfo}->{synopsis}. "\n\nPremios:\n\t".$origtext; + $self->{insideInfos} = 0; + return; + } + + # Condiciones para procesar los campos en el siguiente ciclo + if($self->{insideInfos}){ + $self->{isOrigTit} = 1 if $origtext eq "Título original:"; + $self->{isGenres} = 1 if $origtext eq "Género:"; + $self->{isCountry} = 1 if $origtext eq "País:"; + $self->{isTime} = 1 if $origtext eq "Duración:"; + $self->{isDirector} = 1 if $origtext eq "Dirección:"; + $self->{isActors} = 1 if $origtext eq "Interpretación:"; + $self->{isSynopsis} = 1 if $origtext eq "Sinopsis:"; + $self->{isAwards} = 1 if $origtext eq "Premios:"; + } + } + } + + + # end + # Called each time a HTML tag ends. + # $tagname is the tag name. + sub end + { + my ($self, $tagname) = @_; + $self->{inside}->{$tagname}--; + + # Código para procesar el resultado de la busqueda + #if ($self->{parsingList}){ + #} + # Código para procesar la información de la pelicula seleccionada + #else { + #} + } + + # In processing functions below, self->{parsingList} can be used. + # If true, we are processing a search results page + # If false, we are processing a item information page. + + # $self->{inside}->{tagname} (with correct value for tagname) can be used to test + # if we are in the corresponding tag. + + # You have a counter $self->{itemIdx} that have to be used when processing search results. + # It is your responsability to increment it! + + # When processing search results, you have to fill the available fields for results + # + # $self->{itemsList}[$self->{movieIdx}]->{field_name} + # + # When processing a movie page, you need to fill the fields (if available) + # in $self->{curInfo}. + # + # $self->{curInfo}->{field_name} + + # start + # Called each time a new HTML tag begins. + # $tagname is the tag name. + # $attr is reference to an associative array of tag attributes. + # $attrseq is an array reference containing all the attributes name. + # $origtext is the tag text as found in source file + # Returns nothing + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + $self->{inside}->{$tagname}++; + + # Código para procesar el resultado de la busqueda para generar el listado + if ($self->{parsingList}) + { + # Comprobamos si estamos dentro de un título utilizando el atributo class + if( ($tagname eq "li" ) && ($attr->{class} ne "mas" )){ + $self->{itemIdx}++; + $self->{insideInfos} = 1 ; + return; + } + if( ($tagname eq "li" ) && ($attr->{class} eq "mas" )){ + $self->{insideInfos} = 0; + return; + } + # Si estamos en un título y encontramos una tag a, es un enlace a ficha + if ($tagname eq "a" && $self->{insideInfos}){ + $self->{itemsList}[$self->{itemIdx}]->{url} = "http://www.alpacine.com".$attr->{href}; + return; + } + } + # Código para procesar la información de la pelicula seleccionada + else { + if ($tagname eq "h1"){ + $self->{insideTitle} = 1; + return; + } + # Si estamos dentro de una imagen y el src es el del thumb lo asignamos como imagen + if ($tagname eq "img") + { + # Extraemos la dirección de la imagen thumb + if ($attr->{src} =~ /http:\/\/img.alpacine.com\/carteles\/.*\.jpg/) + { + $self->{curInfo}->{image} = $attr->{src}; + } + return; + } + + if ($tagname eq "div" && $attr->{class} eq "voto"){ + $self->{insideRating} = 1; + return; + } + + if( $tagname eq "div" && $attr->{class} eq "datos" ){ + $self->{insideInfos} = 1 ; + return; + } + } + } + + # preProcess + # Called before each page is processed. You can use it to do some substitutions. + # $html is the page content. + # Returns modified version of page content. + sub preProcess + { + my ($self, $html) = @_; + + # Anulamos el html si coincide con el patron de no resultados + if($html =~ /^.*No hay resultados para.*$/s){ + $html = ""; + return $html; + } + + # Recorta el código del listado de resultados, quedandose solo con la parte que nos interesa del html + # el modificador s/.../$1/s trata el flujo como una sola cadena y reemplaza todo el cuerpo con la parte que nos interesa + if($html =~ s/^.*
Pel.culas \([0-9]* resultado[s]?\)<\/span><\/div>