Personal Video Database
English => Development => Topic started by: firefox on October 20, 2013, 05:23:53 pm
-
Hello,
Many thanks for the great program.
I've started to write an import script for japanese site (EUC-JP encoding) and I've noticed a strange thing.
I cannot use japanese character in PosFrom.
Os: Windows 8, PVD 1.0.2.6, the script file saved with encoding utf-8.
StartPos := Pos('<table border="0" cellpadding="2" cellspacing="0" class="mg-b20">', HTML);
StartPos := PosFrom('">レーベル:</td>', HTML, StartPos);
Cast := Trim(TextBetween(HTML, '>', '<', False, StartPos));
if Cast <> '----' then
begin
CastURL := BASE_URL + Trim(TextBetween(HTML, 'href="', '"', False, StartPos));
Cast := Trim(TextBetween(HTML, '">', '<', False, StartPos));
LogMessage('writer: '+ Cast +', url: '+ CastURL);
AddMoviePerson(Cast, '', '', CastURL, 2);
end else
LogMessage('writer not found');
-
Make sure to provide a correct code page in GetCodePage function
function GetCodePage : Cardinal;
begin
Result := CODE_PAGE;
end;
-
I provided a code page in GetCodePage function (EUC-JP 20932).
You can search with keyword 'mgod0112' with attached script file.
I use writer item for film series info. The writer item didn't show after running the script.
Thank you for your help!
-
There seem to be multiple problems (the program was never tested with such languages):
1. There is a problem when passing data to the script. I will fix it in next update
2. The pascal script compiler does not accept non ANSI characters. This can't be fixed, unless the pascal script compiler is updated. As a workaround you could try saving values in japanese in a file and load them in runtime. (but the first problem must be fixed for this to work)
-
There seem to be multiple problems (the program was never tested with such languages):
1. There is a problem when passing data to the script. I will fix it in next update
2. The pascal script compiler does not accept non ANSI characters. This can't be fixed, unless the pascal script compiler is updated. As a workaround you could try saving values in japanese in a file and load them in runtime. (but the first problem must be fixed for this to work)
Please give me an example code for saving japanese values in a file and load them in runtime.
Many thanks for your help and PVD v1.0.2.7!
-
To find ">レーベル:</td> from your example do the following:
1. Create a file (for exmple value1.txt) in the "PVD Path\Scripts" directory
2. Put ">レーベル:</td> into the file and save it with UTF8 Encoding with BOM
3. Replace the line where you search for this text with the following line:
StartPos := PosFrom(FileToString(GetAppPath + 'Scripts\value1.txt'), HTML, StartPos);
So the value is replaced with: FileToString(GetAppPath + 'Scripts\value1.txt')
-
Thanks nostra for example code. Finally, the script works well.
Is there any possible way that saving multiple japanese values in one txt file and load them in runtime?
-
You can save multiple values in the same file, load the file to a string and then split it into separate values using String manipulation functions.
-
I finished the script and it runs well.
Many thanks for your help!