21
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 28, 2025, 06:26:56 am »Notice:
These two Function ConfDate1 and Function ConfDate2 below are not used in the script because if there is no complete date (day, month, year) or if the day or month is missing, PVD will freeze.
These two Function ConfDate1 and Function ConfDate2 below are not used in the script because if there is no complete date (day, month, year) or if the day or month is missing, PVD will freeze.
Quote
Function ConfDate1(OrigDate:String): String; //BlockOpen
Var
i, rNum:Integer;
d, m, y: String;
TabMonths, TabFullMonths:Array of string;
TabDate:TwideArray;
begin
TabMonths := ['Null', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
TabFullMonths := ['Null', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
rNum := ExplodeString(OrigDate, TabDate, '/');
// LogMessage('* Function ConfDate1 => rNum: ' + IntToStr(rNum));
if (rNum <= 1) then begin
rNum := ExplodeString(OrigDate, TabDate, ' ');
// LogMessage('* Function ConfDate1 => rNum: ' + IntToStr(rNum));
end;
if (rNum > 0) then begin
// LogMessage('** Function ConfDate1 => TabDate 0: ' + TabDate[0]);
// LogMessage('** Function ConfDate1 => TabDate 1: ' + TabDate[1]);
// LogMessage('** Function ConfDate1 => TabDate 2: ' + TabDate[2]);
if (Length(TabDate[0]) > 0) then begin
if (Length(TabDate[0]) > 2) then begin
m := TabDate[0];
for i := 1 to 12 do begin
if ((m = TabMonths) or (m = TabFullMonths)) then begin
m := IntToStr(i);
break;
end;
end;
LogMessage('* Function ConfDate1 => Months: ' + m);
// d := Copy(TabDate[1], 1, Length(TabDate[1])-1);
d := TabDate[1];
If Copy(TabDate[1], 1, 1) = '0' then
d:= Copy(TabDate[1], 2, 1);
y := TabDate[2];
end else if (Length(TabDate[1]) > 0) then begin
y:= TabDate[2];
m:= TabDate[1];
For i := 1 to 12 do begin
If ((m = TabMonths) or (m = TabFullMonths)) then begin
m := IntToStr(i);
break;
end;
end;
d:= TabDate[0];
If Copy(TabDate[0], 1, 1) = '0' then
d:= Copy(TabDate[0], 2, 1);
LogMessage('* Function ConfDate1 => Year: ' + y + ' month: ' + m + ' day: ' + d);
end else begin
y := '';
m := '';
d := '';
end;
end else begin
ExplodeString(OrigDate, TabDate, '/');
y := Copy(OrigDate, 7, 4);
m := Copy(OrigDate, 3, 3);
For i := 1 to 12 do begin
If m = Copy(TabMonths, 1, 3) then begin
m := IntToStr(i);
break;
end;
end;
d := Copy(OrigDate, 1, 2);
If Copy(TabDate[0], 1, Length(TabDate[0])-1) = '0' then d:= Copy(TabDate[0], 2, Length(TabDate[0])-1);
LogMessage('* Function ConfDate1 - Year: ' + y + ' month: ' + m + ' day: ' + d);
end;
Result := d + '.' + m + '.' + y;
end;
End; //BlockClose
Function ConfDate2(OrigDate:String): String; //BlockOpen
Var
i, rNum:Integer;
d, m, y: String;
TabMonths, TabFullMonths:Array of string;
TabDate:TwideArray;
begin
TabMonths := ['Null', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
TabFullMonths := ['Null', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
rNum := ExplodeString(OrigDate, TabDate, '/');
// LogMessage('* Function ConfDate2 => rNum: ' + IntToStr(rNum));
if (rNum <= 1) then begin
rNum := ExplodeString(OrigDate, TabDate, ' ');
// LogMessage('* Function ConfDate2 => rNum: ' + IntToStr(rNum));
end;
if (rNum > 0) then begin
// LogMessage('** Function ConfDate2 => TabDate 0: ' + TabDate[0]);
// LogMessage('** Function ConfDate2 => TabDate 1: ' + TabDate[1]);
// LogMessage('** Function ConfDate2 => TabDate 2: ' + TabDate[2]);
if (Length(TabDate[0]) > 0) then begin
if (Length(TabDate[0]) > 2) then begin
m := TabDate[0];
for i := 1 to 12 do begin
if ((m = TabMonths) or (m = TabFullMonths)) then begin
m := IntToStr(i);
break;
end;
end;
if Length(m) = 1 then m := '0' + m; // Ensure month has two digits
LogMessage('* Function ConfDate2 => Months: ' + m);
d := TabDate[1];
If Copy(TabDate[1], 1, 1) = '0' then
d := Copy(TabDate[1], 2, 1);
if Length(d) = 1 then d := '0' + d; // Ensure day has two digits
y := TabDate[2];
end else if (Length(TabDate[1]) > 0) then begin
y := TabDate[2];
m := TabDate[1];
For i := 1 to 12 do begin
If ((m = TabMonths) or (m = TabFullMonths)) then begin
m := IntToStr(i);
break;
end;
end;
if Length(m) = 1 then m := '0' + m; // Ensure month has two digits
d := TabDate[0];
If Copy(TabDate[0], 1, 1) = '0' then
d := Copy(TabDate[0], 2, 1);
if Length(d) = 1 then d := '0' + d; // Ensure day has two digits
LogMessage('* Function ConfDate2 => Year: ' + y + ' month: ' + m + ' day: ' + d);
end else begin
y := '';
m := '';
d := '';
end;
end else begin
ExplodeString(OrigDate, TabDate, '/');
y := Copy(OrigDate, 7, 4);
m := Copy(OrigDate, 3, 3);
For i := 1 to 12 do begin
If m = Copy(TabMonths, 1, 3) then begin
m := IntToStr(i);
break;
end;
end;
if Length(m) = 1 then m := '0' + m; // Ensure month has two digits
d := Copy(OrigDate, 1, 2);
If Copy(TabDate[0], 1, Length(TabDate[0])-1) = '0' then
d := Copy(TabDate[0], 2, Length(TabDate[0])-1);
if Length(d) = 1 then d := '0' + d; // Ensure day has two digits
LogMessage('Function ConfDate2 - Year: ' + y + ' month: ' + m + ' day: ' + d);
end;
// Format the date as yyyy-mm-dd
Result := y + '-' + m + '-' + d;
end;
End; //BlockClose