Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - afrocuban

Pages: 1 ... 3 4 5 6 7 [8] 9 10 11 12 13 ... 32
141
Talk / Re: AI and PVD
« on: November 23, 2024, 10:42:11 pm »
Second one

142
Talk / Re: AI and PVD
« on: November 23, 2024, 10:40:14 pm »
First peak of a new skin. None is finished but all of them have all the custom fields included.

143
Talk / Re: AI and PVD
« on: November 23, 2024, 10:39:16 pm »

You mentioned somewhere on the forum that you could change and fix scripts with the help of AI.

Is it possible to get some AI tool to help edit PVD scripts?

What do you use and could you share it with other PVD users?

I would also start using AI to help edit PVD scripts if I got the right information on how to use it.



Great to hear you are interested in!!!!!! PVD IS SAVED THEN!

I admit: I was always hesitating to ask you each time for a favor when something goes wrong, especially knowing that I am one of maybe ten users of PVD that still use it. So I decided to learn, not coding, but to recognize it and the most important, how to interact with AI. I'm still struggling with interacting, because it still struggles with itself, so today, I think I better know Pascal, then how to talk to AI, hahaha. I learned a lot in just a month or so.


At the moment, and I emphasize that I don't want to pay for this,  the best free coding AI out there (or better to say the least bad) is MS Copilot. It's free to use, but it has a lot of downsides. The biggest one, for me at least, is that the message has ~10k characters limit, so if you want to upload whole PVD script, you need 30 messages of copy pasting, and copilot will forget it after several messages. Frustrating! So at the moment, for me it's impossible to create or fix something because I don't know relations within the script and about PVD itself, so that's I asked you if you have some resources, or to share info so we could spread help. My goal is to reintegrate all the fields we once had in a single imdb script, to bring back AllMovie and Rottentomatoes scripts too, because simply there is no reason not to do it today.

The other one I tried is duckduckgo chat. It ofers 4 models:


Quote
All models are anonymously provided by DuckDuckGo
GPT-4o mini

General purpose AI with high built-in moderation

Created by OpenAI

Claude 3 Haiku

General purpose AI with high built-in moderation

Created by Anthropic

Llama 3.1 70B

Open Source
General purpose AI with medium built-in moderation

Created by Meta

Mixtral 8x7B

Open Source
General purpose AI with low built-in moderation

Created by Mistral AI

Please note: starting a new chat with any model will delete your current chat session

I tried briefly Mixtral 8x7B, and it receives ~16k characters, which is pretty good comparing to Copilot, but the total number messages per day is limited. The biggest downside for me is that it doesn't use our data to train themselves, which is brilliant for privacy, but not for outputs, hahaha. So, for someone who's not programmer, it still is extremely hard to achieve any goal.




But, as I said, the most important thing is how to instruct AI, meaning how to "talk" to it. What I learned all along the way, very hard way because I had to learn basics of Pascal and million things in parallel, is to first talk to it, to explain what you want, to ask it for examples, until you are fine with it and then to ask it for a workflow plan. That plan you save somewhere out of chat for a goal you want to achieve, so you can later just paste it. Here's the example what I got as a workflow from AI, after a talked a lot to it and once I was to check if multiple posters import is possible to PVD:


Code: [Select]

Yes, knowing that PVD cannot handle HTTPS and relies on the AHK script for downloading pages, we need to take extra caution when creating part2 of wscr3. Here are some key considerations:


1. Ensure Secure Handling of HTTPS:
Consistent Use of AHK: Ensure that all HTTPS requests are handled through the AHK script to maintain consistency and avoid errors.


Error Handling: Implement robust error handling to manage any potential issues with HTTPS downloads.


2. Avoid Direct HTTPS Calls in Part2:
No Direct HTTP Requests: Ensure that part2 does not attempt any direct HTTP requests, which PVD cannot process.


3. Manage Variable Dependencies:
Separate Variables: Use distinct variables for URLs and file paths in part2 to avoid conflicts with part1.


Consistent Paths: Ensure all paths are correctly set and accessible to both the AHK script and the main processing script.


4. Logging and Debugging:
Detailed Logs: Maintain detailed logs to trace each step and catch any issues early.


Sequential Logging: Ensure that the logs differentiate between the actions of part1 and part2 clearly.


5. Complete Initial Processing Before Starting Part2:
Clear Markers: Use clear markers to indicate the end of part1 and the beginning of part2.


Confirmation of Completion: Ensure part1 completes all tasks before initiating part2.


Example Pseudo-code for Part2:
pascal
// Ensure part1 completion
LogMessage('Function ParsePage smNormal END======================|');
Exit;  // End of initial processing


// Part 2: Start new process for multiple posters
LogMessage('Starting process to download multiple posters');


// Define new URL and file path
NewURL := 'https://www.imdb.com/title/tt3461252/mediaindex';
NewDownloadFile := 'Tmp/multipage-UTF8_NO_BOM.htm';


