Personal Video Database alternate Forum it is NOW online again.
0 Members and 1 Guest are viewing this topic.
Personal Video Database Export Templates Manual * File Structure * Template Options * Special Values * Movie Values * Person Values * Field Parameters * Subtemplates * FunctionsFile structure: »Main Template%OPTIONS%encoding=”S” Defines encoding of the resulting file. Possible values are: UTF8, UTF8BOM, ANSIsortby=”S” Defines the field by which records are to be sorted (field numeric identifiers or string constants are acceptable)(see Movie Field Values and Person Field Values)sortdir=”S” Defines sort direction. Possible values are: sdAscending, sdDescendingrecordtemplate=”S” Defines the file that contains a record template file (relative path). Following variables can be used to format the file name and/or path: %fname% - selected target filename (without extension), %fext% - selected target file extensionimagepath=”S” Defines the path where images are to be saved (relative to the resulting text file). Following variables can be used to format the file name and/or path: %fname% - selected target filename (without extension), %fext% - selected target file extensioncopyfile="source<->target" Makes the plug-in copy certain files to a new location. Following variables can be used to format the file name and/or path: %fname% - selected target filename (without extension), %fext% - selected target file extensionfullstar=”S” Defines the path to the full star image used to display rating (relative to resulting text file). Following variables can be used to format the file name and/or path: %fname% - selected target filename (without extension), %fext% - selected target file extensionhalfstar=”S” Defines the path to the half star image used to display rating (relative to resulting text file). Following variables can be used to format the file name and/or path: %fname% - selected target filename (without extension), %fext% - selected target file extensionnonestar=”S” Defines the path to the empty star image used to display rating (relative to resulting text file). Following variables can be used to format the file name and/or path: %fname% - selected target filename (without extension), %fext% - selected target file extensionitemsperpage=”X” Defines the number of records exported to one page. Each page will be saved in separate file with following naming format: filenamepagenumber.extensionfilter=”S” File filter used in "Save as" dialog. Format: File Type Name|*.extension1;*.extension2;...;*.extensionNrecordfilename=”S” Defines the format of the filename for files generated using Record Template. Following variables can be used to distinguish files of different records: %id% - movie ID, %t% - Title/Name, %ot% - Original Title/Translated Name, %y% - Movie Year, %rid% - Database record id, %fname% - selected target filename (without extension), %fext% - selected target file extensionpagestpl=”S” Defines the path to a template for generating a list of pages relative to main template fileprevtpl=”S” Defines the path to a template used in Page Template to create a link to a previous page relative to main template filenexttpl=”S” Defines the path to a template used in Page Template to create a link to a next page relative to main template filepagelinktpl=”S” Defines the path to a template used in Page Template to create a link to a certain page number relative to main template filepagecurtpl=”S” Defines the path to a template used in Page Template to output current page number relative to main template filereplace=”value1<->value2” Tells the export plug-in to replaces all occurrences of value1 with value2. You can set value1 or value2 to a line break using #13#10boolvals=”TrueValue<->FalseValue” Defines strings that should be used for Boolean field valuesreplacecase=” value1<->value2” Same as replace, but case sensitivenearfiles=”B” This option tells the plugin to store exported files near video files and defines how to format filenames. Possible variables are: %id% - movie ID, %t% - Title/Name, %ot% - Original Title/Translated Name, %y% - Movie Year, %rid% - Database record idimagenameformat=”S” Tells the export plug-in how to format filenames of the images resulting from export. Possible variables are: %id% - movie ID, %w% - Image Width, %h% - Image Height, %ext% - File Extension, %f% - Image Field, %fs% - Image Type, %t% - Title/Name, %ot% - Original Title/Translated Name, %y% - Movie Year, %rid% - Database record id, %in% - Image Number, %fname% - selected target filename (without extension), %fext% - selected target file extension%OPTIONS%All TemplatesHeader Page Template FooterYou can place header code that is not repeated for each value or record between tag: %HEAD% You can place footer code that is not repeated for each value or record between tag: %FOOT%Values {%value=”identifier”}Special Values200 Total records count201 Total pages count202 Current page number203 Current record number204 Path to the database file (including file name)205 Database name206 Path to the first page (HTML)207 Path to the index file for the current record (HTML)208 Path to the last page (HTML)209 Path to the previous page (HTML)210 Path to the next page (HTML)211 Insert pages template212 Inserts list of page numbers using Page Templates213 Insert previous page template214 Insert next page template215 Path to the current record's file (HTML)216 Path to the previous record's file (HTML)217 Path to the next record's file (HTML)218 Insert a hyperlink to a certain page219 Path to the first page220 Path to the index file for the current record221 Path to the last page222 Path to the previous page223 Path to the next page224 Path to the current record's file225 Path to the current record's file226 Path to the next record's file227 Path to the images (relative)228 Path to the images (relative) (HTML)229 Path to the images (full)230 Path to the images (full) (HTML)231 Current date232 Current time233 Selected file name (without extension)234 Selected file extension300 IMDB ID (retrieved from URL)301 Video Width (Movies only)302 Video HeightField Values (Movie)Identifier Field Parametersmid Database Record ID num Movie ID title Title origtitle Original Title aka Also Known As (separated with line break) template, maxvaluesyear Year genre Genre (comma separated list) template, maxvaluescountry Country (comma separated list) template, maxvaluesstudio Studio (comma separated list) template, maxvaluesrelease Release mpaa MPAA location Media Location category Category (comma separated list) template, maxvaluestagline Tagline (multiline) description Description (multiline) count Media Count type Media Type rating Rating templateimdbrating IMDB Rating templateorating Additional Rating templateorname Additional Rating Name rip Quality length Duration formatlangs Language (comma separated list) template, maxvaluestranslation Translation (comma separated list) template, maxvaluesresolution Resolution videocodec Video Codec videobitrate Video Bitrate audiocodec Audio Codec (comma separated list) template, maxvaluesaudiobitrate Audio Bitrate (comma separated list) template, maxvaluesaudiocount Number of audio streams sampling Audio stream sampling (comma separated list) template, maxvalueschannels Audio stream channels count (comma separated list) template, maxvaluesrdate Release Date budget Budget money Box Office aspect Aspect Ratio size File Size url URL (separated with space) path File Path (files separated with |) template, maxvaluescomment Comment (multiline) dateadded Date Added moddate Date Modified code Barcode medialabel Media Label (comma separated list) template, maxvaluesloan Is Borrowed (Boolean) subs Subtitles (comma separated list) template, maxvaluesframerate Frame Rate features Features (multiline) viewed Seen (Boolean) bookmark Bookmarked (Boolean) wish Wish (Boolean) series Is Series (Boolean) episodes Episodes template, grouptemplatevisible Visible (Boolean) loandate Loan Date loanname Borrowed to loanperiod Load Period email Borrowed to (Email) viewdate View Date tags Tags (comma separated list) template, maxvaluesawards Awards template, grouptemplatelinks Connections template, grouptemplateastreams Audio Streams template, grouptemplateoriglang Original Language extension Video File Extension actors Actors template, maxvalues, paramsdirectors Directors template, maxvalues, paramswriters Writers template, maxvalues, paramscomposers Composers template, maxvalues, paramsproducers Producers template, maxvalues, paramscredits Credits template, grouptemplateposter Poster template, maxvalues, params, width, heightscreenshots Screenshots template, maxvalues, params, width, heightfroncover Front Cover template, params, width, heightcdcover Disc Cover template, params, width, heightCustomFieldName Custom Field customField Values (Person)Identifier Field Parameterspid Database Record ID name Name transname Translated Name altnames Alternative Names (comma separated list) template, maxvaluesbirthday Birthday birthplace Birthplace bookmark Bookmarked (Boolean) visible Visible (Boolean) bio Biography (multiline) filmography Filmography template, grouptemplatecomment Comment (multiline) death Date of Death age Age url URL (separated with space) template, maxvaluesgenre Genre (comma separated list) template, maxvaluesdateadded Date Added moddate Date Modified careertype Career Type (comma separated list) template, maxvaluesawards Awards template, grouptemplatephoto Photo template, maxvalues, params, width, heightParameters {%value="identifier" parameter="value"}template Path to subtemplate for fields with multiple values or multiple groups (relative path)grouptemplate Path to group subtemplate for fields that support grouping (relative path)params Set this parameter to full to tell the export plug-in to retrieve all possible data associated with the fieldmaxvalues Maximum values count for fields with multiple valueswidth Maximum image width (The image will be resized to fit)height Maximum image height (The image will be resized to fit)format Format of the duration field. Possible values are: s – Seconds, m – Minutes, Standard time format string like HH:MM:SScustom Set to true if you want to retrieve a custom field valueSubTemplates{%value} (without parameters) is used in subtemplates of fields with multiple values to represent a certain value and in page templates to output current page number{%param=”identifier”} Retrieves a certain field value{%groupparam=identifier} Defines the field by which values should be grouped (Group Templates only)Actors, Directors, Producers, Writers, Composers pid – Database record id, name, transname, url, roleLinks mid – Database record id, linktype – Link Category, linkname – Link Name , num – Movie ID, title, origtitle, year, imdbrating, rating, description, urlAwards event, year, result, award, categoryEpisodes epid – Database episode id, mid – Database record id, epnum – Episode Number, season – Season Number, num – Episode Movie ID, title, origtitle, year, imdbrating, rating, description, urlCredits ctype – Credits Type: 0 – Actors, 1 – Directors, 2 – Writers, 3 – Composers, 4 - Producers, pid – Database record id, name, transname, url, roleFilmography ctype – Credits Type: 0 – Actors, 1 – Directors, 2 – Writers, 3 – Composers, 4 - Producers, ctypestr – Credits Type string equivalent, mid – Database record id, title, origtitle, year, role, urlPosters, Photos, Screenshots imgid – Database image id, imgformat – Image Format (jpg, bmp, gif, png, tif), imgpath – path to the location where the image is saved (if images are saved not inside the database), imgdata – path to the location where the exported image will be savedFunctions: « Syntax: {#Function Name Parmeters separated by space, quote character is '}Function Description ExampleExtractFilePath Removes filename from file path passed as parameter {#ExtractFilePath 'C:\test.txt'}Result: C:\ExtractFileName Removes path leaving only the filename from file path passed as parameter {#ExtractFileName 'C:\test.txt'}Result: test.txtExtractFileExt Extracts extension from filename (or full file path) {#ExtractFileExt 'C:\test.txt'}Result: .txtConditionAdd Adds certain text at the end if the passed parameter fits condition {#ConditionAdd > '0' '{%value=count}' ' x {%value=type}'}If Media Count > 0 then output: Media Count value x MediaConditionAddFirst Adds certain text in the beginning if the passed parameter fits condition {#ConditionAddFirst = 'test' '{%value=label}' 'Test Label is '}If Media Label is equal to test then output: Test Label is Media LabelStringReplace Replaces a part of a string with another string {#StringReplace '{%value=wish}' '0' 'no'}Replace 0 with no in Wish fieldLast update: 19.08.2010Personal Video Database Version 0.9.9.20Plain Text Export Plugin 0.7.1.0Author: Nostradamushttp://www.videodb.info
Personal Video Database Scripting Manual * Obligatory callback functions * Optional callback functions * Functions used to fill data fields * String functions * File functions * Date and Time functions * Miscellaneous functions * Field identifiers * Debugging the scriptObligatory callback functions: »function GetScriptVersion : String;You must return here a string containing version of the script. Any versioning format is acceptable, but you are advised to use the following format: major.minor.release.buildfunction GetScriptName : String;This function should return a short name of the script. You are advised to put the language of the script in brackets in the beginning of the name like this: [EN] Testfunction GetScriptDesc : String;Return a long description here. You are advised to put the language of the script in brackets in the beginning of the name like this: [EN] Long Testfunction GetBaseURL : AnsiString;Web import scripts should return the base URL of the resource they are getting information from. For example: if you retrieve data from IMDB, you will need to return http://www.imdb.com. This URL will be used to detect if a record already has a link to the right page on this resource, so that search is not needed.function GetScriptLang : Cardinal;Return the language identifier of your script (resource). A list of all possible language identifiers is available here: http://msdn.microsoft.com/en-us/library/ms776294%28VS.85%29.aspx (you only need to pass the “primary language identifier”). For example: return $07 for German language.function GetScriptType : Byte;Return the type of your script here.Possible return values are:0 movie information script1 people information script2 poster download3 screenshots download4 covers downloadfunction GetCurrentMode : Byte;This function is used by the main application to determine if the script has already started parsing field information or is still in process of determining the right URL for a record.Possible return values are:0 script has not yet started filling information fields or awaits search results> 0 script is filling information fieldsfunction GetDownloadURL : AnsiString;This function should return URL that should be downloaded by the main application and then passed to the script’s ParsePage function as text.+ ExampleIf your script just need to find a movie/person and download one page with information you will need to write code like this:Result := SEARCH_STRIf you need to download and parse more than one page I recommend to define extra variables or an array of URLs that need to be downloaded. Code for 2 information pages will look like this: if CreditsURL = '' then Result := SEARCH_STR else Result := SecondPageURL;You can also use the mode variable as an extra flag. This code is for 3 pages using mode variable: if (Mode > 1) AND (PosterURL <> '') then Result := PosterURL else if CreditsURL <> '' then Result := CreditsURL else Result := SEARCH_STR;If you download poster in a movie information script or a photo in a person information script than make sure URL to an image is passed after all other pages are retrieved!function ParsePage(HTML : String; URL : AnsiString) : Cardinal;This function receives the text of the download web page passed to the main application in the GetDownloadURL function.Parameters:HTML contains the text of the pageURL contains the address of the pagePossible return values are:0 an error acquired while processing data1 script has finished gathering data2 a list of search results is available3 a list of image search results is available4 another URL needs to be downloaded+ ExampleThe following actions have to be made in this function:a. Determine what information does this page contain (search results, movie/person information, etc.) b. Set the mode variable (if script state changes from "searching" to "found") c. Parse HTML and set information fields d. Return an appropriate resulta. Determine what information does this page containIt's pretty simple: You need to find a unique marker in HTML for each page type and do some parsing according to what you have found on this page. Ex.:if Pos('<title>Movie</title>', HTML) > 0 then beginb. Set the mode variableMode := 1;c. Parse HTML and set information fieldsParseMovie(URL, HTML); //This is a helper procedure to make the code better readable.d. Return an appropriate resultResult := 1; //script has finished its jobThe part of the code that determines the type of the web-page and does the rest of the actions should look like this:if Pos('<title>Movie</title>', HTML) > 0 then begin Mode := 1; //>0 – found field data ParseMovie(URL, HTML); //This is a helper procedure to make the code better Result := 1; //script has finished its jobend;I recommend you to create a helper procedure to parse each page type. Ex.:procedure ParseSearchResults(HTML : String); //parse search resultsprocedure ParseMovie(HTML : String); //parse main movie informationprocedure ParseCredits(HTML : String); //parse movie creditsThe whole ParsePage function should look like this:function ParsePage(HTML : WideString; URL : String) : Cardinalbegin if Pos('<title>Search results</title>', HTML) > 0 then begin ParseSearchResults(HTML); Result := 2; //search results retrievedend else if Pos('Nothing found', HTML) > 0 then Result := 0 //error (movie not found)else if (Pos('<title>Movie</title>', HTML) > 0) then begin Mode := 1; //>0 – found field data ParseMovie(URL, HTML); Result := 1; //script has finished its jobend else Result := 0; //error (unknown page retrieved)end;Optional callback functions: « »function GetRatingName : String;You can tell the main application the name to be used for additional rating field (ratings from scripts are assigned to the additional rating field by default) by returning it in this function.function GetCodePage : Cardinal;Returns encoding to be used for downloaded data. All possible values are listed here: http://msdn.microsoft.com/en-us/library/dd317756%28VS.85%29.aspxprocedure GetLoginInfo(out URL : AnsiString; out Params : AnsiString);This procedure is used to tell the main application to login into a web resource before downloading any other pages.Parameters:URL receives the address of the login pageParams receives parameters that will be passed to the login page using POST methodfunction GetDownloadMethod : Byte;Defines method to be used to pass parameters in the last URL returned in GetDownloadURL function.Possible return values are:0 GET1 POSTfunction GetPrefixMode : Byte;For searches the application can format titles in a specific way before passing as a parameter to the search URL. Here, you can define how prefixes should be handled.Possible return values are:0 do nothing1 move prefixes to the end of the title2 place prefixes at the beginning of the title3 remove prefixes from the title[not yet implemented] function GetScriptAbout : String;Return a short information message for an about dialog when accessed from application’s preferences.function GetReferrer : String;Return an address to be used as referrer when downloading the next web page.function ProcException(Exception : String; Msg : String): AnsiString;By implementing this function you can react on exceptions that acquire while downloading a web page.Parameters:Exception name of the exceptionMsg error messagefunction GetCoverType : Smallint;Relevant to cover download scripts only. When a cover image is retrieved the application must know if it is a front cover or disc image. For this purpose this function is called. If you do not implement the GetCoverType function the main application will interpret all images as front covers.Possible return values are:0 front cover1 disc imageFunctions used to fill data fields: « »procedure AddSearchResult(Title1, Title2, Year, URL, PreviewURL : String);Adds a search result. You do not need to provide information for all the variables. Most important is to assign at least Title1 or Title2 and URL. If you do not have information to assign to a certain variable just pass ''.Example: AddSearchResult('Terminator', '', '', 'http://www.web-site.com/terminator.html', ''); //passes Title and URLParameters:Title1 title or nameTitle2 original title or translated nameYear movie release yearURL address containing record informationPreviewURL address of an image for a preview[deprecated] procedure AddFieldValue(AField : Integer; AValue : String);Fill a certain standard field with a value.Parameters:AField field identifierAValue value for the fieldPossible values for AField variable:Movies People0 url 0 url1 title 1 name2 original title 2 translated name3 also known as 3 alternative names4 year 4 date of birth5 genre 5 place of birth6 category 6 genre7 country 7 biography8 studio 8 date of death9 mpaa 10 additional rating 11 tags 12 tagline 13 description 14 duration 15 features procedure AddImageURL(const AImageType : Integer; AValue : String);Makes the main application download an image from an URL defined in AValue variable and assign the image to the record as a certain image type defined in AImageType variable.Parameters:AImageType type of the imageAValue address of the imagePossible values for AImageType variable:0 poster1 screenshot2 front cover3 disc image4 photoprocedure AddFieldValueXML(AField : String; AValue : String);Fill a certain field with a value. The field is identified by a string identifier.Parameters:AField field identifierAValue value for the fieldPossible values for AField variable: See Field Identifiersprocedure AddCustomFieldValueByNumber(CustomNumber : Integer; AValue : String);Fill a certain custom field with a value. The field is identified its number.Parameters:CustomNumber field numberAValue value for the fieldprocedure AddCustomFieldValueByName(CustomName : String; AValue : String);Fill a certain custom field with a value. The field is identified its name.Parameters:CustomName field nameAValue value for the fieldprocedure AddMoviePerson(Name, TransName, Role, URL : String; const AType : Byte);Adds movie credits (actor, director, etc.).Parameters:Name name of the personTransName translated name of the personRole role of the person (if applicable)URL web address of the person (if available)AType credits typePossible values for AType variable:0 actor1 director2 writer3 composer4 producerprocedure AddPersonMovie(Title, OrigTitle, Role, Year, URL : String; AType : Byte);Adds a movie to person's filmography.Parameters:Title movie titleOrigTitle original movie titleRole role of the person in the movie (if applicable)Year release year of the movieURL web address of the movie (if available)AType credits typePossible values for AType variable:0 actor1 director2 writer3 composer4 producerprocedure AddAward(Event, Award, Category, Recipient, Year : String; const Won : Boolean);Adds an award to a record.Parameters:Event name of the eventAward award nameCategory award categoryRecipient for movie records this variable should contain the name of a specific person who won the award and for people records the variable should contain the title of a movie for which the person won the awardYear release year of a movie (only applicable when adding award to a person record)Won set to true if the recipient won the award and to false otherwiseprocedure AddAwardEx(Event, Award, Category, RecipientVal1, RecipientVal2, Year : String; const Won : Boolean);Adds an award to a record. Here you can define both title and original title of a movie as recipient or name and translated name for a person.Parameters:Event name of the eventAward award nameCategory award categoryRecipientVal1 for movie records this variable should contain the name of a specific person who won the award and for people records the variable should contain the title of a movie for which the person won the awardRecipientVal2 for movie records this variable should contain the translated name of a specific person who won the award and for people records the variable should contain the original title of a movie for which the person won the awardYear release year of a movie (only applicable when adding award to a person record)Won set to true if the recipient won the award and to false otherwiseprocedure AddConnection(Title, OrigTitle, Category, URL, Year : String);Adds a movie connection.Parameters:Title movie titleOrigTitle original movie titleCategory category connectionURL web address of the movie (if available)Year release year of the movieprocedure AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode : String);Adds an episode to a series.Parameters:Title episode titleOrigTitle original episode titleDescription episode descriptionURL web address of the episode (if available)Year release year of the episodeSeason season number (as string)Episode episode number (as string)[deprecated] function GetFieldValue(AField : Integer) : String;Use this function to retrieve a field value from a record.Parameters:AField field identifierfunction GetFieldValueXML(AField : String) : String;Use this function to retrieve a field value from a record.Parameters:AField field identifierPossible values for AField variable: See Field Identifiersfunction GetCustomFieldValueByNumber(CustomNumber : Integer) : String;Use this function to retrieve a custom field value from a record by accessing the field using its number.Parameters:CustomNumber number of a custom fieldfunction GetCustomFieldValueByName(CustomName : String) : String;Use this function to retrieve a custom field value from a record by accessing the field using its name.Parameters:CustomName name of a custom field[deprecated] function GetSeriesFieldValue(AField : Integer) : String;Use this function to retrieve a field value from a series record of an episode.Parameters:AField field identifierfunction GetSeriesFieldValueXML(AField : String) : String;Use this function to retrieve a field value from a series record of an episode.Parameters:AField field identifierPossible values for AField variable: See Field Identifiersfunction GetSeriesCustomFieldValueByNumber(CustomNumber : Integer) : String;Use this function to retrieve a custom field value from a series record of an episode by accessing the field using its number.Parameters:CustomNumber number of a custom fieldfunction GetSeriesCustomFieldValueByName(CustomName : String) : String;Use this function to retrieve a custom field value from a series record of an episode by accessing the field using its name.
Parameters:CustomName name of a custom fieldString functions: « »function Pos(Substr : String; Str : String): Integer;Finds position of a substring in a string. The search is not case sensitive.Parameters:Substr string to search forStr where to searchReturn values:Returns 0 if the substring was not found or position of the first occurrence of the substring otherwise.function PosFrom(const SubStr, Str : String; FromIndex : Integer) : Integer;Finds position of a substring in a string starting from a certain point. The search is not case sensitive.Parameters:Substr string to search forStr where to searchFromIndex where to start searchingReturn values:Returns 0 if the substring was not found or position of the first occurrence of the substring otherwise.function LastPos(const SubStr, Str : String) : Integer;Finds position of a substring in a string starting from the end of the string. The search is not case sensitive.Parameters:Substr string to search forStr where to searchReturn values:Returns 0 if the substring was not found or position of the last occurrence of the substring otherwise.function PrevPos(const SubStr, Str : String; APos : Integer) : Integer;Finds position of a substring in a string starting from a certain point and going back to the beginning of the string. The search is not case sensitive.Parameters:Substr string to search forStr where to searchAPos where to start searchingReturn values:Returns 0 if the substring was not found or position of the first occurrence of the substring before APos otherwise.function RemoveTags(AText : String; doLineBreaks : Boolean) : String;Removes all parts of the text between "<>" characters from the original string.Parameters:AText text where tags are to be removeddoLineBreaks set to true if you want the <br> tag to be replaced with carriage return characterReturn values:Returns the string without tags.function ExplodeString(AText : String; var Items : TWideArray; Delimiters : String) : Integer;Splits a string into multiple values using custom delimiters and puts each value into an array (all delimiters are removed).Parameters:AText string that needs to be split[in] Items array where all the values will be containedDelimiters a string containing allowed delimiters, one character each, without separatorReturn values:Returns number of produced valuesfunction UpperCase(S : String) : String;Switches all lowercase case characters in a string with their upper case equivalents.function LowerCase(S : String) : String;Switches all upper case characters in a string with their lower case equivalents.function Copy(S : String; Index, Count : Integer) : String;Returns a substring of a string.Parameters:S string from which a substring should be extractedIndex starting index of the substringCount number of characters to extractReturn values:Returns the resulting substringprocedure Delete(var S : String; Index, Count : Integer);Removes a part of a string.Parameters:[in] S string from which to delete charactersIndex where to start deletionCount number of characters to removeprocedure Insert(Source : String; var Dest : String; Index : Integer);Inserts a string into another string.Parameters:Source what to insert[in] Dest destination stringIndex where to insert the stringfunction Length(S : String) : Integer;Counts the number of characters in a given string.function Trim(S : String) : String;Removes leading and trailing invisible characters like spaces or line breaks from a string.function CompareText(S1, S2 : String) : Integer;Compares two strings. The comparison is not case sensitive.Return values:Returns 0 if both strings are equal, a value greater than zero if S1 > S2 and a value smaller than zero if S1 < S2.function CompareStr(S1, S2 : String) : Integer;Compares two strings. The comparison is case sensitive.Return values:Returns 0 if both strings are equal, a value greater than zero if S1 > S2 and a value smaller than zero if S1 < S2.function StringReplace(S, OldPattern, NewPattern : String; ReplaceAll : Boolean; IgnoreCase : Boolean; WholeWord : Boolean) : String;Replaces all occurrences of a substring with another substring.Parameters:S text where the replacement should take placeOldPattern substring to replaceNewPattern substring to replace withReplaceAll if set to false only the first occurrence will be replacedIgnoreCase if set to false the search for OldPattern will be case sensitiveWholeWord search only for whole wordsReturn values:Returns the resulting substringfunction StrToInt(const S : String) : Integer;Converts a string that represents an integer (decimal or hex notation) to a number.function IntToStr(const Value : Integer) : String;Converts an integer number to a string.function StrToFloat(const S : String) : Extended;Converts a given string to a floating-point value.function FloatToStr(const Value : Extended) : String;Converts a floating point value to a string.function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String;Gathers all values from a given text into a string using ValDelim as delimiter. The function searches for ABegin first starting from Pos, from this point it gathers values between ItemBegin and ItemEnd until AEnd is found. The last position is returned in Pos variable.Parameters:HTML text to processABegin substring where the values start (header)ItemBegin substring that precedes each single valueItemEnd substring that follow each single valueValDelim delimiter to use in a resulting string[in] Pos from which position in text should the search start (will contain the position of AEnd after execution)Return values:Returns the resulting delimited stringfunction HTMLValues2(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String;Gathers all values from a given text into a string using ValDelim as delimiter. The function searches for ABegin first starting from Pos, from this point it gathers values between ItemBegin followed with ">" character and ItemEnd until AEnd is found. The last position is returned in Pos variable.Parameters:HTML text to processABegin substring where the values start (header)ItemBegin substring that precedes each single valueItemEnd substring that follow each single valueValDelim delimiter to use in a resulting string[in] Pos from which position in text should the search start (will contain the position of AEnd after execution)Return values:Returns the resulting delimited stringfunction TextBetween(const HTML : String; ABegin, AEnd : String; doLineBreaks : Boolean; var Pos : Integer) : String;Extracts a part of a give between ABegin and AEnd and removes all tags from the resulting substring.Parameters:HTML text from which to extract the substringABegin substring that precedes the needed substringAEnd substring that follows the needed substringdoLineBreaks set to true if you want the <br> tag to be replaced with carriage return character[in] Pos from which position in text should the search start (will contain the position of AEnd after execution)Return values:Returns the resulting substring without tags.function HTMLToText(const HTML : String) : String;Replaces all escaped HTML characters (like <>&") with normal characters (like <, >,$, ").function ConvertEncoding(const HTML : AnsiString; CP : Cardinal) : String;Decodes a given string from a certain encoding.Parameters:HTML text to decodeCP code page to use (referee to this document for a list of a list of code pages: http://msdn.microsoft.com/en-us/library/dd317756%28VS.85%29.aspx)Return values:Returns the decoded string.File functions: « »function FileExists(const AFileName : String) : Boolean;Checks if a specified file exists.function ChangeFileExt(const AFileName : String; const Ext : String) : String;Changes file extension.Parameters:AFileName file nameExt new extension with preceding pointReturn values:Returns the file name with a new extension.function FileToString(const AFileName : String) : String;Loads a specified file and returns it as a single string.procedure StringToFile(const AFileName : String; const AData : String; const DoAppend : Boolean; const UTF8 : Boolean);Writes a string to a file.Parameters:AFileName target file nameAData string to writeDoAppend set to true if you want to append the string to the end of the file, otherwise the file will be cleared before writingUTF8 set to true if you want the string to be encoded in UTF8function GetAppPath : String;Returns the path where main application files are located.function GetDBPath : String;Returns the path of the current database without file name.Date and Time functions: « »function CurrentDateTime : Extended;Returns current date and time.function DateToStr(Value : Extended) : String;Converts date to a textual representation using regional settings.function TimeToStr(Value : Extended) : String;Converts time to a textual representation using regional settings.function EncDate(Year, Month, Day : Word): Extended;Encodes date from given parameters.function EncTime(Hour, Min, Sec : Word): Extended;Encodes time from given parameters.procedure DecdTime(const Time : Extended; var Hour, Min, Sec : Word);Extracts the hour, minutes, seconds values from a time value.procedure DecdDate(const Date : Extended; var Year, Month, Day : Word);Extracts the year, month, day values from a date value.function StrToDateW(const S : String): Extended;Converts a textual representation of date into a date value using regional settings.function StrToTimeW(const S : String): Extended;Converts a textual representation of time into a time value using regional settings.Miscellaneous functions: « »procedure LogMessage(const Msg : String);Writes a message string to main application's log. (see Debugging scripts)procedure ShowMessage(const Msg, Head : String);Shows a message box with OK button.Parameters:Msg message textHead message box titlefunction MessageBox(const Msg, Head : String; Buttons : Cardinal) : Cardinal;Shows a message box with specified buttons.Parameters:Msg message textHead message box titleButtons buttons to show on the message boxPossible values for Buttons parameter:0 OK1 OK, Cancel2 Abort, Retry, Ignore3 Yes, No, Cancel4 Yes, No5 Retry, CancelReturn values:Returns the identifier of the clicked button. Possible values are:1 OK2 Cancel3 Abort4 Retry5 Ignore6 Yes7 Noprocedure FileExecute(const AFileName : String; const Params : String);Opens a specified file with the application associated with its file type or starts another application if an executable file is specified.Parameters:AFileName file to open or executeParams command line parameters to pass with the fileprocedure Wait(AMilliseconds : Cardinal);Pause script execution for a specified number of milliseconds.Field identifiers: « »Movie Information Fieldsnum Movie IDtitle Titleorigtitle Original Titleaka Also Known As (separated with line break)year Yeargenre Genre (comma separated list)country Country (comma separated list)studio Studio (comma separated list)release Releasempaa MPAAlocation Media Locationcategory Category (comma separated list)tagline Tagline (multiline)description Description (multiline)count Media Counttype Media Typerating Ratingimdbrating IMDB Ratingorating Additional Ratingorname Additional Rating Namerip Qualitylength Durationlangs Language (comma separated list)translation Translation (comma separated list)resolution Resolutionvideocodec Video Codecvideobitrate Video Bitrateaudiocodec Audio Codec (comma separated list)audiobitrate Audio Bitrate (comma separated list)audiocount Number of audio streamssampling Audio stream sampling (comma separated list)channels Audio stream channels count (comma separated list)rdate Release Datebudget Budgetmoney Box Officeaspect Aspect Ratiosize File Sizeurl URL (separated with space)path File Path (files separated with |)comment Comment (multiline)dateadded Date Addedcode Barcodemedialabel Media Label (comma separated list)loan Is Borrowed (Boolean)subs Subtitles (comma separated list)framerate Frame Ratefeatures Features (multiline)viewed Seen (Boolean)bookmark Bookmarked (Boolean)wish Wish (Boolean)viewdate View Datetags Tags (comma separated list)origlang Original Languageposter Posterscreenshots Screenshotsfroncover Front Covercdcover Disc CoverPeople Information Fieldsname Nametransname Translated Namealtnames Alternative Names (comma separated list)birthday Birthdaybirthplace Birthplacebookmark Bookmarked (Boolean)bio Biography (multiline)comment Comment (multiline)death Date of Deathage Ageurl URL (separated with space)genre Genre (comma separated list)dateadded Date Addedphoto PhotoDebugging the script (check for errors): « Before you can tell the script is ready you must test it first. Start PVD with -debug command line parameter, like this: viddb.exe -debug.When you do this an additional menu item will become visible in "Help" menu called "Log".In the log you can track following information: * what plugins are loaded by PVD * what scripts are compiled and executed * what errors were found while compiling a script * what URLs are downloaded by PVD * see log messages from your script (added using LogMessage procedure)If a script is wrong (contains errors) it will not be loaded into the program, so it cannot be selected from the "Import" menu or visible in Tools -> Preferences -> Plugins.If an error has acquired while compiling a script, an error message appears in the log with detailed information about the wrong line in the script code and type of an error.Ex.: [Error] (366:2): Semicolon (';') expectedSometimes you can find hints produced by script compiler. Those hints tell you of unused variables, lines of code that are superficial etc.Ex.: [Hint] (368:2): Variable 'TEST' never usedIf a script can be compiled but does not work as it should you could use the ShowMessage, LogMessage and StringToFile functions to output variable values or some other useful information, so you get a better picture of what is really happening in the script.The last page downloaded is saved into a file called page.html in the program directory while in -debug mode.Last update: 23.04.2010Personal Video Database Version 0.9.9.20Script Engine Plugin 0.2.6.0Author: Nostradamushttp://www.videodb.info
Personal Video Database Skin Engine Manual * File Structure * Attributes * Field definitions and types * Special controlsFile structure: » <pvd_skin_movie> <pvd_skin_person>Skin information<skinname> Name of the skin </skinname><version> Version Number </version><author> Name of the author </author><description> Short description of the skin </description><preview> Relative path to a preview image (all common image formats) </preview><stars> Relative path to star images for rating controls (BMP only) </stars><btns> Relative path to button images (BMP only) </btns>Skin defaults<labelfont> Default font for all field labels </labelfont><fieldfont> Default font for all field controls </fieldfont><color> Default background color </color><linkdefs><linkcolor_record> Default color for a record link (record is not visible in database) </linkcolor_record><linkcolor_visrecord> Default color for a record link (record is visible in database) </linkcolor_visrecord><linkcolor_memo> Default color for links in Link Memo controls </linkcolor_memo><linkcolor_combo> Default color for links in Link Check Combo controls </linkcolor_combo><underline_record> Set to true if you want record links to be underlined and to false if not </underline_record><underline_memo> Set to true if you want links in Link Memo controls to be underlined and to false if not </underline_memo><underline_combo> Set to true if you want links in Link Check Combo controls to be underlined and to false if not </underline_combo></linkdefs>Section types (containers) Section <section> Page control <pagecontrol>Custom Section <customsection>Flow Section <screenshots> and <imagelist>Expandable Section <expandsection>Audio Section <astreams> Tab Section <tab><caption> Tab caption</caption><color> Section background color </color><border> Describe section border </border><color> Border color </color> Row <row>Column <column>Controls Labels Field edit controls (see Field definitions and types) AdditionalField Label <fieldlabel> Simple Memo Separator <separator> Sections (see Section types)Custom Field Label <customfieldlabel> Simple Edit Buttons (see Special controls)User Defined Label <label> Expandable Memo Splitter <splitter>Poster count label <postercountlabel> Link Memo Spacer <spacer>Audio stream label <audiostreamlabel> Link Check Combo Video stream label <videostreamlabel> Combo BoxMeasurement labels (MB, GB, Min, etc.) (see Special controls) Check Combo BoxCheck BoxNot editable fields (see Field definitions and types) Rating Stars TreeImage<color> Background color </color>Fonts Font definition <font> <name> Font name </name><size> Font size </size><color> Font color </color><bold/><italic/>Attributes (properties): « »All Sections <section>, <customsection>, <expandsection>, <pagecontrol>, <tab>, <screenshots>, <imagelist>, <astreams>spacing=”X” Top and bottom offset between rows in pixelpermanent=”B” Set this attribute to true if you want the control to always be displayedwidth=”X” Section width in pixels or percent (add percent sign to the value)height=”X” Section height in pixelsFlow Section <screenshots>, <imagelist>cwidth=”X” Maximum width of an item in a section in pixelcheight=”X” Maximum height of an item in a section in pixelBorder <border>width=”X” Border thickness in pixelshape=”C” Shape of the border. Possible values: rect, roundrect, ellipseRow <row>width=”X” Row width in pixelsheight=”X” Row height in pixelsColumn <column> width=”X” Column width in pixels or percent (add percent sign to the value)height=”X” Column height in pixelsspacing=”X” Left and right offset between columns in pixelautosize=”B” Set to true if column width should be calculated according to controls it containshalign=”C” Horizontal alignment of all controls in the column. Possible values: left, center, rightvalign=”C” Vertical alignment of all controls in the column. Possible values: top, center, bottomimgctrlcol=”B” Set to true if the column contains special image buttons (next, prev, add, count)All Labels <label>, <fieldlabel>, <customfieldlabel>, <postercountlabel>, <videostreamlabel>, <videodatalabel>, <audiostreamlabel>, <audiodatalabel>, <sizelabel>, <lengthlabel>, <fpslabel>, <hzlabel>, <kbpslabel>width=”X” Label width in pixelsmaxwidth=”X” Maximum label width in pixelsminwidth=”X” Minimum label width in pixelsmaxheight=”X” Maximum label height in pixelsminheight=”X” Minimum label height in pixelshalign=”C” Horizontal alignment of the text inside the label. Possible values: left, center, rightvalign=”C” Vertical alignment of the text inside the label. Possible values: top, center, bottomwordwrap=”B” Set to true if the text in the label should wrap to the next line if it does not fit.permanent=”B” Set this attribute to true if you want the control to always be displayedField Label <fieldlabel>, Custom label <customfieldlabel>field=”S” Name of the fieldField Label <fieldlabel>human=”X” Must be used instead of field attribute. Defines which type of credits to show. Possible values: 0 – Actors, 1 – Directors, 2 – Writers, 3 – Composers, 4 - ProducersSplitter <splitter>width=”X” Splitter width in pixelsSeparator <separator>width=”X” Separator width in pixelsheight=”X” Separator height in pixelsSpacer <spacer>width=”X” Spacer width in pixelsheight=”X” Spacer height in pixelsImages <poster>, <photo>, <froncover>, <cdcover>permanent=”B” Set this attribute to true if you want the control to always be displayedautosize=”B” Set to true if column width should be calculated according to image it containsstretch=”B” Set to true if you want the image to fill all the space availabletransparent=”B” Set to true if the color from the upper left corner of the image should be transparentTrees <awards>, <links>, <filmography>permanent=”B” Set this attribute to true if you want the control to always be displayedwidth=”X” Tree width in pixelsSimple Editswidth=”X” Width in pixelsautosize=”B” Set to true if control width should be calculated according to text it containsSimple Memopermanent=”B” Set this attribute to true if you want the control to always be displayedhalign=”C” Horizontal alignment of the text in the control. Possible values: left, center, rightExpandable Memowidth=”X” Control width in pixelsheight=”X” Control height in pixelspermanent=”B” Set this attribute to true if you want the control to always be displayedhalign=”C” Horizontal alignment of the text in the control. Possible values: left, center, rightcollapsedlines=”X” Number of lines that should be visible when the control is collapsedLink Memowidth=”X” Control width in pixelsheight=”X” Control height in pixelspermanent=”B” Set this attribute to true if you want the control to always be displayedhalign=”C” Horizontal alignment of the text in the control. Possible values: left, center, rightcollapsedlines=”X” Number of lines that should be visible when the control is collapsedvalsperline=”X” Number of separate values that should be shown on one linelinkcolor1=”X” Color of separate valueslinkcolor2=”X” Color of a “visited” or “visible” value. (only applicable to record values line names or titles)Link Check Combowidth=”X” Control width in pixelsheight=”X” Control height in pixelspermanent=”B” Set this attribute to true if you want the control to always be displayedvalsperline=”X” Number of separate values that should be shown on one linelinkcolor1=”X” Color of separate valueslinkcolor2=”X” Color of a “visited” or “visible” value. (only applicable to record values line names or titles)Check Combo Box, Combo Boxwidth=”X” Control width in pixelsheight=”X” Control height in pixelspermanent=”B” Set this attribute to true if you want the control to always be displayedRating Starswidth=”X” Control width in pixelsheight=”X” Control height in pixelspermanent=”B” Set this attribute to true if you want the control to always be displayedmaxvalue=”X” Defines the maximum value accepted by the controlprecision=”X” Defines how the rating is incremented when you hover over stars with a mouse. Possible values: 1 - 0.1, 2 - 0.2, 5 - 0.5, 10 - 1mode=”X” Defines how the rating is visualized. Possible values: 0 - Edit box and stars, 1 - Stars, 2 - Edit boxCheck Boxpermanent=”B” Set this attribute to true if you want the control to always be displayedField definitions and types: « »Control Features FieldsSimple Memo multiline File Path <path>Simple Edit single line Title <title>, Original Title <origtitle>, ID <num>, Year <year>, Release <release>, Media Count <mediacount>, Duration <length>, Resolution <resolution>, Video Bitrate <videobitrate>, Audio Bitrate <audiobitrate>, Audio Sampling <sampling>, Audio Channels <channels>, Release date <rdate>, Budget <budget >, Box Office <money>, File Size <size>, Date Added <dateadded>, Barcode <barcode>, Media Label <medialabel>, Frame Rate <framerate>, Video Sampling <sampling>, Custom Short Text, Custom Long Text, Custom Number, Custom Real Number <custom field=”S”>Name <name>, Translated Name <transname>, Birthday <birthday>, Birthplace <birthplace>, Date of Death <death>Expandable Memo multiline, expand/collapse Also know as <aka>, MPAA <mpaa>Alternative Names <altnames>Link Memo multiline, expand/collapse, clickable text values Actors <human category="0">, Directors <human category="1">, Writers <human category="2">, Composers <human category="3">, Producers <human category="4">, Tags <tags>, URL <url>, Studio <studio>, Tagline <tagline>, Description <description>, Comment <comment>, Features <features>, Custom Memo <custom field=”S”>Biography <bio>Link Check Combo multiline, expand/collapse, clickable text values, combo box with checks in edit mode Genre <genre>, Country <country>, Category <category>Genre <genre>Combo Box single line, combo box in edit mode Media Location <location>, Media Type <type>, Quality <rip>, Translation <translation>, Video Codec <videocodec>, Audio Codec <audiocodec>, Language <langs>, Original Language <origlang>Check Combo Box single line, combo box with checks in edit mode Subtitles <subtitles>, Custom Select List, Custom Multi Select List <custom field=”S”>Rating Stars single line edit box with stars Rating <rating>, Additional Rating <orating>, IMDB Rating <imdbrating>, Custom Rating <custom field=”S”>Rating <rating>Check Box a simple check box Seen <viewed>, Wish <wish>>, Custom Check Box <custom field=”S”>Label just text (can not be edited or selected) Additional Rating Name <orname>, Loaned to <loanname>, Date Modified <moddate>Age <age>, Date Modified <moddate>Tree tree view Connections <links>, Awards <awards>Filmography <filmography>, Awards <awards>Image draws an image Poster <poster>, Front Cover <froncover>, Disc Scan <cdcover>Photo <photo>Flow Section controls are placed in rows; rows are filled sequentially. Poster List <imagelist>, Screenshots <screenshots>Photo List <imagelist>Audio Section control used for audio streams, contains multiple expandable sections each representing an audio stream. Audio Streams <astreams>Special controls: « Buttons<shopbtn> Search in shop (visible only in wish movies)<shopselbtn> Select shop (visible only in wish movies)<prevposterbtn> Previous poster<nextposterbtn> Next poster<addposterbtn> Add poster<browsebtn> Select file(s)<delstreambtn> Delete audio stream<addstreambtn> Add audio streamLabels<postercountlabel> Poster count label<sizelabel> File size measurement (MB/GB) depending on size format settings<lengthlabel> Duration measurement depending on duration format settings<fpslabel> Frame rate measurement<hzlabel> Sampling measurement label<kbpslabel> Bitrate measurement labelLast update: 10.05.2010Personal Video Database Version 0.9.9.20Author: Nostradamushttp://www.videodb.info