//SCRIPT INFO================================================================================================== BlockOpen (* Following until 'SCRIPT BEGINS HERE...' is documentation. Please see 'USER OPTIONS' in the body of the script. --------------------------------------------- SCRIPT: AllMovie.com_new HTTPS(DVDReleases) SOURCE: AllMovie.com_new CO-AUTHORS: Ivek23 VERSION: 1.1.4.0 DATE: 03/03/2021 UPDATE: 25/05/2021 NEW_VERSION: 1.1.4.0 UPDATE: 14/12/2021 --------------------------------------------- FIELD USE: Field names in comments are enclosed in "~" so they are easier to find in the script. Use with your editor's search function to find applicable code sections. AllMovie data: PVD field: FN: Type/Comments: -------------- --------- -- ------------- Category.DVD ~Category.DVD~ multiselect list Category - DVD ~Category - DVD~ multiselect list Category-DVD1 ~Category-DVD1~ multiselect list Category-DVD2 ~Category-DVD2~ multiselect list Allmovie DVD1 ~Allmovie DVD1~ memo Allmovie DVDweb ~Allmovie DVDweb~ memo Allmovie DVDweb1 ~Allmovie DVDweb1~ memo URL ~AMG Wayback Machine Archive3~ memo Footnotes: 1. Control the use of standard fields using the "Overwrite Fields" plugin preferences in the main program. 2. Where data is saved to a standard field, the script also saves the data to custom field. This allows a number of options: i) Use the data saved to the standard field (normally the default) and ignore the custom field. Data saved to a non-existent custom field goes nowhere. ii) Ignore the data entirely by disabling the standard field in the "Overwrite fields" options. iii) Add the custom field to PVD and disable the standard field so it's free for use by another plugin or script. Some of these optional custom fields are named the same as their standard counterparts. To avoid confusion, you may wish to rename them (i.e., in the script, in PVD and your skin). For example, change "Year" to "AllMovie Year"—so as to not be confused with the standard field used by another source. 3. 'User Options' are set in the body of the script below. Recommended: Leave them all set to 'True' and use Preferences > Plugins > AllMovie > Overwrite fields to control how these items are to be updated. *) // //BlockOpen //BlockClose //SCRIPT INFO================================================================================================== BlockClose //SCRIPT BEGINS HERE... //SCRIPT CONSTANTS============================================================================================= BlockOpen //Some useful constants Const //Script types stMovies = 0; stPeople = 1; stPoster = 2; //Script modes smSearch = 0; smNormal = 1; smCast = 2; smReview = 3; smCredits = 4; smDVDReleases = 5; smPoster = 6; smFinished = 7; //Parse results prError = 0; prFinished = 1; prList = 2; prListImage = 3; prDownload = 4; //Prefix modes pmNone = 0; pmEnd = 1; pmBegin = 2; pmRemove = 3; //Download methods dmGET = 0; dmPOST = 1; //Movie fields mfURL = 0; mfTitle = 1; mfOrigTitle = 2; mfAka = 3; mfYear = 4; mfGenre = 5; mfCategory = 6; mfCountry = 7; mfStudio = 8; mfMPAA = 9; mfRating = 10; //This is 'Additional rating', not 'Rating' mfTags = 11; mfTagline = 12; mfDescription = 13; mfDuration = 14; mfFeatures = 15; //People fields pfURL = 0; pfName = 1; pfTransName = 2; pfAltNames = 3; pfBirthday = 4; pfBirthplace = 5; pfGenre = 6; pfBio = 7; pfDeathDate = 8; //Credits types ctActors = 0; ctDirectors = 1; ctWriters = 2; ctComposers = 3; ctProducers = 4; //Image types itPoster = 0; itScreenShot = 1; itFrontCover = 2; itDiscImage = 3; itPhoto = 4; //Script data //SCRIPT_VERSION_OLD = '0.1.1.3.3'; SCRIPT_VERSION = '1.1.4.0'; SCRIPT_NAME = 'AllMovie.com_new_HTTPS(DVDReleases)'; SCRIPT_DESC = '[EN] Get Movie Information from AllMovie.com_new HTTPS Releases page'; SCRIPT_LANG = $09; //English SCRIPT_TYPE = stMovies; BASE_URL = 'http://www.allmovie.com'; BASE_URL_SUF = '/'; BASE_URL_PRE = 'http://www.allmovie.com/movie/'; BASE_URL_PRE_TRUE = 'https://www.allmovie.com/movie/'; BASE_URL_PROX = 'http://allmovie.com:80'; BASE_URL_PROXY = 'http://www.allmovie.com:80'; WEB_URL = 'http://web.archive.org'; WEB_URL_PRE = 'http://web.archive.org/web/'; RATING_NAME = 'AllMovie'; SEARCH_STR = 'http://www.allmovie.com/search/movies/%s'; CODE_PAGE = 65001; //Use 0 for Autodetect //BlockOpen (* //28591=ISO 8859-1 Latin 1; Western European (ISO). Use: 65001=Unicode (UTF-8) | 0=for Autodetect *) //BlockClose //User Options GET_ACTORS = True; //Set to False to ensure ~ctActors~ not added even if 'Overwrite fields' setting allows GET_DURATION = True; //Set to False to ensure ~mfDuration~ not set even if 'Overwrite fields' setting allows //Note the program will overwrite this with the actual media duration in any case GET_POSTER = True; //Set to False if posters not wanted (or to handle bad image URL causing HTTP 404 error) GET_RATING = True; //Set to False to ensure ~mfRating~ not set even if 'Overwrite setting' fields setting allows GET_THEMES = True; //Set to False to ensure ~mfCategory~ not added even if 'Overwrite fields' setting allows GET_CONNECT = False; //Set to False if Connection (Related) movies not added (wanted) even if 'Overwrite fields' setting allows GET_FULL_CONNECT = False; //Set to False if Connection (Related) movies not added (wanted) even if 'Overwrite fields' setting allows GET_URLID = True; //Set to True or False if URLID added or not added in Allmovie DVD custom fields DEBUG = True; //Custom field names to use AWARDS_FIELD = 'All Awards tab'; RELEASES_FIELD = 'DVD Releases'; RELATED_FIELD = 'Related tab'; HTTPRELATED_FIELD = 'Related HTTP/503'; NORELATED_FIELD = 'No Related Movies'; //SCRIPT CONSTANTS============================================================================================= BlockClose //SCRIPT GLOBAL VARIABLES=======================================================================================BlockOpen //Global variables Var ELI,I:Integer; MovieName:String; StoredURL:String; Mode:Byte; ExtraLinks : array [smCast..smPoster] of String; TabMovieName,TabNumber:TwideArray; //SCRIPT GLOBAL VARIABLES=======================================================================================BlockClose //OBLIGATORY CALLBACK FUNCTIONS=================================================================================BlockOpen //Functions function GetScriptVersion:String; //BlockOpen Begin Result:=SCRIPT_VERSION; End; //BlockClose function GetScriptName:String; //BlockOpen Begin Result:=SCRIPT_NAME; End; //BlockClose function GetScriptDesc:String; //BlockOpen Begin Result:=SCRIPT_DESC; End; //BlockClose function GetRatingName:String; //BlockOpen Begin Result:=RATING_NAME; End; //BlockClose function GetScriptLang:Cardinal; //BlockOpen Begin Result:=SCRIPT_LANG; End; //BlockClose function GetCodePage:Cardinal; //BlockOpen Begin Result:=CODE_PAGE; End; //BlockClose //OBLIGATORY CALLBACK FUNCTIONS=================================================================================BlockClose //USER FUNCTIONS AND PROCEDURES=================================================================================BlockOpen function GetBaseURL:AnsiString; //BlockOpen Begin Result:=BASE_URL; End; //BlockClose function GetDownloadURL:AnsiString; //BlockOpen Begin LogMessage('Function GetDownloadURL BEGIN ====================== |'); LogMessage(' Global Var-Mode | '+IntToStr(Mode)+' |'); If (Mode=smSearch) Then Result:=SEARCH_STR Else Result:=ExtraLinks[Mode]; LogMessage('Global Var-Result | '+Result+' |'); LogMessage('Function GetDownloadURL END ====================== |'); End; //BlockClose function GetDownloadMethod:Byte; //BlockOpen Begin LogMessage(' Function GetDownloadMethod BEGIN ====================== |'); LogMessage(' Global Var-Mode 1 | '+IntToStr(Mode)+' |'); Result := dmGET; LogMessage(' Function GetDownloadMethod END ====================== |'); End; //BlockClose function GetPrefixMode:Byte; //BlockOpen Begin Result:=pmBegin; End; //BlockClose function GetScriptType:Byte; //BlockOpen Begin Result:=SCRIPT_TYPE; End; //BlockClose function GetCurrentMode:Byte; //BlockOpen Begin Result:=Mode; End; //BlockClose function RemoveTagsEx(AText:String):String; //BlockOpen Var B,E:Integer; Begin Result :=AText; B :=PosFrom('<',Result,1); E :=PosFrom('>',Result,B); While (B>0) AND (B',Result); End; End; //BlockClose function RemoveTagsEx1(AText:String):String; //BlockOpen Var B,E:Integer; Begin Result :=AText; B :=PosFrom('(',Result,1); E :=PosFrom(')',Result,B); While (B>0) AND (B',Result,1); E := PosFrom(',',Result,B); While (B>0) AND (B',Result); E := Pos(',',Result); End; End; //BlockClose function RemoveTagsEx3(AText:String):String; //BlockOpen Var B,E:Integer; Begin Result :=AText; B := PosFrom(' [Uncensored',Result,1); E := PosFrom(']',Result,B); While (B>0) AND (B0) AND (B '0' then AddCustomFieldValueByName('NUM ID:',GetFieldValueXML('num')); if GetFieldValueXML('num') <> '0' then LogMessage(' * Movie NUM ID: '+GetFieldValueXML('num')+' ||'); AddFieldValue(mfURL,MovieURL); StoredURL:=GetFieldValueXML('url'); LogMessage(' * Stored URL is: '+StoredURL); StoredURL:=LowerCase(StoredURL); StoredURL:=StringReplace(StoredURL,'https','http',True,True,False); StoredURL:=StringReplace(StoredURL,' ',BASE_URL_SUF,True,True,False)+BASE_URL_SUF; //Get AllMovie ID if exist. curPos:=Pos(BASE_URL_PRE,StoredURL); If 0 '' Then Begin ExplodeString(Date,DateParts,'-'); Date:=DateParts[2]+'.'+ DateParts[1]+'.'+DateParts[0]; Date:=StringReplace(Date,'01.','1.',True,True,False); Date:=StringReplace(Date,'02.','2.',True,True,False); Date:=StringReplace(Date,'03.','3.',True,True,False); Date:=StringReplace(Date,'04.','4.',True,True,False); Date:=StringReplace(Date,'05.','5.',True,True,False); Date:=StringReplace(Date,'06.','6.',True,True,False); Date:=StringReplace(Date,'07.','7.',True,True,False); Date:=StringReplace(Date,'08.','8.',True,True,False); Date:=StringReplace(Date,'09.','9.',True,True,False); AddCustomFieldValueByName('Update',Date); // Simple //AddCustomFieldValueByName('Updated',Date+' at '+TimeToStr(CurrentDateTime)); // Verbose AddCustomFieldValueByName('Updated0', Date + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + SCRIPT_NAME + ' ' + SCRIPT_VERSION); // Annoying AddCustomFieldValueByName('AUpdated',Date+' at '+TimeToStr(CurrentDateTime)+' '+#9679+' '+SCRIPT_NAME+' '+SCRIPT_VERSION); // Annoying End Else LogMessage('date not found'); LogMessage('* Get result Date: '+DateParts[2]+'.'+ DateParts[1]+'.'+DateParts[0]+' at '+TimeToStr(CurrentDateTime)+#8729+SCRIPT_NAME+#8729+SCRIPT_VERSION); //LogMessage(' Get result Date: '+DateToStr(CurrentDateTime)+' at '+TimeToStr(CurrentDateTime)+' • '+SCRIPT_NAME+' '+SCRIPT_VERSION); // ~AMG "movie_id" ID~ endPos:=curPos; endPos:=PosFrom('User Ratings ',HTML,curPos); curPos:=PosFrom('
',HTML,curPos); AMG_ID:=RemoveTags(Trim(Copy(HTML,curPos,endPos-curPos)),false); if AMG_ID <> '' then LogMessage(' Parse Results AMG ID1:'+AMG_ID); // ~mfTitle~ or ~Title~ curPos:=Pos('',HTML)+Length('<title>'); if Pos(') - ',HTML)>0 then endPos:=PosFrom(') - ',HTML,curPos)-6 else endPos:=PosFrom(' - | ',HTML,curPos); TmpStr:=Copy(HTML,curPos,endPos-curPos); LogMessage(' Parse Results Title1: '+TmpStr); // Get AllMovie.com tabs URL Wayback Machine Archive OR ~Wayback Machine Archive~ Titles:=MovieURL; debug_pos1:=Pos('-v1',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v2',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v3',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v4',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v5',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v6',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v7',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v8',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v9',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); Titles:=StringReplace(Titles,'http://www.allmovie.com/movie/','',True,False,True); LogMessage(' Titles:'+Titles); // Get Old AllMovie.com tabs URL Wayback Machine Archive OR ~Wayback Machine Archive 1~ AddCustomFieldValueByName('AMG Wayback Machine Archive3','<link url="http://web.archive.org/web/2009*/http://www.allmovie.com/dvd/releases/' +Titles+'-'+AMG_ID+'">AllMovieDVDReleases Wayback Machine Archive</link> <link url="http://web.archive.org/web/*/http://www.allmovie.com/dvd/releases/' +Titles+'-'+AMG_ID+'">All AllMovieDVDReleases Wayback Machine Archive</link>'); // Get Releases URL curPos := Pos('<li class="tab releases">', HTML); if curPos>0 then begin ExtraLinks[smDVDReleases]:=BASE_URL+TextBetween(HTML,'<a href="','" title="Releases">',True,curPos); if ExtraLinks[smDVDReleases] <> '' then LogMessage(' Parse Results AllMovie DVDReleases: '+ExtraLinks[smDVDReleases]); end; LogMessage(' * Parse Results for ParseMovie END ====================== |'); LogMessage(' ====================== ====================== '); End; //BlockClose procedure ParseDVDReleases(HTML:String); //BlockOpen Var curPos,endPos,debug_pos1:Integer; TmpStr,TmpStr0,TmpStr00,TmpStr01,TmpStr02:String; Name,Years,Years1,Studio,URLID:String; DateParts:TWideArray; index:Integer; TmpStr3,TmpStr4:String; Titles:String; MovieURL:String; Begin StoredURL:=GetFieldValueXML('url'); LogMessage(' * Stored URL is: '+StoredURL); StoredURL:=LowerCase(StoredURL); StoredURL:=StringReplace(StoredURL,'https','http',True,True,False); StoredURL:=StringReplace(StoredURL,' ',BASE_URL_SUF,True,True,False)+BASE_URL_SUF; //Get AllMovie ID if exist. curPos:=Pos(BASE_URL_PRE,StoredURL); If 0<curPos Then Begin LogMessage(' AllMovie URL.'); MovieURL:=TextBetWeen(StoredURL,BASE_URL_PRE,BASE_URL_SUF,false,curPos); LogMessage(' ** Parse stored MovieURL: '+MovieURL); End; // Get AllMovie.com tabs URL Wayback Machine Archive OR ~Wayback Machine Archive~ Titles:=MovieURL; debug_pos1:=Pos('-v1',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v2',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v3',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v4',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v5',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v6',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v7',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v8',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); debug_pos1:=Pos('-v9',Titles); if debug_pos1 >0 then Titles:=Copy(Titles,0,debug_pos1-1); Titles:=StringReplace(Titles,'http://www.allmovie.com/movie/','',True,False,True); LogMessage(' Titles:'+Titles); curPos:=Pos('<section class="releases">',HTML); if curPos < 1 then Exit; //TmpStr := ''; endPos:=curPos; curPos:=PosFrom('<td class="label">',HTML,curPos); index:=1; while (curPos > 0) AND (curPos < PosFrom('<div id="AllMovie_LB_Foot">',HTML,endPos)) do begin // Name //endPos:=curPos; //endPos:=PosFrom('<td class="label">',HTML,curPos); curPos:=PosFrom('<strong>',HTML,endPos)+8; endPos:=PosFrom('</strong>',HTML,curPos); Name:=Trim(Copy(HTML,curPos,endPos-curPos)); //LogMessage(' Parse Results Name: '+Name); if Pos('[4K Ultra HD Blu-ray/Blu-ray]',Name) > 0 then TmpStr01:=TmpStr01+'4K Ultra HD Blu-ray Blu-ray, '; if Pos('[Blu-ray/DVD/CD]',Name) > 0 then TmpStr02:=TmpStr02+'Blu-ray DVD CD, '; if Pos('[DVD/CD]',Name) > 0 then TmpStr02:=TmpStr02+'DVD CD, '; if Pos('HD DVD',Name) > 0 then TmpStr02:=TmpStr02+'HD DVD, '; Name:=StringReplace(Name,'[Repackaged]','[Repack]',True,False,True); //Name:=StringReplace(Name,'[Collectible Pack]','[Collect Pack]',True,False,True); Name:=StringReplace(Name,'[Collectible Packaging]','[Collect Pack]',True,False,True); Name:=StringReplace(Name,'New Collectible Pack','New Collect Pack',True,False,True); Name:=StringReplace(Name,'[Collectible Faceplate]','[Collect]', true, false, true); Name:=StringReplace(Name,'Centennial Collection]','Centen Col]',True,False,True); Name:=StringReplace(Name,'[Commemorative Packaging]','[Comme Pack]',True,False,True); Name:=StringReplace(Name,'[Commemorative Edition]','[Comme]',True,False,True); Name:=StringReplace(Name,'[Commemorative ','[Comme ',True,False,True); Name:=StringReplace(Name,'[Collector'#39+'s Edition]','[Collector'#39+'s]',True,False,True); Name:=StringReplace(Name,'Collector'#39+'s Edition]','Collector'#39+'s]',True,False,True); Name:=StringReplace(Name,'[Collectors'#39' Edition]', '[Collectors]',True,False,True); Name:=StringReplace(Name,'Collectors'#39' Edition]','Collectors]',True,False,True); Name:=StringReplace(Name,'[Extended Edition]','[Extended]',True,False,True); Name:=StringReplace(Name,'[Fun and Flirty Edition]','[Fun&Flirty]',True,False,True); //Name:=StringReplace(Name,'[Limited Edition Gift Set]','[Limited]',True,False,True); Name:=StringReplace(Name,'[Limited Edition]','[Limited]',True,False,True); Name:=StringReplace(Name,'[Limited Edition ','[Limited ',True,False,True); Name:=StringReplace(Name,'[Shake & Shimmy Edition]','[Shake & Shimmy]',True,False,True); Name:=StringReplace(Name,'[Special Edition With Flair]','[Speciale]',True,False,True); Name:=StringReplace(Name,'[Special Edition]','[Special]',True,False,True); Name:=StringReplace(Name,'[Special Edition ','[Special ',True,False,True); Name:=StringReplace(Name,'(Special Edition ','(Special ',True,False,True); Name:=StringReplace(Name,'Special Edition]','Special]',True,False,True); Name:=StringReplace(Name,'[Definitive Edition]','[Definitive]',True,False,True); Name:=StringReplace(Name,'[Ultimate Edition]','[Ultimate]',True,False,True); Name:=StringReplace(Name,'[Ultimte Edition]','[Ultimate]',True,False,True); Name:=StringReplace(Name,'[Ulitmte Edition]','[Ultimate]',True,False,True); Name:=StringReplace(Name,'[Deluxe of Edition]','[Deluxe]',True,False,True); Name:=StringReplace(Name,'[Deluxe Edition]','[Deluxe]',True,False,True); Name:=StringReplace(Name,'[Sweet Revenge Edition]','[Sweet Revenge]',True,False,True); Name:=StringReplace(Name,'[Spanish Version]','[Spanish]',True,False,True); Name:=StringReplace(Name,'[Uncut Version]','[Uncut]',True,False,True); Name:=StringReplace(Name,'[International Download Edition]','[International Dl]',True,False,True); Name:=StringReplace(Name,' Extended Unrated Version]',' Extended Unrated]',True,False,True); Name:=StringReplace(Name,'[Deluxe Extended Edition]','[Deluxe Extended]',True,False,True); //Name:=StringReplace(Name,'[Theatrical Versions]','[Theatrical]',True,False,True); Name:=StringReplace(Name,'[Anniversary Edition]','[Anniversary]',True,False,True); //Name:=StringReplace(Name,' Anniversary Edition',' Anniversary',True,False,True); Name:=StringReplace(Name,' Anniversary Edition]',' Anniversary]',True,False,True); Name:=StringReplace(Name,' Anniversary Special Edition]',' Anniversary Special]',True,False,True); Name:=StringReplace(Name,' Anniversary Special Edition Box',' Anniversary Special Box',True,False,True); Name:=StringReplace(Name,'[Family Friendly Version]','[Family Friendly]',True,False,True); Name:=StringReplace(Name,'[Extended Party Edition]','[Extended Party]',True,False,True); Name:=StringReplace(Name,'[Double Secret Probation Edition]','[Double Secret]',True,False,True); Name:=StringReplace(Name,'[Accessories Starter Pack Edition]','[Access Pack]',True,False,True); Name:=StringReplace(Name,'[Limited Edition Gift Set]','[Limited Gift Set]',True,False,True); Name:=StringReplace(Name,'[Deluxe Extended Edition Gift Set]','[Deluxe Extended Gift Set]',True,False,True); Name:=StringReplace(Name,' Sticker on Box','',True,False,True); Name:=StringReplace(Name,' [Wth IRC]','',True,False,True); Name:=StringReplace(Name,' [Gift Case]','',True,False,True); Name:=StringReplace(Name,' [With Book]','',True,False,True); Name:=StringReplace(Name,' [DigiBook]','',True,False,True); Name:=StringReplace(Name,' [Steelbook]','',True,False,True); Name:=StringReplace(Name,' [SteelBook]','',True,False,True); Name:=StringReplace(Name,' [Steel Book]','',True,False,True); Name:=StringReplace(Name,' [Checkpoint]','',True,False,True); Name:=StringReplace(Name,' [Sensormatic]','',True,False,True); Name:=StringReplace(Name,' [UltraViolet]','',True,False,True); Name:=StringReplace(Name,' [Ultraviolet]','',True,False,True); Name:=StringReplace(Name,' [UItraViolet]','',True,False,True); Name:=StringReplace(Name,' [Movie Money]','',True,False,True); Name:=StringReplace(Name,' [Only @ Best Buy]','',True,False,True); Name:=StringReplace(Name,' [Foil Slipsleeve]','',True,False,True); Name:=StringReplace(Name,' [Criterion Collection]','',True,False,True); Name:=StringReplace(Name,' [Fast 6 Movie Cash]','',True,False,True); Name:=StringReplace(Name,' [Best Buy Exclusive]','',True,False,True); Name:=StringReplace(Name,' [Circuit City Exclusive]','',True,False,True); Name:=StringReplace(Name,' [Includes Digital Copy]','',True,False,True); Name:=StringReplace(Name,' [Fandango Movie Cash]','',True,False,True); Name:=StringReplace(Name,' [Safe Deposit Gift Box]','',True,False,True); Name:=StringReplace(Name,' [The Wolfman $10 Movie Cash]','',True,False,True); Name:=StringReplace(Name,' [I Love the 80'#39+'s Edition]','',True,False,True); Name:=StringReplace(Name,' [300: Rise of an Empire Movie Cash]','',True,False,True); Name:=StringReplace(Name,' Edition With Golf Book]','',True,False,True); Name:=StringReplace(Name,' [Movie Cash for Due Date]','',True,False,True); Name:=StringReplace(Name,' [Million Characters Faceplace]','',True,False,True); Name:=StringReplace(Name,' [Loaded With Extra Crap Edition]','',True,False,True); Name:=StringReplace(Name,' [Digi Book Packaging]','',True,False,True); Name:=StringReplace(Name,' [Limited Gift Set]','',True,False,True); Name:=StringReplace(Name,' Editions]',']',True,False,True); Name:=StringReplace(Name,' Edition]',']',True,False,True); Name:=StringReplace(Name,' Versions]',']',True,False,True); Name:=StringReplace(Name,'[Version ','[',True,False,True); Name:=StringReplace(Name,' / With Movie Cash]',']',True,False,True); Name:=StringReplace(Name,' / Gift Set','',True,False,True); Name:=StringReplace(Name,' / Gift Set]',']',True,False,True); Name:=RemoveTagsEx3(Name); Name:=RemoveTagsEx4(Name); Name:=StringReplace(Name,'Packaging]','Pack]',True,False,True); Name:=StringReplace(Name,'Blu-ray','BR',True,False,True); Name:=StringReplace(Name,'Collection','Col',True,False,True); Name:=StringReplace(Name,'] [','/',True,False,True); // Studio //endPos:=curPos; endPos:=PosFrom('<div>',HTML,curPos); curPos:=PosFrom('<div>',HTML,endPos)+5; endPos:=PosFrom('</div>',HTML,curPos); Studio:=Trim(Copy(HTML,curPos,endPos-curPos)); //LogMessage(' Parse Results Studio: '+Studio); Studio:=StringReplace(Studio,'Digital Distribution','DigiDist.',True,False,True); Studio:=StringReplace(Studio,'Digital Dist','DigiDist.',True,False,True); Studio:=StringReplace(Studio,'Home Entertainment','HomeEnt.',True,False,True); Studio:=StringReplace(Studio,'Home Entertainmt','HomeEnt.',True,False,True); Studio:=StringReplace(Studio,'Home Ent.','HomeEnt.',True,False,True); Studio:=StringReplace(Studio,'Home Video','HomeVideo',True,False,True); Studio:=StringReplace(Studio,'Entertainment','Ent.',True,False,True); //Studio:=StringReplace(Studio,'(Canadian)','(Ca)',True,False,True); Studio:=StringReplace(Studio,'(Canadian)','(Canada)',True,False,True); Studio:=StringReplace(Studio,'Turner Classic Movies','T C M',True,False,True); Studio:=StringReplace(Studio,'The Criterion Collection, Inc','Criterion Collection',True,False,True); Studio:=StringReplace(Studio,' ',' ',True,False,True); Studio:=StringReplace(Studio,', a Navarre Corporation Company','',True,False,True); Studio:=StringReplace(Studio,', Llc','',True,False,True); Studio:=StringReplace(Studio,'HEnt. (Canada)','HEnt. (Ca)',True,False,True); // Years //endPos:=curPos; curPos:=PosFrom('<td class="year"',HTML,endPos); if curPos>0 then begin EndPos:=curPos; //Years:=TextBetween(HTML,', ','</td>',True,curPos); Years:=TextBetween(HTML,'<td class="year"','</td>',True,curPos); //LogMessage(' Parse Results Years: '+Years); if Pos('4K Ultra HD Blu-ray',Years) > 0 then TmpStr00:=TmpStr00+'4K Ultra HD Blu-ray, '; if Pos('Blu-ray, DVD',Years) > 0 then TmpStr00:=TmpStr00+'Blu-ray DVD, '; if Pos('Blu-ray, Blu-ray 3D, DVD',Years) > 0 then TmpStr00:=TmpStr00+'Blu-ray Blu-ray 3D DVD, '; if Pos('Blu-ray, Blu-ray 3D',Years) > 0 then TmpStr00:=TmpStr00+'Blu-ray Blu-ray 3D, '; if Pos('DVD, DVD',Years) > 0 then TmpStr00:=TmpStr00+'DVD DVD, '; if Pos('Hi Def',Years) > 0 then TmpStr0:=TmpStr0+'HD, '; if Pos('DVD',Years) > 0 then TmpStr0:=TmpStr0+'DVD, '; if Pos('VHS',Years) > 0 then TmpStr0:=TmpStr0+'VHS, '; if Pos('UMD',Years) > 0 then TmpStr0:=TmpStr0+'UMD, '; if Pos('Blu-ray',Years) > 0 then TmpStr0:=TmpStr0+'Blu-ray, '; Years:=RemoveTagsEx2(Years); //Years:=StringReplace(Years,' ',' (',True,False,True); Years:=StringReplace(Years,' ',' ',True,False,True); Years:=StringReplace(Years,'>','',True,False,True); Years:=StringReplace(Years,', ','/',True,False,True); Years:=StringReplace(Years,'Hi Def','HD',True,False,True); Years:=StringReplace(Years,'Blu-ray','BR',True,False,True); Years:=StringReplace(Years,'Ultra HD','UHD',True,False,True); end; // Years1 //endPos:=curPos; curPos:=PosFrom('<td class="year"',HTML,endPos); if curPos>0 then begin EndPos:=curPos; Years1:=TextBetween(HTML,'<td class="year"','</td>',True,curPos); //LogMessage(' Parse Results Years1: '+Years1); Years1:=StringReplace(Years1,'>','',True,False,True); Years1:=StringReplace(Years1,',','',True,False,True); Years1:=StringReplace(Years1,' ','',True,False,True); //LogMessage(' ====================== ====================== '); //LogMessage(#160#9679#160+' Parse Results Years1a: '+StringReplace(Years1,' ',#13+'======================'+#13#160,True,False,True)+#13+'======================'); //LogMessage(' ====================== ====================== '); debug_pos1:=Pos(' ',Years1); if debug_pos1 >0 then Years1:=Copy(Years1,0,debug_pos1-1); if Years1 <> '' then begin ExplodeString(Years1,DateParts,' '); Years1:=DateParts[1]+' '+DateParts[0]+' '+DateParts[2]; end; end; // URLID //endPos:=curPos; endPos:=PosFrom('<div class="expand" data-id="',HTML,curPos); curPos:=PosFrom('<div class="expand" data-id="',HTML,endPos)+29; endPos:=PosFrom('"></div>',HTML,curPos); URLID:=Trim(Copy(HTML,curPos,endPos -curPos)); //LogMessage(' Parse Results URLID: '+URLID); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E ','e',True,False,True); URLID:=StringReplace(URLID,'E','e',True,False,True); if TmpStr <> '' then TmpStr:=TmpStr+#13; if Name <> '' then //TmpStr:=TmpStr+'<link url="https://www.allmovie.com/movie/release/' +URLID+'">'+Name+'</link>'; TmpStr:=TmpStr+Name; if Studio <> '' then TmpStr:=TmpStr+#160#9642#160+Studio; if Years <> '' then TmpStr:=TmpStr+#160#9642+Years; if Years1 <> '' then TmpStr:=TmpStr+#160#9642#160+Years1; if URLID <> '' then TmpStr:=TmpStr+#160#160#160#160+'('+URLID+')'; //(* if TmpStr3 <> '' then TmpStr3:=TmpStr3+#13; //if Name <> '' then TmpStr3:=TmpStr3+Name; if Name <> '' then TmpStr3:=TmpStr3+'<link url="http://web.archive.org/web/2009*/http://www.allmovie.com/dvd/'+Titles+'-'+StringReplace(URLID,'e','',True,False,True)+'">'+Name+'</link>'; ///if Name <> '' then TmpStr3:=TmpStr3+#160#9679+#160+Name; //if Studio <> '' then TmpStr3:=TmpStr3+#160#9642#160+Studio; if Years <> '' then TmpStr3:=TmpStr3+#160#160#9642+Years; if Years1 <> '' then TmpStr3:=TmpStr3+#160#9642#160#160+Years1; if GET_URLID then if URLID <> '' then TmpStr3:=TmpStr3+#160#9642#160#160+'('+StringReplace(URLID,'e','',True,False,True)+')'; //If Pos('2011',Years1) OR Pos('2010',Years1) OR Pos('2009',Years1) OR Pos('2008',Years1) OR Pos('2007',Years1) OR Pos('2006',Years1) OR Pos('2005',Years1) OR Pos('2004',Years1) OR Pos('2003',Years1) OR Pos('2002',Years1) OR Pos('2001',Years1) OR Pos('2000',Years1) OR Pos('1999',Years1) OR Pos('1998',Years1) OR Pos('1997',Years1) OR Pos('1996',Years1) OR Pos('1995',Years1) OR Pos('1994',Years1) OR Pos('1993',Years1) OR Pos('1992',Years1) OR Pos('1991',Years1) OR Pos('1990',Years1) > 1 then TmpStr3:=TmpStr3 else TmpStr3:=''; //*) //(* if TmpStr4 <> '' then TmpStr4:=TmpStr4+#13; if Name <> '' then TmpStr4:=TmpStr4+'<link url="http://web.archive.org/web/2009*/http://www.allmovie.com/dvd/'+Titles+'-'+StringReplace(URLID,'e','',True,False,True)+'">'+Name+'</link>'; if Years <> '' then TmpStr4:=TmpStr4+#160#160#9642+Years; if Years1 <> '' then TmpStr4:=TmpStr4+#160#9642#160+Years1; if GET_URLID then if URLID <> '' then TmpStr4:=TmpStr4+#160#160#9642#160#160+'('+StringReplace(URLID,'e','',True,False,True)+')'; If Pos('2011',Years1) OR Pos('2010',Years1) OR Pos('2009',Years1) OR Pos('2008',Years1) OR Pos('2007',Years1) OR Pos('2006',Years1) OR Pos('2005',Years1) OR Pos('2004',Years1) OR Pos('2003',Years1) OR Pos('2002',Years1) OR Pos('2001',Years1) OR Pos('2000',Years1) OR Pos('1999',Years1) OR Pos('1998',Years1) OR Pos('1997',Years1) OR Pos('1996',Years1) OR Pos('1995',Years1) OR Pos('1994',Years1) OR Pos('1993',Years1) OR Pos('1992',Years1) OR Pos('1991',Years1) OR Pos('1990',Years1) > 1 then TmpStr4:=TmpStr4 else TmpStr4:=''; //*) index:=index+1; if curPos > 0 then curPos := PosFrom('<td class="label">', HTML, curPos) else Exit; end; AddCustomFieldValueByName('Allmovie DVD1',TmpStr); AddCustomFieldValueByName('Category.DVD',TmpStr0); AddCustomFieldValueByName('Category - DVD',TmpStr00); AddCustomFieldValueByName('Category-DVD1',TmpStr01); AddCustomFieldValueByName('Category-DVD2',TmpStr02); AddCustomFieldValueByName('Allmovie DVDweb',TmpStr4); AddCustomFieldValueByName('Allmovie DVDweb1',TmpStr3); End; //BlockClose procedure ParseSearchResults(HTML:String); //BlockOpen Var curPos,endPos,index:Integer; Title,Year,URL,director:String; Begin //List of other site number where search page : TabNumber:=['']; //curPos:=Pos('<option value="movies" selected>',HTML); //curPos:=Pos('div class="results-section movies">',HTML); curPos:=Pos('<li class="movie">',HTML); if curPos < 1 then Exit; LogMessage('Parsing search results...'); LogMessage('Global Var-Mode 0 | '+IntToStr(Mode)+' |'); LogMessage(' Parsing search results... BEGIN ===================== ||'); LogMessage(' Parsing search results...'); LogMessage(' Search Result START * *'); curPos:=PosFrom('<a href="https://www.allmovie.com/movie/',HTML,curPos); index:=1; While curPos>0 Do Begin endPos:=PosFrom('">',HTML,curPos); LogMessage(' ** Parse results complex StartURL:'+IntToStr(curPos)+'...'+IntToStr(endPos)); URL:=Copy(HTML,curPos+9,endPos-curPos-9)+'/'; URL:=StringReplace(URL,'https://','http://',True,True,False); LogMessage(' Parse Results URL: '+URL); // Title curPos:=PosFrom('">',HTML,curPos)+2; endPos:=PosFrom('</a>',HTML,curPos); Title:=Copy(HTML,curPos,endPos-curPos); LogMessage(' Parse Results Title: '+Title); // Year curPos:=PosFrom('</a>',HTML,curPos)+4; endPos:=PosFrom('</div>',HTML,curPos); Year :=RemoveTags(Trim(Copy(HTML,curPos,endPos-curPos)),false); LogMessage(' Parse Results in Year: '+Year); // director endPos:=Pos('Directed by: ',HTML); if endPos>0 then curPos:=PosFrom('">',HTML,curPos)+2; endPos:=PosFrom('</a> </div>',HTML,curPos); director:=RemoveTags(Trim(Copy(HTML,curPos,endPos-curPos)),false); //director:=StringReplace(director,'Directed by: ','',True,False,True); ///LogMessage(' Parse Results in director: '+director); AddSearchResult(Title+' '+Year,'','',URL,''); LogMessage(' * Get results AddSearchResult:#'+IntToStr(index)+'| '+Title+' '+Year+' | '+URL+' ||'); curPos:=PosFrom('<a href="https://www.allmovie.com/movie/',HTML,curPos); index:=index+1; End; //LogMessage('Get result ====== - - ====== '); AddSearchResult('- - ', '', '', '',''); //AddSearchResult(' ====== ','','','',''); //Get Name of movie to search : MovieName:=GetFieldValue(2); Explodestring(MovieName,TabMovieName,#32); MovieName:=''; For I:=low(TabMovieName) to High(TabMovieName) do Begin MovieName:=MovieName+#43+TabMovieName[I]; MovieName:=StringReplace(MovieName,'/','-',True,False,True); End; //Add Links to Page with other sites in TabNumber: For I := Low(TabNumber) to High(TabNumber) do Begin URL:='http://www.allmovie.com/search/movies/'+MovieName; //AddSearchResult('Search in '+MovieName+' on AllMovie.com','Movie results','',URL,''); AddSearchResult(' * Search in '+MovieName+' on AllMovie.com','','',URL,''); End; LogMessage(' Search Result END * *'); LogMessage(' Parsing search results... END ===================== ||'); End; //BlockClose function NextMode(curMode:Integer):Integer; //BlockOpen Var I:Integer; Begin Result:=smFinished; if curMode < Low(ExtraLinks) - 1 then curMode:=Low(ExtraLinks) - 1; for I:=curMode + 1 to High(ExtraLinks) do if ExtraLinks[I] <> '' then begin Result:=I; Break; End; End; //BlockClose //USER FUNCTIONS AND PROCEDURES==================================================================================BlockClose //OBLIGATORY CALLBACK PRINCIPAL FUNCTION=========================================================================BlockOpen function ParsePage(HTML:String;URL:AnsiString):Cardinal; //BlockOpen Begin LogMessage('Function ParsePage BEGIN ====================== |'); LogMessage('Function ParsePage ...'); LogMessage('Global Var-Mode | '+IntToStr(Mode)+' |'); HTML:=HTMLToText(HTML); HTML:=StringReplace (HTML,'http://allmovie.com', 'http://www.allmovie.com', True,True,False); if Pos('<title>Movie search results for '+#34,HTML)>0 then begin ParseSearchResults(HTML); LogMessage(' Parse Results for Search Results'); Result := prList; LogMessage(' -------- ParsePage complete Result ( '+IntToStr(Result)+' )'); LogMessage('Function ParsePage smSearch-prList END ====================== | '); LogMessage('Function ParsePage smSearchList END ====================== |'); Exit; end else if (Mode = 0) AND (Pos('User Reviews', HTML) > 0) then begin ParseMovie(URL, HTML); end else if Pos(' | Synopsis, Characteristics, Moods, Themes and Related | AllMovie', HTML) > 0 then ParseMovie(URL, HTML) else if Pos('| Releases | AllMovie', HTML) > 0 then ParseDVDReleases(HTML); LogMessage(' Parse Results for ParseMovie:|'+URL+' |'); LogMessage('Function ParsePage NORMAL END ====================== |'); LogMessage(' ** Provider data info retreived Ok in '+DateToStr(CurrentDateTime)+' '+TimeToStr(CurrentDateTime)+' (~Updated~)'); Mode:=NextMode(Mode); if Mode <> smFinished then Result:=prDownload Else Result:=prFinished; LogMessage(' * Function ParsePage NORMAL END ====================== |'); LogMessage(' -------- ParsePage completed with Result ('+IntToStr(Result)+')'); LogMessage(' Function ParsePage END ====================== |'); End; begin Mode:=smSearch; for ELI := Low(ExtraLinks) to High(ExtraLinks) do ExtraLinks[ELI] := ''; End. //BlockClose //OBLIGATORY CALLBACK PRINCIPAL FUNCTION=========================================================================BlockClose { History of changes to the script for downloading movies info from AllMovie.com CHANGE LOG: //v 1.1.4.0 Ivek23: small corrections and added new pieces of code in the code for ParseMovie procedure per forum post: // http://www.videodb.info/forum_en/index.php/topic,4109.msg21362.html#msg21362 --------------------------------------------- SCRIPT: AllMovie.com_new HTTPS(DVDReleases) SOURCE: AllMovie.com_new CO-AUTHORS: Ivek23 VERSION: 1.1.4.0 DATE: 03/03/2021 UPDATE: 25/05/2021 NEW_VERSION: 1.1.4.0 UPDATE: 14/12/2021 --------------------------------------------- //SCRIPT_VERSION_OLD = '0.1.1.3.3'; SCRIPT_VERSION = '1.1.4.0'; SCRIPT_NAME = 'AllMovie.com_new_HTTPS(DVDReleases)'; SCRIPT_DESC = '[EN] Get Movie Information from AllMovie.com_new HTTPS Releases page'; SCRIPT_LANG = $09; //English SCRIPT_TYPE = stMovies; BASE_URL = 'http://www.allmovie.com'; BASE_URL_SUF = '/'; BASE_URL_PRE = 'http://www.allmovie.com/movie/'; BASE_URL_PRE_TRUE = 'https://www.allmovie.com/movie/'; BASE_URL_PROX = 'http://allmovie.com:80'; BASE_URL_PROXY = 'http://www.allmovie.com:80'; WEB_URL = 'http://web.archive.org'; WEB_URL_PRE = 'http://web.archive.org/web/'; RATING_NAME = 'AllMovie'; SEARCH_STR = 'http://www.allmovie.com/search/movies/%s'; CODE_PAGE = 65001; //Use 0 for Autodetect --------------------------------------------- TYPES AND FUNCTIONS Additional types and functions that can be used in scripts: Types TWIDEARRAY : array of String Field functions procedure AddSearchResult(Title1, Title2, Year, URL, PreviewURL : String) procedure AddFieldValue(AField: Integer; AValue : String) procedure AddMoviePerson(Name, TransName, Role, URL : String; AType : Byte) procedure AddPersonMovie(Title, OrigTitle, Role, Year, URL : String; AType : Byte) procedure AddAward(Event, Award, Category, Recipient, Year: String; const Won : Boolean) procedure AddAwardEx(Event, Award, Category, RecipientVal1, RecipientVal2, Year : String; const Won : Boolean); procedure AddConnection(Title, OrigTitle, Category, URL, Year: String) procedure AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode : String) String functions function Pos(Substr : String; Str: String): Integer function PosFrom(const SubStr, Str : String; FromIndex : Integer) : Integer function LastPos(const SubStr, Str : String) : Integer function PrevPos(const SubStr, Str : String; APos : Integer) : Integer function RemoveTags(AText : String; doLineBreaks : Boolean) : String function ExplodeString(AText : String; var Items : TWideArray; Delimiters : String) : Integer function Copy(S: String; Index, Count: Integer): String procedure Delete(var S: String; Index, Count: Integer) procedure Insert(Source: String; var Dest: String; Index: Integer) function Length(S: String): Integer function Trim(S: String): String function CompareText(S1, S2: String): Integer function CompareStr(S1, S2: String): Integer function UpperCase(S: String): String function LowerCase(S: String): String function AnsiString(S, OldPattern, NewPattern: String; All : Boolean; IgnoreCase : Boolean; WholeWord: Boolean): String function StrToInt(const S: String): Integer function IntToStr(const Value: Integer): String function StrToFloat(const S: String): Extended function FloatToStr(const Value: Extended): String function CurrentDateTime : Extended function DateToStr(Value : Extended) : String function TimeToStr(Value : Extended) : String function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String function HTMLValues2(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String function TextBetween(const HTML : String; ABegin, AEnd : String; doLineBreaks : Boolean; var Pos : Integer) : String function HTMLToText(const HTML : String) : String procedure ShowMessage(const Msg, Head : String) }