Recent Posts

Pages: 1 2 [3] 4 5 6 7 8 ... 10
21
Support / Re: FilmAffinity correction
« Last post by afrocuban on November 23, 2024, 06:54:40 pm »
Thank you Ivek. Here is my script that corrects this.
22
Support / Re: FilmAffinity correction
« Last post by Ivek23 on November 23, 2024, 03:42:20 pm »
It would be good Ivek to officially include it in FilmAffinity script if interested in
No interested.

otherwise if someone is interested in, I can post my already customized script
You can post script.
23
Support / FilmAffinity correction
« Last post by afrocuban 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
24
Support / Re: List of custom fields
« Last post by afrocuban 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.
25
Support / Re: List of custom fields
« Last post by NetworkShark on November 20, 2024, 10:25:25 pm »
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.

Great work, afrocuban!
26
Support / Re: List of custom fields
« Last post by afrocuban 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.
27
Support / Re: Poster field
« Last post by afrocuban 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...
28
Support / Re: Poster field
« Last post by afrocuban 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
29
Support / Re: Poster field
« Last post by Ivek23 on November 17, 2024, 12:54:28 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);

Quote
procedure AddPoster(const URL: string; Height: Integer);

Of course, this doesn't work, it reports an error, because this AddPoster procedure must be added separately to the script, just like, for example, Function TextBetWeenFirst, so that the script will then show the errors that need to be fixed.

It will immediately report an error for
SetLength or somewhere else that needs to be added.


And this.

As you now have the code for posters, you will not be able to download the nebene downimage-BIN-Poster image to the Tmp folder because you are missing part of the code for DownloadImage


And this advice.

It is also necessary to edit the code for transferring to the Tmp folder so that there are more downimage-BIN-Poster images in the folder, only then will it be possible to add more poster types to the database.
30
Support / Re: Poster field
« Last post by Ivek23 on November 17, 2024, 12:31:45 pm »
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?

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.

NetworkShark user has already written the correct findings regarding the number of adding posters and other images to the PVD database using scripts. VVV_Easy_Programin user and author of the mod versions also found that it was not possible to add more than one screenShot for each movie from the website to the database. Also all 1.x.x versions allow the transfer of only one type (poster, disk cover, etc..).

However, there is a manual solution for adding multiple types (poster, disk cover, etc..). The easiest way is to add manually in edit mode. It is not bad if you also have an imagelist added to the skin, as in the code added below.
Quote
            <tab shape="true" space="1">
              <caption>&amp;Images</caption>
              <color>$E0ECFE</color>
              <row>
                <column valign="top" space="1">
                  <imagelist valign="top" halign="left" cheight="100" cwidth="75" autosize="true" space="7">
                    <border shape="none" />
                    <color>$CCDDEE</color>
                  </imagelist>
                </column>
              </row>
            </tab>
Pages: 1 2 [3] 4 5 6 7 8 ... 10