// Download the new page using AHK script
FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+NewURL+'" "'+ScriptPath+NewDownloadFile+'"');


// Wait for the new download to finish
While Not(FileExists(ScriptPath+NewDownloadFile)) Do Begin
    wait (2000);
End;


// Process the new page for multiple posters
WebText := FileToString(ScriptPath+NewDownloadFile);
WebText := ConvertEncoding(WebText, 65001);
LogMessage('Downloaded multiple posters page');


// Extract and download multiple posters
// Add your logic here to extract poster links and download them
By taking these precautions and structuring the script carefully, we ensure that part2 integrates smoothly with part1 and reliably handles all the necessary HTTPS requests through the AHK script.


Key Implications:
Sequential Addition: Posters need to be added one by one, using the navigation buttons to move through the poster slots (e.g., pos1, pos2).


Automatic Overwrite: Adding a poster in pos1 will overwrite the existing one unless the user navigates to a new slot (pos2) before adding another poster.


Manual Actions Mimicked by Script: Since manual actions require navigation buttons to switch between slots, the script needs to mimic these actions to add multiple posters.


Approach for wscr3:
To import multiple posters programmatically while respecting the manual navigation process, follow these steps:


Extract Poster URLs:


Extract multiple poster URLs from the gallery page as discussed.


Sequential Addition with Navigation:


Use script logic to simulate the navigation and addition of each poster URL.


Ensure the script switches to the next poster slot (pos2, pos3, etc.) before adding each new poster.


Pseudo-code Example:
pascal
// Ensure part1 completion
LogMessage('Function ParsePage smNormal END======================|');
Exit;  // End of initial processing


// Part 2: Start new process for multiple posters
LogMessage('Starting process to download multiple posters');


// New URL and file path
NewURL := 'https://www.imdb.com/title/tt3461252/mediaindex';
NewDownloadFile := 'Tmp/multipage-UTF8_NO_BOM.htm';


// Download the new page using AHK script
FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+NewURL+'" "'+ScriptPath+NewDownloadFile+'"');


// Wait for the new download to finish
While Not(FileExists(ScriptPath+NewDownloadFile)) Do Begin
    wait (2000);
End;


// Process the new page for multiple posters
WebText := FileToString(ScriptPath+NewDownloadFile);
WebText := ConvertEncoding(WebText, 65001);
LogMessage('Downloaded multiple posters page');


// Extract and store multiple poster URLs
PosterURLs := ExtractPosterURLs(WebText); // Pseudo-function to parse and get poster URLs


// Navigate and add each poster URL sequentially
For i := 0 to Length(PosterURLs) - 1 Do Begin
    // Simulate clicking 'nextposterbtn' to navigate to the next poster slot
    SimulateClickNextPosterButton(); // Pseudo-function for clicking the button
   
    // Add the poster URL to the current slot
    AddCustomFieldValueByName('posterURL'+IntToStr(i), PosterURLs[i]);
    AddCustomFieldValueByName('poster'+IntToStr(i), PosterURLs[i]); // Adjust as needed
End;


// Update poster count
AddCustomFieldValueByName('postercount', IntToStr(Length(PosterURLs)));
Testing:
Run wscr3: Execute the script and verify that each poster is added to a new slot correctly.


Check Navigation: Ensure that the script correctly mimics navigation actions between poster slots.


Validation: Verify that all posters appear correctly in PVD without overwriting each other.


By following these steps, you can ensure that multiple posters are imported into PVD correctly while respecting its manual navigation and addition process.


Knowing all before your last message do you think you could Mimick manual actions with part2 to switch between slots, so part2 could be able to add multiple posters?


Steps to Mimic Manual Actions:
Simulate Clicking the Next Poster Button:


Use an AHK script to simulate the click on the nextposterbtn to switch to the next poster slot (e.g., from pos1 to pos2).


Add Poster URL:


Once the new slot is active, use the script to add the poster URL to that slot.


Detailed Plan:
Extract Poster URLs:


Extract the URLs from the IMDb gallery page.


Navigate and Add Posters:


For each extracted URL, navigate to the next poster slot and add the poster.


Example Pseudo-code for Part2:
Part 2: Adding Multiple Posters
pascal
// Ensure part1 completion
LogMessage('Function ParsePage smNormal END======================|');
Exit;  // End of initial processing


// Part 2: Start new process for multiple posters
LogMessage('Starting process to download multiple posters');


// New URL and file path
NewURL := 'https://www.imdb.com/title/tt3461252/mediaindex';
NewDownloadFile := 'Tmp/multipage-UTF8_NO_BOM.htm';


// Download the new page using AHK script
FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+NewURL+'" "'+ScriptPath+NewDownloadFile+'"');


// Wait for the new download to finish
While Not(FileExists(ScriptPath+NewDownloadFile)) Do Begin
    wait (2000);
End;


// Process the new page for multiple posters
WebText := FileToString(ScriptPath+NewDownloadFile);
WebText := ConvertEncoding(WebText, 65001);
LogMessage('Downloaded multiple posters page');


