(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=bad4u Title=Adult DVD Empire Description=Adult DVD Empire Site=http://www.adultdvdempire.com/ Language=EN Version=1.4.0 - 29/06/2010 Requires=3.5.0 Comments=Inspired by ADE script from Karagarga and Stryker ;)|Itself based on Twink's ADME script License=IMPORTANT NOTICE:||THIS SCRIPT IS FOR PERSONAL USE ONLY ! |DO NOT REDISTRIBUTE ANY DATA WITHOUT THE PERMISSION OF THE COPYRIGHT OWNER ! RESPECT COPYRIGHTS !||The script itself 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. | GetInfo=1 [Options] ImportADEReview=1|1|0=Do not import Adult DVD Empire review|1=Import Adult DVD Empire review into 'Comments' field (default) ImportCustomerComments=1|0|0=Do not import customer comments (default)|1=Import customer comments into 'Comments' field ImportBigCover=1|1|0=Import small cover picture|1=Import big cover picture (default) ImportDVDDetails=1|1|0=Do not import DVD details|1=Import DVD details into 'Description' field (default) ImportDVDFeatures=1|1|0=Do not import DVD features|1=Import DVD features into 'Description' field (default) ShowDetailedList=1|1|0=Show only movie names on results list|1=Show more detailed info about movies on results list (default) ***************************************************) // Adult DVD Empire - Script Version 1.1.0 // // v.1.0.0 - 25/11/2007 - first public release // v.1.0.1 - 01/05/2008 - fixed: movie address on search list // v.1.0.2 - 09/10/2008 - fixed: extended results list partially broken // v.1.1.0 - 26/10/2009 - fixed: cover import, detailed results list // v.1.2.0 - 29/10/2009 - fixed: import of comments / reviews // v.1.3.0 - 30/10/2009 - fixed: cover import for specific movies program ADE; uses StringUtils1; const BaseAddress = 'http://www.adultdvdempire.com'; var MovieName: string; function RemoveHTMLCrap(Value: string): string; begin Result := StringReplace(Value, ' ',' '); Result := StringReplace(Result, '>i<','> <'); Result := StringReplace(Result, '…','...'); Result := StringReplace(Result, '“','"'); Result := StringReplace(Result, '”','"'); Result := StringReplace(Result, '–','-'); Result := StringReplace(Result, '‘', ''''); Result := StringReplace(Result, '’', ''''); Result := StringReplace(Result, '’', ''''); Result := StringReplace(Result, 'â€"', '-'); Result := StringReplace(Result, '“', '"'); Result := StringReplace(Result, 'â€', '"'); Result := StringReplace(Result, '…', '...'); Result := StringReplace(Result, 'é', 'é'); Result := StringReplace(Result, '
' + #13#10, #13#10); Result := StringReplace(Result, '
' + #13#10, #13#10); Result := StringReplace(Result, '
' + #13#10, #13#10); Result := StringReplace(Result, '
' + #13#10, #13#10); Result := StringReplace(Result, '
' + #13#10, #13#10); Result := StringReplace(Result, '
', #13#10); Result := StringReplace(Result, '
', #13#10); Result := StringReplace(Result, '
', #13#10); Result := StringReplace(Result, '
', #13#10); Result := StringReplace(Result, '
', #13#10); Result := StringReplace(Result, '
', #13#10); Result := StringReplace(Result, '', #13#10); Result := StringReplace(Result, '' + #13#10 + ' ', #13#10); Result := StringReplace(Result, '' + #13#10, ' '); Result := StringReplace(Result, #13#10#9 + ' 0 do Result := StringReplace(Result, #13#10 + ' ', #13#10); while Pos(' ' + #13#10, Result) > 0 do Result := StringReplace(Result, ' ' + #13#10, #13#10); while (Pos(#13, Result) = 1) or (Pos(#10, Result) = 1) or (Pos(' ', Result) = 1) do Result := Copy(Result, 2, Length(Result)); while Pos(' ', Result) > 0 do Result := StringReplace(Result, ' ', ' '); while Pos(#13#10 + #13#10 + #13#10, Result) > 0 do Result := StringReplace(Result, #13#10+#13#10+#13#10, #13#10+#13#10); end; procedure AnalyzePage(Address: string); var Page: TStringList; LineNr: Integer; Line, MovieTitle, MovieAddress, FullAddress, NextPage : String; begin Page := TStringList.Create; Page.Text := GetPage(Address); if FindLine('Adult DVD Empire - Search - Titles', Page, 0) = -1 then AnalyzeMoviePage(Page, Address) else begin PickTreeClear; LineNr := 0; if FindLine('
', Page, 0) > -1 then begin PickTreeAdd('Adult DVD Empire Title Search:', ''); repeat LineNr := FindLine('
', Page, LineNr+1); if LineNr > -1 then begin Line := Page.GetString(LineNr); MovieTitle := RemoveHTMLCrap(Page.GetString(LineNr)); if GetOption('ShowDetailedList') = 1 then begin MovieTitle := MovieTitle + ' [ ' + RemoveHTMLCrap(Page.GetString(LineNr+5) + ' ' + Page.GetString(LineNr+6) + ' ' + Page.GetString(LineNr+7) + ' ' + ' ' + Page.GetString(LineNr+8) + Page.GetString(LineNr+9) + ' ]'); MovieTitle := StringReplace(MovieTitle, '~', '|'); MovieTitle := StringReplace(MovieTitle, 'Production Year: ', ''); end; MovieAddress := TextBetween( Line, '
'); FullAddress := BaseAddress + MovieAddress; PickTreeAdd(MovieTitle, FullAddress); end; until LineNr = -1; // use "Find more" button for next page // if FindLine('
', Page, 0) > -1 then begin NextPage := Page.GetString(FindLine('
', Page, 0)); NextPage := StringReplace(NextPage, '&', '&'); NextPage := BaseAddress + TextBetween(NextPage, 'Next'); PickTreeMoreLink(NextPage); end; end; if PickTreeExec(Address) then AnalyzePage(Address); end; Page.Free; end; procedure AnalyzeMoviePage(Page: TStringList; Address: string); var Page2: TStringList; ItemID, Line, Value, FullValue, MovieAddress: string; LineNr: Integer; begin MovieAddress := TextAfter(Address, 'http://www.adultdvdempire.com'); // ItemID // ItemID := TextBetween(Address, 'http://www.adultdvdempire.com/', '/'); // URL // SetField(fieldURL, Address); // Original Title // Value := ''; Value := TextBetween(Page.Text, '
', '
'); setField(fieldOriginalTitle,Value); // Actors & Director // Value := ''; FullValue := ''; LineNr := FindLine('', Page, 0); while LineNr > -1 do begin Line := Page.GetString(LineNr+1); Value := RemoveHTMLCrap(Line); Line := Page.GetString(LineNr+5); if Pos('Director', Line) > 0 then setField(fieldDirector, Value); if (Pos('Director', Line) <= 0) and (Pos('Writer', Line) <= 0) then FullValue := FullValue + Value + #13#10; LineNr := FindLine('', Page, LineNr+1); end; setField(fieldActors, FullValue); // Length // Value := ''; if Pos('
Length: ', Page.Text) > -1 then begin Value := TextBetween(Page.Text, '
Length:', '
'); Value := IntToStr(StrToInt(TextBetween(Value, ' ', ' hrs.'),0) * 60 + StrToInt(TextBetween(Value, 'hrs. ', ' mins.'),0)); if Value <> '0' then setField(fieldLength, Value); end; // Rating // Value := ''; if Pos('
Overall Rating: ', Page.Text) > -1 then begin Value := TextBetween(Page.Text, '
Overall Rating: ', ' out of '); HTMLRemoveTags(Value); Value := FloatToStr((StrToFloat(IntToStr(Round((StrToFloat(Value)*2)*10))))/10); if Value <> '0' then setField(fieldRating, Value); end; // Year // Value := ''; if Pos(Page.Text, '
Production Year: ') > -1 then begin Value := TextBetween(Page.Text, '
Production Year: ', '
'); setField(fieldYear, Value); end; // use release date if production year is missing // if (Value = '') and (Pos(Page.Text, '
Release Date: ') > -1) then begin Value := TextBetween(Page.Text, '
Release Date: ', '
'); if Pos(Value, '/') > -1 then Value := TextAfter(Value, '/'); if Pos(Value, '/') > -1 then Value := TextAfter(Value, '/'); setField(fieldYear, Value); end; // Category // Value := ''; if Pos('>Category:', Page.Text) > -1 then begin Value := TextBetween(Page.Text, 'Category:  
', '
'); HTMLRemoveTags(Value); Value := FullTrim(Value); setField(fieldCategory, Value); end; // Studio // Value := ''; if Pos('
Studio: ', Page.Text) > -1 then begin Value := TextBetween(Page.Text, '
Studio: ', '
'); HTMLRemoveTags(Value); setField(fieldProducer, Value); end; if (Value = '') and (Pos('>Studios:', Page.Text) > -1) then begin Value := TextBetween(Page.Text, 'Studios:  
', ''); HTMLRemoveTags(Value); Value := FullTrim(Value); setField(fieldProducer, Value); end; // Number of Discs // Value := ''; if Pos('
Number of Discs: ', Page.Text) > -1 then begin Value := TextBetween(Page.Text, '
Number of Discs: ', '
'); setField(fieldDisks, Value); end; // Description // Value := ''; FullValue := ''; if Pos('', Page.Text) > 0 then begin Value := TextBetween(Page.Text, '', '
'); if Pos('See the trailer for '); Value := StringReplace(Value, 'See the trailer for ', ''); end; Value := RemoveHTMLCrap(Value); FullValue := '[ Synopsis ]' + #13#10 + #13#10 + Value + #13#10 + #13#10; end; // DVD Details // Value := ''; if (GetOption('ImportDVDDetails') = 1) and (Pos('
Detail:', Page.Text) > 0) then begin Value := Value + TextBetween(Page.Text, '
Detail:', '
Features:', Page.Text) > 0) then begin Value := TextBetween(Page.Text, '
Features:', '
0) then begin Page2 := TStringList.Create; Page2.Text := GetPage(BaseAddress + '/reviews' + MovieAddress); if Pos('Reviews', Page2.Text) > -1 then begin Value := TextBetween(Page2.Text, 'Reviews', '', Page.Text) > 0) then begin Page2 := TStringList.Create; Page2.Text := GetPage(BaseAddress + '/comments' + MovieAddress); if Pos('Customer Comments', Page2.Text) > -1 then begin Value := TextBetween(Page2.Text, 'Customer Comments', '
'); Value := StringReplace(Value, 'Customer Review', '[ Customer Review ]' + #13#10); Value := StringReplace(Value, 'Industry Comments', '[ Industry Comments ]' + #13#10); Value := StringReplace(Value, '
', #13#10); // Value := StringReplace(Value, '


', #13#10 + #13#10 + #13#10); Value := RemoveHTMLCrap(Value); FullValue := FullValue + Value + #13#10 + #13#10; end; Page2.Free; end; setField(fieldComments, FullValue); // Cover // Value := ''; if (GetOption('ImportBigCover') = 1) and (Pos('', Page.Text) > 0) and (Pos('>Front', Page.Text) > 0) then begin Page2 := TStringList.Create; Page2.Text := GetPage(BaseAddress + '/boxcover' + MovieAddress); Value := TextBetween(Page2.Text, '
', '
'); Value := TextBetween(Value, ' '' then GetPicture(Value); end else begin Value := TextBetween(Page.Text, '', ''); Value := TextBetween(Value, ' '' then GetPicture(Value); end; if Value = '' then ShowMessage('No cover available'); end; begin if AcceptLicense(5) = False then Exit; if CheckVersion(3,5,0) then begin MovieName := GetField(fieldOriginalTitle); if MovieName = '' then MovieName := GetField(fieldTranslatedTitle); if Input('Adult DVD Empire Import', 'Enter the title of the movie:', MovieName) then AnalyzePage(BaseAddress+'/SearchTitlesPage.aspx?SearchString='+UrlEncode(MovieName)+'&media_id=0'); end else ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)'); end.