Gå til innhold

DVD bibliotek program.


r2d290

Anbefalte innlegg

- bildet ble helt rart (mange fargerike firkanter)

Legg til "binmode IMAGE;" , slik at det blir seende slik ut:

if ($response->is_success) {
 open IMAGE , ">output/$filmID.jpg";
 binmode IMAGE;
 print IMAGE $response->content;
 close IMAGE;
} else {
 die "Error retrieving picture";
}

feilen var hvordan windows behandler filer.

 

EDIT: @cyclo: vet du om det finnes et plugin til mythTV?

Endret av sindreij
Lenke til kommentar
Videoannonse
Annonse

er ganske sikker på at jeg gjorde det du sa for å få til loop:

 

#!/usr/bin/perl

 

use LWP::UserAgent;

use HTTP::Request;

use HTTP::Response;

use HTTP::Cookies;

 

$DEBUG = 0;

 

$cookies = HTTP::Cookies->new(file=>'/tmp/rippercookiejar',autosave => 1,);

$ua = new LWP::UserAgent;

$ua->cookie_jar($cookies);

 

while ($filmID ne "exit") {

while ($filmID !~ /\d+/) {

print "Enter a valid film ID: ";

$filmID = <>;

}

chop($filmID);

 

$request = new HTTP::Request 'GET', 'http://www.brafilm.no/browse.do?show=movie&id='.$filmID;

$ua->prepare_request($request);

$response = $ua->request($request);

if ($response->is_success) {

$html = $response->content;

($garbage,$movie) = split(/<div id="browseMovieInfo">/,$html);

if ($movie =~ /<h1>(.+)<\/h1>/i) {

$title = $1;

debug("TITLE: ".$title);

}

if ($movie =~ /\((\d{4})\)/i) {

$filmyear = $1;

debug("YEAR: ".$filmyear);

}

if ($movie =~ /stars_1_(\d{2})\.gif/i) {

$rating = $1;

$rating = $rating*2/10;

debug("RATING: ".$rating);

}

if ($movie =~ /<p class="movieDescription">([^<]+)/i) {

$description = $1;

$description =~ s/[\t\n\r]//g;

debug("DESCRIPTION: ".$description);

}

if ($movie =~/Originaltittel[\n\t]+<\/th>[\n\t]+<td>[\n\t]+(.+)[\n\t]+<\/td>/i) {

$originaltitle = $1;

debug("ORIGINALTITLE: ".$originaltitle);

}

($garbage,$temp) = split(/Sjanger/,$movie);

($sjangersource,$garbage) = split(/kkelord/,$temp);

while ($sjangersource =~ /href="\/category\/\d+.+\.do" title="Les mer: .+" >(.+)<\/a>/gi) {

push (@s,$1);

}

foreach (@s) {

$sjanger .= $_.", ";

}

chop($sjanger);

chop($sjanger);

debug("SJANGER: ".$sjanger);

($garbage,$temp) = split(/Manus/,$movie);

($manussource,$garbage) = split(/Skuespillere/,$temp);

while ($manussource =~ /href="\/person\/\d+.+\.do" title="Les mer: .+" >(.+)<\/a>/gi) {

push (@m,$1);

}

foreach (@m) {

$manus .= $_.", ";

}

chop($manus);

chop($manus);

debug("MANUS: ".$manus);

($actorsource,$garbage) = split(/Regis/,$garbage);

while ($actorsource =~ /href="\/person\/\d+.+\.do" title="Les mer: .+" >(.+)<\/a>/gi) {

push (@a,$1);

}

foreach (@a) {

$actor .= $_.", ";

}

chop($actor);

chop($actor);

debug("SKUESPILLERE: ".$actor);

($directorsource,$garbage) = split(/Premieredato/,$garbage);

while ($directorsource =~ /href="\/person\/\d+.+\.do" title="Les mer: .+" >(.+)<\/a>/gi) {

push (@d,$1);

}

foreach (@d) {

$director .= $_.", ";

}

chop ($director);

chop ($director);

debug("DIRECTOR: ".$director);

if ($movie =~/Spilletid:[\n\t]+<\/th>[\n\t]+<td>[\n\t]+(\d+) tim (\d+) min/gi) {

$playtime = $1*60 + $2;

debug("PLAYTIME: ".$playtime);

}

if ($movie =~/Land:[\n\t]+<\/th>[\n\t]+<td>[\n\t]+(.+)[\n\t]+<\/td>/gi) {

$country = $1;

$country =~ s/,/, /g;

debug("COUNTRY: ".$country);

}

if ($movie =~/Tale\):[\n\t]+<\/th>[\n\t]+<td>[\n\t]+([^<]+)/gi) {

$tale = $1;

$tale =~ s/[\n\t]//g;

chop($tale);

$tale =~ s/,/, /g;

debug("TALE: ".$tale);

}

if ($movie =~/Lydformat:[\n\t]+<\/th>[\n\t]+<td>[\n\t]+([^<]+)/gi) {

$audio = $1;

$audio =~ s/[\n\t]//g;

chop($audio);

$audio =~ s/,/, /g;

debug("LYDFORMAT: ".$audio);

}

if ($movie =~/Undertekster\):[\n\t]+<\/th>[\n\t]+<td>[\n\t]+([^<]+)/gi) {

$subtitle = $1;

$subtitle =~ s/[\n\t]//g;

chop($subtitle);

$subtitle =~ s/,/, /g;

debug("SUBTITLE: ".$subtitle);

}