// Extract and store multiple poster URLs
PosterURLs := ExtractPosterURLs(WebText); // Pseudo-function to parse and get poster URLs


// Function to simulate clicking the next poster button
procedure SimulateClickNextPosterButton();
begin
    // Use AHK script to simulate the click
    FileExecute('PathToAHKScript\click_next_poster_button.ahk', '');
end;


// Navigate and add each poster URL sequentially
For i := 0 to Length(PosterURLs) - 1 Do Begin
    // Simulate clicking 'nextposterbtn' to navigate to the next poster slot
    SimulateClickNextPosterButton();
   
    // Add the poster URL to the current slot
    AddCustomFieldValueByName('posterURL'+IntToStr(i), PosterURLs[i]);
    AddCustomFieldValueByName('poster'+IntToStr(i), PosterURLs[i]); // Adjust as needed
End;


// Update poster count
AddCustomFieldValueByName('postercount', IntToStr(Length(PosterURLs)));
Steps for Creating AHK Script:
Create AHK Script:


Write an AHK script to simulate the click on the nextposterbtn.


ahk
; AHK script to simulate clicking the next poster button
ControlClick, nextposterbtn, ahk_class PVDWindowClass
return
Integrate AHK with Delphi/Pascal Script:


Ensure the Delphi/Pascal script calls the AHK script correctly to simulate the button click.


By following these steps and ensuring the AHK script correctly simulates the navigation actions, you can effectively add multiple posters to PVD as if done manually. This approach should work smoothly given the outlined process.


When and if I decide to do this, I will just paste this as my request, when I prepare the way to upload script, intermediate .html, .ahk etc.

