Author Topic: Manuals!  (Read 28253 times)

0 Members and 1 Guest are viewing this topic.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Manuals!
« on: April 25, 2010, 06:14:34 am »
The following material is now on the Help board...




Please ignore the following posts. Their sole purpose is to add the text of the technical manuals to the forum search engine. If they show up in search results, they may be used to access the manual via this topic.
« Last Edit: October 01, 2010, 06:00:50 am by rick.ca »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Export Templates Manual
« Reply #1 on: September 15, 2010, 06:53:28 am »
Text of Export Templates Manual—for forum search.

Code: [Select]
 Personal Video Database Export Templates Manual

    * File Structure
    * Template Options
    * Special Values
    * Movie Values
    * Person Values
    * Field Parameters
    * Subtemplates
    * Functions

File structure: »
Main Template
%OPTIONS%
encoding=”S” Defines encoding of the resulting file. Possible values are: UTF8, UTF8BOM, ANSI
sortby=”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, sdDescending
recordtemplate=”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 extension
imagepath=”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 extension
copyfile="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 extension
fullstar=”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 extension
halfstar=”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 extension
nonestar=”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 extension
itemsperpage=”X” Defines the number of records exported to one page. Each page will be saved in separate file with following naming format: filenamepagenumber.extension
filter=”S” File filter used in "Save as" dialog. Format: File Type Name|*.extension1;*.extension2;...;*.extensionN
recordfilename=”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 extension
pagestpl=”S” Defines the path to a template for generating a list of pages relative to main template file
prevtpl=”S” Defines the path to a template used in Page Template to create a link to a previous page relative to main template file
nexttpl=”S” Defines the path to a template used in Page Template to create a link to a next page relative to main template file
pagelinktpl=”S” Defines the path to a template used in Page Template to create a link to a certain page number relative to main template file
pagecurtpl=”S” Defines the path to a template used in Page Template to output current page number relative to main template file
replace=”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#10
boolvals=”TrueValue<->FalseValue” Defines strings that should be used for Boolean field values
replacecase=” value1<->value2” Same as replace, but case sensitive
nearfiles=”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 id
imagenameformat=”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 Templates
Header Page Template Footer
You 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 Values
200 Total records count
201 Total pages count
202 Current page number
203 Current record number
204 Path to the database file (including file name)
205 Database name
206 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 template
212 Inserts list of page numbers using Page Templates
213 Insert previous page template
214 Insert next page template
215 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 page
219 Path to the first page
220 Path to the index file for the current record
221 Path to the last page
222 Path to the previous page
223 Path to the next page
224 Path to the current record's file
225 Path to the current record's file
226 Path to the next record's file
227 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 date
232 Current time
233 Selected file name (without extension)
234 Selected file extension
300 IMDB ID (retrieved from URL)
301 Video Width (Movies only)
302 Video Height
Field Values (Movie)
Identifier Field Parameters
mid Database Record ID
num Movie ID
title Title
origtitle Original Title
aka Also Known As (separated with line break) template, maxvalues
year Year
genre Genre (comma separated list) template, maxvalues
country Country (comma separated list) template, maxvalues
studio Studio (comma separated list) template, maxvalues
release Release
mpaa MPAA
location Media Location
category Category (comma separated list) template, maxvalues
tagline Tagline (multiline)
description Description (multiline)
count Media Count
type Media Type
rating Rating template
imdbrating IMDB Rating template
orating Additional Rating template
orname Additional Rating Name
rip Quality
length Duration format
langs Language (comma separated list) template, maxvalues
translation Translation (comma separated list) template, maxvalues
resolution Resolution
videocodec Video Codec
videobitrate Video Bitrate
audiocodec Audio Codec (comma separated list) template, maxvalues
audiobitrate Audio Bitrate (comma separated list) template, maxvalues
audiocount Number of audio streams
sampling Audio stream sampling (comma separated list) template, maxvalues
channels Audio stream channels count (comma separated list) template, maxvalues
rdate 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, maxvalues
comment Comment (multiline)
dateadded Date Added
moddate Date Modified
code Barcode
medialabel Media Label (comma separated list) template, maxvalues
loan Is Borrowed (Boolean)
subs Subtitles (comma separated list) template, maxvalues
framerate Frame Rate
features Features (multiline)
viewed Seen (Boolean)
bookmark Bookmarked (Boolean)
wish Wish (Boolean)
series Is Series (Boolean)
episodes Episodes template, grouptemplate
visible Visible (Boolean)
loandate Loan Date
loanname Borrowed to
loanperiod Load Period
email Borrowed to (Email)
viewdate View Date
tags Tags (comma separated list) template, maxvalues
awards Awards template, grouptemplate
links Connections template, grouptemplate
astreams Audio Streams template, grouptemplate
origlang Original Language
extension Video File Extension
actors Actors template, maxvalues, params
directors Directors template, maxvalues, params
writers Writers template, maxvalues, params
composers Composers template, maxvalues, params
producers Producers template, maxvalues, params
credits Credits template, grouptemplate
poster Poster template, maxvalues, params, width, height
screenshots Screenshots template, maxvalues, params, width, height
froncover Front Cover template, params, width, height
cdcover Disc Cover template, params, width, height
CustomFieldName Custom Field custom
Field Values (Person)
Identifier Field Parameters
pid Database Record ID
name Name
transname Translated Name
altnames Alternative Names (comma separated list) template, maxvalues
birthday Birthday
birthplace Birthplace
bookmark Bookmarked (Boolean)
visible Visible (Boolean)
bio Biography (multiline)
filmography Filmography template, grouptemplate
comment Comment (multiline)
death Date of Death
age Age
url URL (separated with space) template, maxvalues
genre Genre (comma separated list) template, maxvalues
dateadded Date Added
moddate Date Modified
careertype Career Type (comma separated list) template, maxvalues
awards Awards template, grouptemplate
photo Photo template, maxvalues, params, width, height
Parameters {%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 field
maxvalues Maximum values count for fields with multiple values
width 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:SS
custom Set to true if you want to retrieve a custom field value
SubTemplates
{%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, role
Links mid – Database record id, linktype – Link Category, linkname – Link Name , num – Movie ID, title, origtitle, year, imdbrating, rating, description, url
Awards event, year, result, award, category
Episodes epid – Database episode id, mid – Database record id, epnum – Episode Number, season – Season Number, num – Episode Movie ID, title, origtitle, year, imdbrating, rating, description, url
Credits ctype – Credits Type: 0 – Actors, 1 – Directors, 2 – Writers, 3 – Composers, 4 - Producers, pid – Database record id, name, transname, url, role
Filmography 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, url
Posters, 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 saved
Functions: «  
Syntax: {#Function Name Parmeters separated by space, quote character is '}
Function Description Example
ExtractFilePath 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.txt
ExtractFileExt Extracts extension from filename (or full file path) {#ExtractFileExt 'C:\test.txt'}
Result: .txt
ConditionAdd 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 Media
ConditionAddFirst 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 Label
StringReplace Replaces a part of a string with another string {#StringReplace '{%value=wish}' '0' 'no'}
Replace 0 with no in Wish field

Last update: 19.08.2010
Personal Video Database Version 0.9.9.20
Plain Text Export Plugin 0.7.1.0
Author: Nostradamus
http://www.videodb.info

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Scripting Manual
« Reply #2 on: September 15, 2010, 07:06:32 am »
Text of Scripting Manual—for forum search (part 1 of 2).

Code: [Select]
  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 script

Obligatory 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.build
function 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] Test
function 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 Test
function 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 script
1     people information script
2     poster download
3     screenshots download
4     covers download
function 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 fields
function 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.

+ Example

If 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_STR

If 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 page
URL     contains the address of the page


Possible return values are:
0     an error acquired while processing data
1     script has finished gathering data
2     a list of search results is available
3     a list of image search results is available
4     another URL needs to be downloaded


+ Example
The 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 result

a. Determine what information does this page contain
It'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 begin

b. Set the mode variable
Mode := 1;

c. Parse HTML and set information fields
ParseMovie(URL, HTML); //This is a helper procedure to make the code better readable.

d. Return an appropriate result
Result := 1; //script has finished its job

The 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 job
end;

I recommend you to create a helper procedure to parse each page type. Ex.:
procedure ParseSearchResults(HTML : String); //parse search results
procedure ParseMovie(HTML : String); //parse main movie information
procedure ParseCredits(HTML : String); //parse movie credits

The 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 retrieved
end 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 job
end 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.aspx
procedure 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 page
Params     receives parameters that will be passed to the login page using POST method
function GetDownloadMethod : Byte;

Defines method to be used to pass parameters in the last URL returned in GetDownloadURL function.

Possible return values are:
0     GET
1     POST
function 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 nothing
1     move prefixes to the end of the title
2     place prefixes at the beginning of the title
3     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 exception
Msg     error message
function 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 cover
1     disc image
Functions 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 URL

Parameters:
Title1     title or name
Title2     original title or translated name
Year     movie release year
URL     address containing record information
PreviewURL     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 identifier
AValue     value for the field


Possible values for AField variable:
Movies     People
0     url     0     url
1     title     1     name
2     original title     2     translated name
3     also known as     3     alternative names
4     year     4     date of birth
5     genre     5     place of birth
6     category     6     genre
7     country     7     biography
8     studio     8     date of death
9     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 image
AValue     address of the image


Possible values for AImageType variable:
0     poster
1     screenshot
2     front cover
3     disc image
4     photo
procedure AddFieldValueXML(AField : String; AValue : String);

Fill a certain field with a value. The field is identified by a string identifier.

Parameters:
AField     field identifier
AValue     value for the field


Possible values for AField variable: See Field Identifiers
procedure AddCustomFieldValueByNumber(CustomNumber : Integer; AValue : String);

Fill a certain custom field with a value. The field is identified its number.

Parameters:
CustomNumber     field number
AValue     value for the field
procedure AddCustomFieldValueByName(CustomName : String; AValue : String);

Fill a certain custom field with a value. The field is identified its name.

Parameters:
CustomName     field name
AValue     value for the field
procedure AddMoviePerson(Name, TransName, Role, URL : String; const AType : Byte);

Adds movie credits (actor, director, etc.).

Parameters:
Name     name of the person
TransName     translated name of the person
Role     role of the person (if applicable)
URL     web address of the person (if available)
AType     credits type


Possible values for AType variable:
0     actor
1     director
2     writer
3     composer
4     producer
procedure AddPersonMovie(Title, OrigTitle, Role, Year, URL : String; AType : Byte);

Adds a movie to person's filmography.

Parameters:
Title     movie title
OrigTitle     original movie title
Role     role of the person in the movie (if applicable)
Year     release year of the movie
URL     web address of the movie (if available)
AType     credits type

Possible values for AType variable:
0     actor
1     director
2     writer
3     composer
4     producer
procedure AddAward(Event, Award, Category, Recipient, Year : String; const Won : Boolean);

Adds an award to a record.

Parameters:
Event     name of the event
Award     award name
Category     award category
Recipient     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 award
Year     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 otherwise
procedure 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 event
Award     award name
Category     award category
RecipientVal1     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 award
RecipientVal2     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 award
Year     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 otherwise
procedure AddConnection(Title, OrigTitle, Category, URL, Year : String);

Adds a movie connection.

Parameters:
Title     movie title
OrigTitle     original movie title
Category     category connection
URL     web address of the movie (if available)
Year     release year of the movie
procedure AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode : String);

Adds an episode to a series.

Parameters:
Title     episode title
OrigTitle     original episode title
Description     episode description
URL     web address of the episode (if available)
Year     release year of the episode
Season     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 identifier
function GetFieldValueXML(AField : String) : String;

Use this function to retrieve a field value from a record.

Parameters:
AField     field identifier


Possible values for AField variable: See Field Identifiers
function 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 field
function 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 identifier
function GetSeriesFieldValueXML(AField : String) : String;

Use this function to retrieve a field value from a series record of an episode.

Parameters:
AField     field identifier


Possible values for AField variable: See Field Identifiers
function 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 field
function 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.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Scripting Manual
« Reply #3 on: September 15, 2010, 07:08:13 am »
Text of Scripting Manual—for forum search (part 2 of 2).

Code: [Select]
Parameters:
CustomName     name of a custom field
String 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 for
Str     where to search


Return 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 for
Str     where to search
FromIndex     where to start searching


Return 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 for
Str     where to search


Return 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 for
Str     where to search
APos     where to start searching

Return 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 removed
doLineBreaks     set to true if you want the <br> tag to be replaced with carriage return character


Return 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 contained
Delimiters     a string containing allowed delimiters, one character each, without separator


Return values:
Returns number of produced values
function 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 extracted
Index     starting index of the substring
Count     number of characters to extract


Return values:
Returns the resulting substring
procedure Delete(var S : String; Index, Count : Integer);

Removes a part of a string.

Parameters:
[in] S     string from which to delete characters
Index     where to start deletion
Count     number of characters to remove
procedure Insert(Source : String; var Dest : String; Index : Integer);

Inserts a string into another string.

Parameters:
Source     what to insert
[in] Dest     destination string
Index     where to insert the string
function 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 place
OldPattern     substring to replace
NewPattern     substring to replace with
ReplaceAll     if set to false only the first occurrence will be replaced
IgnoreCase     if set to false the search for OldPattern will be case sensitive
WholeWord     search only for whole words


Return values:
Returns the resulting substring
function 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 process
ABegin     substring where the values start (header)
ItemBegin     substring that precedes each single value
ItemEnd     substring that follow each single value
ValDelim     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 string
function 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 process
ABegin     substring where the values start (header)
ItemBegin     substring that precedes each single value
ItemEnd     substring that follow each single value
ValDelim     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 string
function 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 substring
ABegin     substring that precedes the needed substring
AEnd     substring that follows the needed substring
doLineBreaks     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 &lt;&gt;&amp;&quot;) with normal characters (like <, >,$, ").
function ConvertEncoding(const HTML : AnsiString; CP : Cardinal) : String;

Decodes a given string from a certain encoding.

Parameters:
HTML     text to decode
CP     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 name
Ext     new extension with preceding point


Return 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 name
AData     string to write
DoAppend     set to true if you want to append the string to the end of the file, otherwise the file will be cleared before writing
UTF8     set to true if you want the string to be encoded in UTF8
function 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 text
Head     message box title
function MessageBox(const Msg, Head : String; Buttons : Cardinal) : Cardinal;

Shows a message box with specified buttons.

Parameters:
Msg     message text
Head     message box title
Buttons     buttons to show on the message box


Possible values for Buttons parameter:
0     OK
1     OK, Cancel
2     Abort, Retry, Ignore
3     Yes, No, Cancel
4     Yes, No
5     Retry, Cancel


Return values:
Returns the identifier of the clicked button. Possible values are:
1     OK
2     Cancel
3     Abort
4     Retry
5     Ignore
6     Yes
7     No
procedure 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 execute
Params     command line parameters to pass with the file
procedure Wait(AMilliseconds : Cardinal);

Pause script execution for a specified number of milliseconds.
Field identifiers:     « »
Movie Information Fields
num     Movie ID
title     Title
origtitle     Original Title
aka     Also Known As (separated with line break)
year     Year
genre     Genre (comma separated list)
country     Country (comma separated list)
studio     Studio (comma separated list)
release     Release
mpaa     MPAA
location     Media Location
category     Category (comma separated list)
tagline     Tagline (multiline)
description     Description (multiline)
count     Media Count
type     Media Type
rating     Rating
imdbrating     IMDB Rating
orating     Additional Rating
orname     Additional Rating Name
rip     Quality
length     Duration
langs     Language (comma separated list)
translation     Translation (comma separated list)
resolution     Resolution
videocodec     Video Codec
videobitrate     Video Bitrate
audiocodec     Audio Codec (comma separated list)
audiobitrate     Audio Bitrate (comma separated list)
audiocount     Number of audio streams
sampling     Audio stream sampling (comma separated list)
channels     Audio stream channels count (comma separated list)
rdate     Release Date
budget     Budget
money     Box Office
aspect     Aspect Ratio
size     File Size
url     URL (separated with space)
path     File Path (files separated with |)
comment     Comment (multiline)
dateadded     Date Added
code     Barcode
medialabel     Media Label (comma separated list)
loan     Is Borrowed (Boolean)
subs     Subtitles (comma separated list)
framerate     Frame Rate
features     Features (multiline)
viewed     Seen (Boolean)
bookmark     Bookmarked (Boolean)
wish     Wish (Boolean)
viewdate     View Date
tags     Tags (comma separated list)
origlang     Original Language
poster     Poster
screenshots     Screenshots
froncover     Front Cover
cdcover     Disc Cover


People Information Fields
name     Name
transname     Translated Name
altnames     Alternative Names (comma separated list)
birthday     Birthday
birthplace     Birthplace
bookmark     Bookmarked (Boolean)
bio     Biography (multiline)
comment     Comment (multiline)
death     Date of Death
age     Age
url     URL (separated with space)
genre     Genre (comma separated list)
dateadded     Date Added
photo     Photo
Debugging 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 (';') expected

Sometimes 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 used

If 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.2010
Personal Video Database Version 0.9.9.20
Script Engine Plugin 0.2.6.0
Author: Nostradamus
http://www.videodb.info

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Skin Engine Manual
« Reply #4 on: September 15, 2010, 07:12:26 am »
Text of Skin Engine Manual—for forum search.

Code: [Select]
  Personal Video Database Skin Engine Manual

    * File Structure
    * Attributes
    * Field definitions and types
    * Special controls

File 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) Additional
Field 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 Box
Measurement labels (MB, GB, Min, etc.) (see Special controls) Check Combo Box
Check Box
Not editable fields (see Field definitions and types) Rating Stars
  Tree
Image
<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 pixel
permanent=”B” Set this attribute to true if you want the control to always be displayed
width=”X” Section width in pixels or percent (add percent sign to the value)
height=”X” Section height in pixels
Flow Section <screenshots>, <imagelist>
cwidth=”X” Maximum width of an item in a section in pixel
cheight=”X” Maximum height of an item in a section in pixel
Border <border>
width=”X” Border thickness in pixel
shape=”C” Shape of the border. Possible values: rect, roundrect, ellipse
Row <row>
width=”X” Row width in pixels
height=”X” Row height in pixels
Column <column>
width=”X” Column width in pixels or percent (add percent sign to the value)
height=”X” Column height in pixels
spacing=”X” Left and right offset between columns in pixel
autosize=”B” Set to true if column width should be calculated according to controls it contains
halign=”C” Horizontal alignment of all controls in the column. Possible values: left, center, right
valign=”C” Vertical alignment of all controls in the column. Possible values: top, center, bottom
imgctrlcol=”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 pixels
maxwidth=”X” Maximum label width in pixels
minwidth=”X” Minimum label width in pixels
maxheight=”X” Maximum label height in pixels
minheight=”X” Minimum label height in pixels
halign=”C” Horizontal alignment of the text inside the label. Possible values: left, center, right
valign=”C” Vertical alignment of the text inside the label. Possible values: top, center, bottom
wordwrap=”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 displayed
Field Label <fieldlabel>, Custom label <customfieldlabel>
field=”S” Name of the field
Field 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 - Producers
Splitter <splitter>
width=”X” Splitter width in pixels
Separator <separator>
width=”X” Separator width in pixels
height=”X” Separator height in pixels
Spacer <spacer>
width=”X” Spacer width in pixels
height=”X” Spacer height in pixels
Images <poster>, <photo>, <froncover>, <cdcover>
permanent=”B” Set this attribute to true if you want the control to always be displayed
autosize=”B” Set to true if column width should be calculated according to image it contains
stretch=”B” Set to true if you want the image to fill all the space available
transparent=”B” Set to true if the color from the upper left corner of the image should be transparent
Trees <awards>, <links>, <filmography>
permanent=”B” Set this attribute to true if you want the control to always be displayed
width=”X” Tree width in pixels
Simple Edits
width=”X” Width in pixels
autosize=”B” Set to true if control width should be calculated according to text it contains
Simple Memo
permanent=”B” Set this attribute to true if you want the control to always be displayed
halign=”C” Horizontal alignment of the text in the control. Possible values: left, center, right
Expandable Memo
width=”X” Control width in pixels
height=”X” Control height in pixels
permanent=”B” Set this attribute to true if you want the control to always be displayed
halign=”C” Horizontal alignment of the text in the control. Possible values: left, center, right
collapsedlines=”X” Number of lines that should be visible when the control is collapsed
Link Memo
width=”X” Control width in pixels
height=”X” Control height in pixels
permanent=”B” Set this attribute to true if you want the control to always be displayed
halign=”C” Horizontal alignment of the text in the control. Possible values: left, center, right
collapsedlines=”X” Number of lines that should be visible when the control is collapsed
valsperline=”X” Number of separate values that should be shown on one line
linkcolor1=”X” Color of separate values
linkcolor2=”X” Color of a “visited” or “visible” value. (only applicable to record values line names or titles)
Link Check Combo
width=”X” Control width in pixels
height=”X” Control height in pixels
permanent=”B” Set this attribute to true if you want the control to always be displayed
valsperline=”X” Number of separate values that should be shown on one line
linkcolor1=”X” Color of separate values
linkcolor2=”X” Color of a “visited” or “visible” value. (only applicable to record values line names or titles)
Check Combo Box, Combo Box
width=”X” Control width in pixels
height=”X” Control height in pixels
permanent=”B” Set this attribute to true if you want the control to always be displayed
Rating Stars
width=”X” Control width in pixels
height=”X” Control height in pixels
permanent=”B” Set this attribute to true if you want the control to always be displayed
maxvalue=”X” Defines the maximum value accepted by the control
precision=”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 - 1
mode=”X” Defines how the rating is visualized. Possible values: 0 - Edit box and stars, 1 - Stars, 2 - Edit box
Check Box
permanent=”B” Set this attribute to true if you want the control to always be displayed
Field definitions and types: « »
Control Features Fields
Simple 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 stream
Labels
<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 label

Last update: 10.05.2010
Personal Video Database Version 0.9.9.20
Author: Nostradamus
http://www.videodb.info

 

anything