Hi guys,
I've been using the program for a while, and needless to say that it's the best there is.
Although, I was thinking of some add-ons, not really add-ons, but maybe a small script who can do the following :
1- Get the whole genre for a movie, not just Darma for example, but something liking Drama / Comedy / War (is there a movie that is Drama and Comedy and war in the same time, naaah don't think so )
And put the info in the Categroy Field if possible.
2- Gets the tageline and puts it in the Comments Field.
3- Gets the exact User Ratings and the number of votes and puts it also in the comments field too, and maybe it would be nice if it the date of this info was added, which will be the same day of adding it.
4- Maybe also gets the Writing Credits and puts it in the producer field.
BUT
In the same time of Adding these info, it will not remove the old info, it will just add to it, coz for guys who have been using the program for a while it will hard for them to re-run the script for the all the movies.
It will be very nice also if it can get these info for the WHOLE list at once, or maybe also add these new features to the main IMDB script.
What do you think of these changes.....??
Can anyone help with them, or do you even like these adds ...??
Or is it possible to add info to the movie without changing the rest...??
Waiting for your responses.
And Thanks alot in advance.
Needed Small Script
Here is the Script
Here is the script to do all the stuff mentioned above + the movie language + if the movie was from the top #250 it will write that.
All Credits For this script goes to Lacc, THANKS A LOT MAN.
All Credits For this script goes to Lacc, THANKS A LOT MAN.
Code: Select all
// GETINFO SCRIPTING
// Script for Modification (made by Lacc)
(***************************************************
* Movie importation script for: *
* IMDB (US), http://us.imdb.com *
* *
* (c) 2002 Antoine Potten antoine@buypin.com *
* Contributors : *
* Danny Falkov *
* Kai Blankenhorn *
* lboregard *
* Ork <ork@everydayangels.net> *
* Trekkie <Asimov@hotmail.com> *
* *
* For use with Ant Movie Catalog 3.4.0 *
* www.ant.be.tf/moviecatalog ··· www.buypin.com *
* *
* The source code of the script can be used in *
* another program only if full credits to *
* script author and a link to Ant Movie Catalog *
* website are given in the About box or in *
* the documentation of the program *
***************************************************)
program IMDb;
var
MovieName: string;
MovieURL: string;
TheMovieTitle: string;
TheMovieAddress: string;
function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
i: Integer;
begin
Result := -1;
if StartAt < 0 then
StartAt := 0;
for i := StartAt to List.Count-1 do
if Pos(Pattern, List.GetString(i)) <> 0 then
begin
Result := i;
Break;
end;
end;
procedure AnalyzePage(Address: string);
var
Page: TStringList;
LineNr: Integer;
begin
Page := TStringList.Create;
Page.Text := GetPage(Address);
if pos('<TITLE>IMDb', Page.Text) = 0 then
begin
AnalyzeMoviePage(Page)
end else
begin
PickTreeClear;
LineNr := 0;
LineNr := FindLine('<H2><A NAME="top">Most popular searches</A></H2>', Page, LineNr);
if LineNr > -1 then
begin
PickTreeAdd('Most popular searches', '');
AddMoviesTitles(Page, LineNr);
end;
LineNr := FindLine('<H2><A NAME="mov">Movies</A></H2>', Page, LineNr);
if LineNr > -1 then
begin
PickTreeAdd('Movies', '');
AddMoviesTitles(Page, LineNr);
end;
LineNr := FindLine('<H2><A NAME="tvm">TV-Movies</A></H2>', Page, LineNr);
if LineNr > -1 then
begin
PickTreeAdd('TV-Movies', '');
AddMoviesTitles(Page, LineNr);
end;
LineNr := FindLine('<H2><A NAME="vid">Made for video</A></H2>', Page, 0);
if LineNr > -1 then
begin
PickTreeAdd('Made for video', '');
AddMoviesTitles(Page, LineNr);
end;
LineNr := FindLine('<H2><A NAME="tvs">TV series</A></H2>', Page, LineNr);
if LineNr > -1 then
begin
PickTreeAdd('TV Series', '');
AddMoviesTitles(Page, LineNr);
end;
//Sometimes, the IMDb sends a title in Most Popular Searches
// and the same title in Movies.
//TheMovieAddress and TheMovieTitle are used to choose directly
// that one movie instead of asking the user.
if TheMovieAddress = '' then
begin
if PickTreeExec(Address) then
AnalyzePage(Address);
end
else
AnalyzePage(TheMovieAddress);
end;
Page.Free;
end;
function FindValue(BeginTag, EndTag: string; Page: TStringList; var LineNr: Integer; var Line: string): string;
var
BeginPos, EndPos: Integer;
Value: string;
begin
Result := '';
Value := '';
BeginPos := Pos(BeginTag, Line);
if BeginPos > 0 then
begin
BeginPos := BeginPos + Length(BeginTag);
if BeginTag = EndTag then
begin
Delete(Line,1,BeginPos-1);
BeginPos := 1;
end;
EndPos := pos(EndTag, Line);
while ((EndPos = 0) and (LineNr < Page.Count-1 )) do
begin
Value := Value + copy(Line, BeginPos, Length(Line) - BeginPos);
// Next Line
BeginPos := 1;
LineNr := LineNr + 1;
Line := Page.GetString(LineNr);
if Value = '' then
Exit;
EndPos := Pos(EndTag, Line);
end;
Value := Value + copy(Line, BeginPos, EndPos - BeginPos);
end;
Result := Value;
end;
procedure AnalyzeMoviePage(Page: TStringList);
var
Line, Value, FullValue, RatingVotes, Rating, Votes, OldComments, Date, AddingDate, Tagline, top250 : string;
LineNr, BeginPos, EndPos, DescrImport, RSticks, VSticks, i: Integer;
AllTitles: TStringList;
begin
// Rating, Votes, Top250
LineNr := FindLine('User Rating:', Page, 0);
if LineNr > -1 then
begin
LineNr := LineNr+4;
Line := Page.GetString(LineNr);
BeginPos := pos('<b>', Line) + 3;
EndPos := pos('</b>', Line);
Rating := copy(Line, BeginPos, EndPos - BeginPos);
BeginPos := pos('</b> (', Line) + 6;
EndPos := pos(' votes)', Line);
Votes := copy(Line, BeginPos, EndPos - BeginPos);
LineNr := FindLine('top_250_films', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('films">', Line) + 7;
EndPos := pos('</a>', Line);
top250 := copy(Line, BeginPos, EndPos - BeginPos);
RatingVotes := 'Rating :' + #13#10 + '-------------' + #13#10 + Rating + ' ' + top250 + #13#10 + #13#10 + 'Number of votes :' + #13#10 + '-----------------------------' + #13#10 + Votes + #13#10 + #13#10;
end
else
RatingVotes := 'Rating :' + #13#10 + '-------------' + #13#10 + Rating + #13#10 + #13#10 + 'Number of votes :' + #13#10 + '-----------------------------' + #13#10 + Votes + #13#10 + #13#10;
end;
// Writer
LineNr := FindLine('Writing credits', Page, 0);
if LineNr > -1 then
begin
FullValue := '';
LineNr:=LineNr+1;
Line := Page.GetString(LineNr);
Repeat
LineNr := LineNr + 1;
Line := Page.GetString(LineNr);
Until (Pos('name', Line)<>0);
repeat
BeginPos := pos('">', Line) + 2;
EndPos := pos('<br>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
HTMLDecode(Value);
HTMLRemoveTags(Value);
if (Value <> '(more)') and (Value <> '') then
begin
if FullValue <> '' then
FullValue := FullValue + ' ';
FullValue := FullValue + Value;
end;
Delete(Line, 1, EndPos);
until (Pos('">', Line) = 0);
SetField(fieldProducer, FullValue);
end;
//Category
LineNr := FindLine('Genre:', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr + 1);
BeginPos := pos('/">', Line) + 3;
EndPos := pos('</a>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
HTMLDecode(Value);
SetField(fieldCategory, Value);
// Multiple categories
Value := '';
BeginPos := pos('Sections/Genres/', Line);
while BeginPos > 0 do
begin
Line := copy(Line, BeginPos+16, Length(Line)-BeginPos-17);
EndPos := pos('/">', Line);
Value := Value + ' / ' + copy(Line, 1, EndPos-1);
BeginPos := pos('Sections/Genres/', Line);
end;
Value := copy(Value,4,Length(Value)-1);
HTMLDecode(Value);
SetField(fieldCategory, Value);
end;
// Language
LineNr := FindLine('Language:', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr + 1);
BeginPos := pos('/">', Line) + 3;
EndPos := pos('</a>', Line);
if EndPos = 0 then
EndPos := Length(Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
HTMLDecode(Value);
SetField(fieldLanguages, Value);
// Multiple Languages
Value := '';
BeginPos := pos('Sections/Languages/', Line);
while BeginPos > 0 do
begin
Line := copy(Line, BeginPos+19, Length(Line)-BeginPos-20);
EndPos := pos('/">', Line);
Value := Value + ' / ' + copy(Line, 1, EndPos-1);
BeginPos := pos('Sections/Languages/', Line);
end;
Value := copy(Value,4,Length(Value)-1);
HTMLDecode(Value);
SetField(fieldLanguages, Value);
end;
//AddingDate
Date := GetField(fieldDate);
AddingDate := 'Date of adding :' + #13#10 + '--------------------------' + #13#10 + Date + #13#10 + #13#10;
// Comments
OldComments := GetField(fieldComments);
LineNr := FindLine('Tagline:', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('</b>', Line) + 5;
EndPos := pos('<a href', Line);
if EndPos < 1 then
EndPos := Length(Line)+1;
Value := copy(Line, BeginPos, EndPos - BeginPos);
HTMLDecode(Value);
Tagline := 'Tagline :' + #13#10 + '--------------' + #13#10 + Value + #13#10 + #13#10;
SetField(fieldComments, Tagline + RatingVotes + AddingDate + OldComments);
end
else
SetField(fieldComments, RatingVotes + AddingDate + OldComments);
DisplayResults;
end;
function GetToken(aString, SepChar: String; TokenNum: Integer):String;
var
Token : string;
StrLen : Integer;
TNum : Integer;
TEnd : Integer;
begin
StrLen := Length(aString);
TNum := 1;
TEnd := StrLen;
while ((TNum <= TokenNum) and (TEnd <> 0)) do
begin
TEnd := Pos(SepChar,aString);
if TEnd <> 0 then
begin
Token := Copy(aString,1,TEnd-1);
Delete(aString,1,TEnd);
TNum := TNum + 1;
end
else
begin
Token := aString;
end;
end;
if TNum >= TokenNum then
begin
GetToken := Token;
end
else
begin
GetToken := '';
end;
end;
function AsinParse(Line : string): string;
begin
Result := GetToken(GetToken(Line,'.',2),Chr(34),1);
end;
function Log(p: Extended): Extended;
var
x,w,d: Extended;
i,j: Integer;
e: Extended;
begin
if p < 1 then p := 1;
d:=0;
w:=1;
e:=10;
for j:=0 to 5 do
begin
x:=1;
i:=0;
while (x < p) do
begin
x:=x*e;
i:=i+1;
end;
d:=d+(i-1)*w;
w:=w/10;
p:=p/(x/e);
p:=p*p*p*p*p*p*p*p*p*p;
end;
Result := d;
end;
procedure AddMoviesTitles(Page: TStringList; var LineNr: Integer);
var
Line: string;
MovieTitle, MovieAddress: string;
StartPos: Integer;
begin
repeat
LineNr := LineNr + 1;
Line := Page.GetString(LineNr);
StartPos := pos('="', Line);
if StartPos > 0 then
begin
Startpos := Startpos + 2;
MovieAddress := copy(Line, StartPos, pos('">', Line) - StartPos);
StartPos := pos('">', Line) + 2;
MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
HTMLDecode(Movietitle);
//Remove duplicates
if TheMovieTitle='' then
begin
TheMovieTitle:=MovieTitle;
TheMovieAddress:='http://us.imdb.com' + MovieAddress;
end
else
begin
if TheMovieTitle<>'*' then
if TheMovieTitle<>MovieTitle then
begin
TheMovieTitle:='*';
TheMovieAddress:='';
end;
end;
PickTreeAdd(MovieTitle, 'http://us.imdb.com' + MovieAddress);
end;
until pos('</OL>', Line) > 0;
end;
begin
if CheckVersion(3,4,0) then
begin
if GetField(fieldURL) = '' then
begin
TheMovieTitle:='';
TheMovieAddress:='';
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('IMDb Import', 'Enter the title of the movie:', MovieName) then
// AnalyzePage('http://us.imdb.com/Tsearch?title='+UrlEncode(MovieName)+'&restrict=Movies+only');
AnalyzePage('http://us.imdb.com/Tsearch?title='+UrlEncode(MovieName));
end
else AnalyzePage(GetField(fieldURL));
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.