What I achieved for now is to add my own custom field "IMDb Cast" which imports up to 15 actors from the principal page, out of PEOPLE_LIMIT in the script, and already to revise the code using AI, because meanwhile IMDb layout changed. I just pasted original snippet, gave to AI new IMDb layout, and in a second I got script corrected. I also achieved new custom "IMDb Directed by" snippet, populated as "A FILM BY MEL GIBSON" form, because I cannot position "A FILM BY " to the skin as I intend to because of the limitation of PVD, database and the nature of fields themselves. The peak of new skins (I'm creating 4 versions of it) is in the messages after this due to the limit of attachments. I'm posting my highly customized script too, if someone is interested in it, but I warn you that you have to add corresponding custom fields to PVD if you want your PVD to looks like this.

When you have further questions, just let me know. It is crucial we to share info if we want to save PVD.

144
Other Topics / Re: PVD Skins and Serna Free
« on: November 23, 2024, 09:34:28 pm »
Thanks Ivek!

145
Other Topics / PVD Skins and Serna Free
« on: November 23, 2024, 08:15:58 pm »
For creating skins I'm using Serna Free xml editor. It's obsolete, it's code is open sourced on GitHub, and I couldn't make anything without it. It's WYSIWYG, so you don't deal with any notepad-like coding. You can move elements (PVD fields and other elements) through the tree and in PVD to refresh the skin to immediately check results.
Serna Free is 12 years obsolete, but still working properly, but it's not easy to find it today, so you probably have to use some torrent downloader if you want to find, download and use it. I didn't find any other xml editor that is near Serna, just like there is no movie database program near like PVD.
Once you try it, you will never use anything else for at least skinning PVD.

146
Other Topics / PVD Scripts in Notepad++
« on: November 23, 2024, 07:46:26 pm »
I don't know how and where I got original PVD UserDefinedLanguage script for Notepad++, but now I tweaked it, together with Default Styler in Notepad++, so it's now easier for me to navigate through PVD scripts. Here are PVD UDL for .psf files, and tweaked default styler. You can import UDL Via Language->User Defined Language->Define Your Language->Import... and paste stylers.xml to appropriate folder for Notepad++ (The stylers.xml file for Notepad++ is typically located in the following directory ffor a normal installation: %AppData%\Notepad++\themes\stylers.xml and for a portable version: <installation_directory>\Data\Config\stylers.xml). You might want to backup your original stylers.xml, if you're not satisfied with the new Notepad++ look, and bring it back later. You can tweak the keys and colors of UDL to your likings at the place you imported it.


Choose the language PVD_UDL_final and choose Default(stylers.xml) in Settings->Style Configurator..., as in the picture 1, then restart Notepad++ and your PVD script should look like in the picture 2.

147
Support / Re: FilmAffinity correction
« on: November 23, 2024, 06:54:40 pm »
Thank you Ivek. Here is my script that corrects this.

148
Support / New FilmAffinity Script
« on: November 22, 2024, 09:13:35 pm »
At least recently, FilmAffinity script parses Movie title custom field "title1" together with movietype when the title is not movie, but series, documentary or so. For example, for https://www.filmaffinity.com/en/film348275.html for the result after <h1> we were getting


Quote
Orson Welles: The One-Man Band                documentary

Instead


Quote
Orson Welles: The One-Man Band

only.


So, using AI, I corrected this, because I confirmed that in such cases there are exactly 16 spaces between the title and movie type. So I changed this in the script. Instead of this


Code: [Select]

//Get ~title~
    curPos:=1
    ItemValue:=TextBetWeen(HTML,'<h1 id="main-title">','</h1>',false,curPos);            //Strings which opens/closes the data. WEB_SPECIFIC
    AddCustomFieldValueByName('title1',ItemValue);
    LogMessage('      Get result title:'+ItemValue+'||');


I changed with this ( I choose to use >8 spaces just in case)
Code: [Select]

// Get ~title~
curPos := 1;


// Extract the section within <h1 id="main-title"> and </h1>
ItemValue := TextBetWeen(HTML, '<h1 id="main-title">', '</h1>', false, curPos);
LogMessage('Intermediate result after <h1>: ' + ItemValue + '||');


// Check and clean up any trailing content with 8 or more spaces
curPos := Pos('        ', ItemValue); // 8 spaces here between single quotes


if curPos > 0 then
begin
    // Move the cursor to cover any additional spaces
    // This loop handles any number of trailing spaces greater than or equal to 8
    while (curPos <= Length(ItemValue)) and (ItemValue[curPos] = '        ') do // 8 spaces here between single quotes
    begin
        curPos := curPos + 1;
    end;
   
    // Extract the title up to the first non-space character after the spaces
    ItemValue := Copy(ItemValue, 1, curPos - 1);
    LogMessage('Cleaned title result: ' + ItemValue + '||');
end
else
begin
    LogMessage('No extra trailing content found.');
end;


// Trim any leading or trailing whitespace
ItemValue := Trim(ItemValue);


// Add the title to the custom field
AddCustomFieldValueByName('title1', ItemValue);


// Log the final cleaned title for verification
LogMessage('Get result title: ' + ItemValue + '||');



It would be good Ivek to officially include it in FilmAffinity script if interested in, otherwise if someone is interested in, I can post my already customized script

149
Support / Re: List of custom fields
« on: November 21, 2024, 01:48:37 am »
Thank you. Another tip: if you filter column "J" for "For Script", and column "L" for "blanks", you can see what custom fields in your PVD are not in any script stated in the table (thus most probably in any other, but for sure not in any active, because I extracted from a lot of scripts and from all currently active), so you might want to delete those fields from your PVD as useless. Of course, be extremely careful.

150
Support / Re: List of custom fields
« on: November 19, 2024, 05:54:19 am »
Here's the most comprehensive list of both original and custom fields through many active and obsolete scripts, I have managed to gather.


If you want me to add fields from any other script please do not post links to the script, upload script here, or I won't be able to add it to the list. That is how we will easier track which additional scripts are added.

Probably very interesting column is column D which shows if script field is active or inactive ("hidden") in the script, so you might want to change the script if you find some inactive field in active script for yourself, and you even didn't know it's there. Not every hidden field will import data when activated, be aware, so if you're not sure, better ask Ivek.

List of my custom films is in column H. Yours is different so change it carefully if you want to know which custom fields from scripts you don't have added to your PVD. For this filter either column B or G for "No Custom Field Added in PVD for This Field".


There are many formulas in the file in order to help automation of future adding, as well as for better visibility inside the file, so be careful with any customization especially because of array formulas and conditional formatting.


It would be nice someone to change exclusively in column B what types of PVD fields are those in column A, with "No Custom Field Added in PVD for This Field" in column B. Please do not change this in column G. I added column B intentionally for this change only.


If you have any question, I'll do my best to respond.

151
Support / Re: Poster field
« on: November 18, 2024, 05:39:11 am »
And then, I thought that maybe multiple posters can be imported by the script at once to imagelist field, beside poster which is not in imagelist? For this we would need probably something like multiple-downpage-UTF8_NO_BOM.htm and the rest to be defined...

152
Support / Re: Poster field
« on: November 18, 2024, 05:06:50 am »
Thanks for the responses. We could probably achieve this by mimicking nextposterbtn clicking after each import. That would also need to rewrite ahk autioit script, and all of that would be way to over headed

153
Support / Re: Poster field
« on: November 16, 2024, 11:00:36 pm »
Hi afrocuban,
PVD can handle multiple images for the same type (poster, disk cover, etc..) but from scripts I have never been able to upload more than 1 per type.

Hmmm, yes, me too. I'm trying but what ever I try, script won't compile, and it should. For example, this:
Code: [Select]

type
  TPosterInfo = record
    ImageURL: string;
    Caption: string;
    Height: Integer; // Included height in the record for clarity
  end;


Function ParsePage_IMDBMovieBASE(HTML: String): Cardinal; //BlockOpen
  //Returns:
  // Result:=prFinished; Script has finished gathering data
  // Result:=prError; If ¿any big problem? with exit;
  // Retrieve: ~title~, ~year~, ~origtitle~, ~poster~ / ~imdbrating~, ~IMDB_Votes~ (Custom Field) / ~TOP_250~ (Custom Field) /
  // If Not(GET_FULL_CREDIT): ~crew~ ctDirectors, ctWriters, ctComposers, ctProducers (Not in base page), ctActors
  // ~description~ / ~category~ "keywords" / ~tagline~ / ~genre~
  // If Not(GET_FULL_MPAA) ~mpaa~
  // ~country~ / ~rdate~ in contry provider local IP geolocation
  // If Not(GET_FULL_AKA) ~aka~.
  // ~budget~ / ~money~ / ~studio~ "Production Co"
Var
  curPos, endPos, index, debug_pos1: Integer;
  StartPos, Hours, Minutes: Integer;
  ItemValue, ItemValue0, ItemValue1, ItemValue2, ItemValue99, ItemList, ImageFile: String;
  MovieURL, titleValue, yearValue, yearsValue: String;
  Name, Role, PersonURL: String;
  ItemList2, ItemList12, day_s, month_s, year_s: String;
  ItemList1, ItemList11: String;
  ItemArray: TWideArray;
  Posters: array of TPosterInfo; // Declared Posters here
  PosterURL, TempURL: String;    // Added for poster handling
  TempHeight: Integer;           // Added for poster handling


Begin
  LogMessage('Function ParsePage_IMDBMovieBASE BEGIN======================|');
  Result := prFinished;  // It will change to prError if any big problem with exit;
  //Because the script doesn't retrieve the data in order, a token search for the first curPos position or block select is mandatory
  //Get ~title~, ~year~, ~origtitle~, ~poster~
  //Get all "raw" title summary (in raw because we need the hidden links, we avoid "complete" token in strings which opens/closes)   // (* *) 
  //Get ~MID ID:~ and ~NUM ID::~
  AddCustomFieldValueByName('MID ID:', GetFieldValueXML('mid'));
  LogMessage('  ** Movie MID ID: ' + GetFieldValueXML('mid') + ' **');
  if GetFieldValueXML('num') <> '0' then AddCustomFieldValueByName('NUM ID:', GetFieldValueXML('num'));
  if GetFieldValueXML('num') <> '0' then LogMessage('   * Movie NUM ID: ' + GetFieldValueXML('num') + ' ||');
  //Get ~script info~
  //Get ~rdate~ in country provider local IP geolocation. See: http://sobizarre-en.blogspot.fr/2014/12/how-to-easily-defeat-imdb-geolocation.html
  //Get ~imdbrating~, ~IMDB_Votes~ (Two tries)
  ItemList := TextBetWeenFirst(HTML, '<script type="application/ld+json"', '}</script>'); //WEB_SPECIFIC.
  //LogMessage('           Parse results (' + IntToStr(curPos) + ',' + IntToStr(endPos) + ') complex ItemList: ' + '<script type="application/ld+json"' + ItemList + '}</script>' + '||');
  If (Length(ItemList) > 0) Then Begin   
    //Get ~IMDb Url~   
    //MovieURL:='http://www.imdb.com' + TextBetWeenFirst(ItemList, '","url":"', '","name":"');
    MovieURL := TextBetWeenFirst(ItemList, '","url":"', '","name":"');
    MovieURL := StringReplace(MovieURL, 'https://', 'http://', True, False, True);
    AddFieldValueXML('url', MovieURL);
    LogMessage('   *   Get result url 1:' + MovieURL + ' ||');
    LogMessage('  *  Get result MovieURL: ' + MovieURL);
    // IMDB_FIELD = 'IMDB';
    if PosFrom('imdb', MovieURL, 1) > 0 then AddCustomFieldValueByName(IMDB_FIELD, '-1');   
    //Get ~title~
    titleValue := TextBetWeenFirst(ItemList, '","name":"', '","');       //Strings which opens/closes the data. WEB_SPECIFIC
    If titleValue = '0' then titleValue := '';
    //If titleValue = '' then titleValue := TextBetWeenFirst(ItemList, '<h1 class="long">', '<');       //Strings which opens/closes the data. WEB_SPECIFIC
    if GET_ORIGINAL_TITLE then AddFieldValueXML('title', titleValue);
    AddCustomFieldValueByName('Title', titleValue);
    AddCustomFieldValueByName('Localized title', titleValue);   
    LogMessage('      Get result title:' + titleValue + '||');   
    //Get ~origtitle~
    ItemValue := TextBetWeenFirst(ItemList, '","name":"', '","');          //Strings which opens/closes the data. WEB_SPECIFIC
    If (Length(ItemValue) = 0) Then ItemValue := titleValue;                           //Provider hides the original title if same as title. WEB_SPECIFIC
    AddFieldValueXML('origtitle', ItemValue);
    AddCustomFieldValueByName('Origtitle', ItemValue);
    LogMessage('      Get result origtitle:' + ItemValue + '||');
    //Get ~alternatetitle~
    ItemValue := TextBetWeenFirst(ItemList, '","alternateName":"', '","');          //Strings which opens/closes the data. WEB_SPECIFIC
    AddCustomFieldValueByName('Localized title', ItemValue);
    if GET_LOCAL_TITLE then AddFieldValueXML('title', ItemValue);
    if ItemValue <> '' then LogMessage('      Get result alternatetitle:' + ItemValue + '||');   
    If ItemValue <> '' then AddCustomFieldValueByName('Imdb_Title', ItemValue + #13 + titleValue + '  (original title)')
    Else AddCustomFieldValueByName('Imdb_Title', titleValue);                                                                                               
    //Get ~IMDB_Movietype~
    ItemValue := TextBetWeenFirst(ItemList, '","@type":"', '","');   //Strings which opens/closes the data. WEB_SPECIFIC
    MediaType := ItemValue;
    MediaType := StringReplace(MediaType, 'TVEpisode', 'TV Episode', True, False, True);
    MediaType := StringReplace(MediaType, 'TVSeries', 'TV Series', True, False, True);
    AddCustomFieldValueByName('IMDB_Movietype', MediaType);
    AddCustomFieldValueByName('Tv 0', MediaType);
    if ItemValue <> '' then LogMessage('      Get result MediaType (CF~IMDB_Movietype~):' + MediaType + '||');
    //Get ~IMDB_MPAA~ 
    ItemValue := TextBetWeenFirst(ItemList, ',"contentRating":"', '","');   //Strings which opens/closes the data. WEB_SPECIFIC   
    AddCustomFieldValueByName('IMDB_MPAA', ItemValue);
    if ItemValue <> '' then LogMessage('      Get result ContentRating (CF~IMDB_MPAA~):' + ItemValue + '||');   
   
    // Start of the new poster-related code
    procedure AddPoster(const URL: string; Height: Integer);
    begin
      SetLength(Posters, Length(Posters) + 1);
      Posters[High(Posters)].ImageURL := URL;
      Posters[High(Posters)].Caption := 'Poster'; // Adjust this as needed
      Posters[High(Posters)].Height := Height; // Added to ensure height is stored
    end;
    repeat
      PosterURL := TextBetWeenFirst(ItemList, BASE_URL_IMAGE_PRE_TRUE, '.'); // Adjust this to match actual URLs
      if PosterURL <> '' then
      begin
        TempURL := BASE_URL_IMAGE_PRE_TRUE + PosterURL + '.jpg';
        TempHeight := StrToIntDef(TextBetWeenFirst(PosterURL, '_V1_UY', '_'), 0);
        AddPoster(TempURL, TempHeight);
      end;
    until (PosterURL = '');


    // Import the posters up to the specified limit
        PosterCount := Min(5, Length(Posters)); // Up to 5 posters
    for index := 0 to PosterCount - 1 do
    begin
      ImageFile := GetAppPath + 'Scripts\' + BASE_DOWNLOAD_FILE_IMAGE_NAME + '-Poster-' + IntToStr(index + 1) + '.jpg';
      if (1 = DownloadImage(Posters[index].ImageURL + '._V1_UY' + IntToStr(Posters[index].Height) + '_.jpg', ImageFile)) then
      begin
        AddImageURL(itPoster, ImageFile);
        LogMessage('Imported poster: ' + Posters[index].ImageURL + '._V1_UY' + IntToStr(Posters[index].Height) + '_.jpg' + ' || Height: ' + IntToStr(Posters[index].Height));
      end
      else if (1 = DownloadImage(Posters[index].ImageURL + '.jpg', ImageFile)) then
      begin
        AddImageURL(itPoster, ImageFile);
        LogMessage('Imported poster: ' + Posters[index].ImageURL + '.jpg' + ' || Height: ' + IntToStr(Posters[index].Height));
      end;
    end;
    // End of the new poster-related code
  End;


Begin
  LoadPosters;
  // Additional code to integrate with PVD if needed
End.
       
      //~description~   



The log complains with this
Quote

(11/16/2024 1:17:20 PM) Could not compile script: IMDB_2c_afro-Custom Cast + more.psf

[Error] (731:5): Identifier expected

Line 731 is  procedure AddPoster(const URL: string; Height: Integer);



154
Support / Re: Poster field
« on: November 16, 2024, 11:42:31 am »
To add further questions, so you could answer in one post:
If you have a definitive answer (yes or no), how do you know that, is it your experience?
If it's not experience, is there any resource on this forum that I am able to see and find, but I can't succeed to find such info?
If there's some resource out of this forum, or here but I don't have access to it, and which would provide me to analyze capabilities of database and PVD itself, but you have an access to such resource I'd highly appreciate if you could, would or are allowed and be willing to share it with me.

Thank you in advance.

155
Support / Poster field
« on: November 16, 2024, 11:17:53 am »
Hello again, Ivek. I'm further customizing your script. I've got that custom director's field, but I will not post the script until some point when I will be satisfied with the level of customization.


Now I'm working on a possibility to import more than one poster at once from the site (let's say, IMDb site). Do you by any chance know if database or PVD itself allows that, so with the proper script coding, multiple posters would be parsed and populated to poster field?

156
Support / Re: Custom actors and directors field
« on: November 13, 2024, 11:09:09 pm »

This code of yours does not work for me. Can you attach your version of the script so I can see how it looks and works.


Of course. Just to let you know that at the moment I'm working on Directors custom field. So, for now only IMDb Cast custom field works

157
Support / Re: Custom actors and directors field
« on: November 13, 2024, 11:06:21 pm »
IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script is attached.

Just to confirm that your script works! Thank you so much!

158
Support / Re: Custom actors and directors field
« on: November 13, 2024, 06:05:17 pm »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

I will edit a special script for this, maybe today for you.

Here is a special IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script for you, which is set up to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. You can also edit other person information using it.

The IMDB_[EN][HTTPS]_TEST_2c script cannot transfer all person information from the primary IMDb movie pages, because it will need to make some corrections or updates to properly transfer all information again,  because some changes were made to the source code of the IMDb pages again.


IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script is attached.

Oh, you were faster then me. My replying window was open while I was coding, so wasn't aware of your response. Thank you so much, but as I wrote, let's spare you when you are needed for global script, not for mine only! Humbly grateful.

159
Support / Re: Custom actors and directors field
« on: November 13, 2024, 06:03:07 pm »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

Oh, I see! Thank you for fantastic assistance!!! It works now! Here's the code (it imports only up to 15 actors into custom field because of the design of my skin):

Code: [Select]

If GET_FULL_CREDIT Then Begin
    //Get ~crew~ctDirectors,ctWriters,ctComposers,ctProducers
       curPos:=Pos('<li role="presentation" class="ipc-metadata-list__item" data-testid="title-pc-principal-credit"><span class="ipc-metadata-list-item__label">Director',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=PosFrom('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">',HTML,curPos); // Strings end which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed.
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/','/?ref_=tt_ov_dr',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_ov_dr">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Get result Name:'+Name+'||');
          //Get Role NO: PVD don't save Role in crew people
          If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
             AddMoviePerson(Name,'','',PersonURL,ctDirectors);
          LogMessage('      Get results Director:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctDirectors'); 
          curPos:=PosFrom('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End;   
    //Go to "Writer:" or "Writers:" ~crew~ctWriters
       curPos:=Pos('">Writer',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=PosFrom('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">',HTML,curPos); // Strings end which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/','/?ref_=tt_ov_wr',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_ov_wr">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Get result Name:'+Name+'||');
          //Get Role NO: PVD don't save Role in crew people
          AddMoviePerson(Name,'','',PersonURL,ctWriters);
          LogMessage('      Get results Writer:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctWriters'); 
          curPos:=PosFrom('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End; 
//Go to "Soundtracks" ~crew~ctComposers
       curPos:=Pos('/soundtrack/?ref_=tt_trv_snd" target="">Soundtracks</a>',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('/soundtrack/?ref_=tt_trv_snd" target="">Soundtracks</a>'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('/soundtrack/?ref_=tt_trv_snd" aria-label="See more" target="">',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('</span><span class="soundtrack-comment-1">',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed.
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'" href="/name/','/?ref_=tt_trv_snd">',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_trv_snd">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          //Get Role NO: PVD don't save Role in crew people
          If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
             AddMoviePerson(Name,'','',PersonURL,ctComposers);
          LogMessage('      Get results Composers:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctComposers'); 
          curPos:=PosFrom('Composed by',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End; 
    //Go to "Producers" ~crew~ctProducers
       //No Producers in principal page. 
       LogMessage('      Get No results Producers'+#13);
    //Get to "Cast" ~actors~ ctActors
       // Start the cast extraction process
LogMessage('Starting cast extraction process.');
curPos:=Pos('<h3 class="ipc-title__text">Top cast',HTML); // Start of cast block
curPos:=curPos+Length('<div class="ipc-avatar ipc-avatar--base ipc-avatar--dynamic-width" role="group">'); // Strings end which opens the block content data. WEB_SPECIFIC


// Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
endPos:=PosFrom('</li></ul><><><><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
ItemList:=Copy(HTML,curPos,endPos-curPos);
//LogMessage('Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
curPos:=Pos('" class="ipc-image" loading="',ItemList); // String which opens the subList data. WEB_SPECIFIC
index:=1;
ItemValue1:=''; // Initialize the custom IMDb Cast field


While (curPos > 0) and (index <= 15) Do Begin
    // Get PersonURL (Always must it has)
    ItemValue:=TextBetWeen(ItemList,'<a data-testid="title-cast-item__actor" href="/name/','?ref_=tt_cl_t_',false,curPos);
    PersonURL:=BASE_URL_PERSON_PRE + ItemValue + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
    LogMessage('Parse Results PersonURL:'+PersonURL+'||');


    // Get Name (Always must it has)
    Name:=TextBetWeen(ItemList,'">','</a><div class="title-cast-item__characters-list">',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
    LogMessage('Parse Results Name:'+Name+'||');


    // Custom field: IMDb Cast (names only, separated by " • ")
    If ItemValue1='' Then
        ItemValue1:=Name
    Else
        ItemValue1:=ItemValue1+' • '+Name;


    curPos:=PosFrom('<a data-testid="title-cast-item__actor" href="',ItemList,curPos); // Move to the next actor's block
    index:=index+1;
End;


// Add custom field IMDb Cast
AddCustomFieldValueByName('IMDb Cast', ItemValue1);
// Log the IMDb Cast field for verification
LogMessage('IMDb Cast: '+ItemValue1);


// Log message and end block as in your script
LogMessage('Completed cast extraction process.');
LogMessage(#13+'');
End;


    //Get "plot_summary" as ~comment~ //debug_pos1-1







I will edit a special script for this, maybe today for you.


I don't want to bother you! This is only for my needs so far, so let's spare you!!!

160
Support / Re: Custom actors and directors field
« on: November 12, 2024, 11:48:44 pm »
Thanks for a feedback, Ivek.
I understood your points, and this is what I did


Code: [Select]

    //Get  to "Cast" ~actors~ ctActors
       //Go Cast list
       curPos:=Pos('<h3 class="ipc-title__text">Top cast',HTML);                                     //Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-avatar ipc-avatar--base ipc-avatar--dynamic-width" role="group">');                                //Strings end which opens the block content data.  WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><><><><>',HTML,curPos);                                             //Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('" class="ipc-image" loading="',ItemList)                               //String which opens the subList data. WEB_SPECIFIC
       index:=1;
ItemValue1:=''; // Initialize the custom IMDb Cast field


       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break;     //Limited depassed.
          //Get PersonURL (Always must it has)
          ItemValue:=TextBetWeen(ItemList,'<a data-testid="title-cast-item__actor" href="/name/','?ref_=tt_cl_t_',false,curPos);
          PersonURL:=BASE_URL_PERSON_PRE + ItemValue + BASE_URL_SUF; //Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
       //Get Name (Always must it has) 
          //Name:=TextBetWeen(ItemList,'?ref_=tt_cl_t_'+IntToStr(index)+'" class="StyledComponents__ActorName-y9ygcu-1 eyqFnv"','</a><div class="title-cast-item__characters-list">',false,curPos);
        Name:=TextBetWeen(ItemList,'">','</a><div class="title-cast-item__characters-list">',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
          //Name:=Trim(StringReplace(Name,'>','',True,False,True));
        LogMessage('      Parse Results Name:'+Name+'||');
          //Get Role YES: PVD save Role in cast (actors) people (Not always has link)       
        Role:=TextBetWeen(ItemList,' title-cast-item__char" data-testid="cast-item-characters-link">','</span><span data-testid="cast-item-characters-with-as" class="',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
          //Role:=Trim(StringReplace(Role,'>','',True,False,True));
          ///Role:=StringReplace(Role,Chr(13),'',True,False,True);
          ///Role:=StringReplace(Role,'  ','',True,False,True);
          LogMessage('      Parse Results Role:'+Role+'||');
        If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
        AddMoviePerson(Name,'',Role,PersonURL,ctActors);
          LogMessage('      Get results cast:#'+IntToStr(index)+'|'+Name+'|'+Role+'|'+PersonURL+'||ctActors');                                               


    // Custom field: IMDb Cast (names only, separated by "  •  ")
    If ItemValue1='' Then
        ItemValue1:=Name
    Else
        ItemValue1:=ItemValue1+'  •  '+Name;
          //curPos:=PosFrom('" class="ipc-image" loading="',ItemList,curPos);                          //String which opens the Web Result item List data. WEB_SPECIFIC
          index:=index+1;
       End;
      //LogMessage(#13+'');
    End;   
   //*)     
   //(*         
      LogMessage(#13+'');
   //*)     


// Add custom field IMDb Cast
AddCustomFieldValueByName('IMDb Cast', ItemValue1);
// Log the IMDb Cast field for verification
LogMessage('IMDb Cast: '+ItemValue1);


    //Get "plot_summary" as ~comment~ //debug_pos1-1


Mysteriously and hilariously, instead of importing Cast, it imports Tv2 value into IMDb Cast field! It's some problem with ItemValue1 value that I'm trying to define, but I am not able to grasp what I'm doing wrong, so it pulls ItemValue1 from the first previous segment where it's used, and that is exactly Tv2 field in the script.


If you're willing to review and suggest snippet change, it would be appreciated as always.


P.S. Forum won't accept in the code section / div, but it's there in


<><><><>


so it's actually < / div >< / div >< / div >< / div >, without space inside, of course.

Pages: 1 ... 3 4 5 6 7 [8] 9 10 11 12 13 ... 32
anything