if ($movie =~/Bild:[\n\t]+<\/th>[\n\t]+<td>[\n\t]+([^<]+)/gi) {

$video = $1;

$video =~ s/[\n\t]//g;

chop($video);

$video =~ s/,/, /g;

debug("VIDEO: ".$video);

}

while ($path eq "") {

print "Enter the movie path:";

$path = <>;

chop($path);

}

$path =~ s/VIDEO_TS.IFO//i;

if ($path !~ /\\$/) {

$path .= "\\";

}

$path .= "VIDEO_TS.IFO";

while ($type !~ /[1234]/) {

print "Enter type:\n\t1) DVD on Hard-drive\n\t2) DVD-burned\n\t3) DVD\n\t4) DivX\n";

$type = <>;

}

@moviestypes = ("DVD on Hard-drive","DVD-burned","DVD","DivX");

chop($type);

$request = new HTTP::Request 'GET', 'http://www.brafilm.no/img/cover/movie/huge/'.$filmID.'.jpg';

$ua->prepare_request($request);

$response = $ua->request($request);

if ($response->is_success) {

open IMAGE , ">output/$filmID.jpg";

binmode IMAGE;

print IMAGE $response->content;

close IMAGE;

} else {

die "Error retrieving picture";

}

} else {

die "Error retrieving movie with ID $filmID";

}

 

open OUTPUTFILE, "output/dvddatabase.xml";

@outputfile = <OUTPUTFILE>;

close OUTPUTFILE;

 

foreach $line(@outputfile) {

if ($line =~ /<Movie/) {

push (@movies,$line);

}

}

$noofmovies = @movies;

 

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

 

open BF, ">output/dvddatabase.xml";

print BF "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<AntMovieCatalog Format=\"35\" Version=\"3.5.0 (2005-05-29)\" Date=\""

.sprintf("%02d.%02d.%04d %02d:%02d:%02d",$mday,$mon+1,$year+1900,$hour,$min,$sec)

."\">\n\t<Catalog>\n\t\t<Properties/>\n\t\t<Contents>\n";

foreach $line(@movies) {

print BF $line;

}

print BF "\t\t\t<Movie Number=\"".($noofmovies+1)."\" Checked=\"True\" MediaType=\"".$moviestypes[$type-1]."\" Date=\""

.sprintf("%02d.%02d.%04d",$mday,$mon+1,$year+1900)."\" Rating=\"$rating\" OriginalTitle=\"$originaltitle\""

." TranslatedTitle=\"$title\" FormattedTitle=\"$title\" Director=\"$director\" Producer=\"$manus\" Country=\"$country\""

." Category=\"$sjanger\" Year=\"$filmyear\" Length=\"$playtime\" Actors=\"$actor\" URL=\"$path\" Description=\"$description\""

." VideoFormat=\"$video\" AudioFormat=\"$audio\" Languages=\"$tale\" Subtitles=\"$subtitle\" Size=\"0\" Disks=\"1\""

." Picture=\"$filmID.jpg\"/>\n";

print BF "\t\t</Contents>\n\t</Catalog>\n</AntMovieCatalog>";

 

close BF;

}

 

sub debug {

local ($toprint) = @_;

if ($DEBUG==1) {

print $toprint."\n";

}

}

 

ser du noe feil? feilmeldina er:

Error retrieving picture at E:\DVDr\bibliotek\brafilmripper.pl line 153.

Endret av r2d290
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...