دعم الموقع

Hi

I need some newbee advise on how to extract the elements from movie->info using the perl moduel {WWW-TMDB-API }{https://www.themoviedb.org/talk#precode}

I'm not so hot on my Object Orientated perl!

for instance this fails with an error

 my $img = $movie->poster_path;

but

my $movie_title = $movie->title; works?

this produces a hash when printed

my @movie_images= $movie->images;

this gives a list of actors but no person id

  my @movie_actors    = $movie->actors;

Has any one got a good example of how to do this other then the CPAN page?

here is my script so far

   #!C:/Perl64/bin/perl.exe
  use TMDB;
  use Data::Dumper qw(Dumper); 
  use CGI;
  use JSON;


my $cgi = CGI->new();
my $tmd= $cgi->param('tmd');

# Initialize
$tmd = "60304";
my $tmdb = TMDB->new( apikey => 'xxxxxxxxxx' );

# HTTP HEADER

print "Content-type:text/html\n\n"; 

# Movie Data
# ===========
#  
# Movie Object
#  $result = $tmdb->movie->info( ID => $tmd );
#  print Dumper $result;
  my $movie = $tmdb->movie( id =>  $tmd );
# # # Movie Data (as returned by the API)
# # 
print Dumper $movie->info;  
# # # Movie details
my $movie_title     = $movie->title;
my $MIDB =  $movie->imdb_id;
my $movie_year      = $movie->year;
my $movie_tagline   = $movie->tagline;
my $movie_overview  = $movie->overview;
my @movie_directors = $movie->director;
my @movie_actors    = $movie->actors;
my @movie_images= $movie->images;

print Dumper $movie->images;   

these fail

#    my $img = $movie->poster_path;
#    $img =   "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/w185" . $img;
#    my $poster_path = qq(<img src='$img'>);
#    my $img =   "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/w300" . $movie->backdrop_path;
#    my $backdrop_path = qq(<img src='$img'>);

2 ردود (على هذه الصفحة 1 من 1)

Jump to last post

I'm currently rewriting my API version 2 module, only have about 5 functions to go: http://search.cpan.org/~pjobson/WWW-TheMovieDB-Search/lib/WWW/TheMovieDB/Search.pm

I plan on being finished next week and publishing to CPAN shortly there after.

The last update on the other module was December of 2008, it is definitely using version 2 of the API. http://search.cpan.org/~behanw/TVDB-API-0.33/

For http requests you might want to try LWP::Simple, much less annoying than doing CGI requests.

Feel free to contact me directly, my email is in that perl module.

What about the TMDB module? Or is that the one that is Ning23 is using? It was updated recently.

I'm not familiar with Perl at all, just know some libs exist for it :D

لم تجد الفلم أو المسلسل ؟ سجل دخولك و انشئها

عام

s ركز شريط البحث
p افتح قائمة الملف الشخصي
esc اغلق النافذة المفتوحة
? افتح نافذة اختصارات لوحة المفاتيح

على كافة صفحات الوسائط

b ارجع للخلف (او للصفحة الام عند التطبيق)
e انتقل لصفحة التعديل

على كافة صفحات موسم المسلسل

(السهم الايمن) انتقل للموسم التالي
(السهم الايسر) انتقل للموسم السابق

على كافة صفحات حلقة المسلسل

(السهم الايمن) انتقل للحلقة التالية
(السهم الايسر) انتقل للحلقة السابقة

على كافة صفحات الصور

a افتح صفحة اضافة الصورة

على كافة صفحات التعديل

t افتح محدد الترجمة
ctrl+ s ارسال النموذج

على صفحات المناقشة

n انشى نقاش جديد
w تبديل حالة المتابعة
p تبديل عام / خاص
c تبديل اغلاق / فتح
a افتح الانشطة
r رد على النقاش
l انتقل لأخر رد
ctrl+ enter أرسل رسالتك
(السهم الايمن) الصفحة التالية
(السهم الايسر) الصفحة السابقة

الاعدادات

هل تريد تقييم او اضافة هذا العنصر للقائمة؟

تسجيل الدخول