Page 1 of 1

Exporting empty files?

Posted: 2008-11-02 17:28:48
by fidoboy
I'm trying to use Ant Movies with XBMC, and i need to create a folder with all my movies in database containing only empty files. For example if i have a movie named "The Movie" i want to create a file named "the movie.avi" and do this for all my database entries. How can i do this?

thanks in advance,

Posted: 2008-11-02 18:24:45
by bad4u
A short script should do the job:

Code: Select all

program export_empty_files;
var
  aList: TStringList;
  value: string;
begin
  aList := TStringList.Create;
  value := GetField(fieldTranslatedTitle);
  value := AnsiLowerCase(value);
  aList.SaveToFile(dirApp + '\export\' + value + '.avi');
  aList.Free;
end.
Script reads field translated title and writes empty files to the folder \export\ within AMC folder. If it does not exists you need to make such folder before you run the script. Script does not check for and will stop if you have special characters on your titles that are not allowed for folder names (like ? : /)

Posted: 2008-11-02 18:41:44
by fidoboy
Many thanks! Another question, how can i export actors from each movie?

I must export to a XML file containing this structure:

sx:=sx+' <actor>'+#13#10;
sx:=sx+' <name>WHATHERE</name>'#13#10;
sx:=sx+' <role></role>'#13#10;
sx:=sx+' </actor>'+#13#10;

I know that i can get the field this way: GetField(fieldActors) but how can i strip the names using a delimiter??

regards,

Posted: 2008-11-02 19:15:12
by bad4u
Did you read the topic viewtopic.php?t=4146 or tried the new XBMC-nfo script ?

Posted: 2008-11-02 19:53:36
by fidoboy
Yes, i'm now using that script, thanks! but i'm trying to improve it, because currently, i can't get the thumbnails for each movie and also i want to know the MediaCode from XBMC to locate my disc (i have each disc labeled with a number)

regards,

Posted: 2008-11-02 21:23:13
by bad4u
Well, Antoine wrote a short function to retrieve actors list to XML format on the topic mentioned above. And on the XMBC script you can see how it works. Script works for actor lists that use linebreak or comma as delimiter, you can change delimiters here:

Code: Select all

lst.Text := StringReplace(actors, ', ', #13#10); 
Simply change that line or add another line for other delimiters (original delimiters have to be replaced by linebreaks).

And you can change the result on line

Code: Select all

s := '   <actor><name>' + lst.GetString(i) + '</name></actor>';
e.g.

Code: Select all

s := '   <actor>' + #13#10 + ' <name>' + lst.GetString(i) + '</name>' + #13#10 + ' <role></role>' + #13#10 + '</actor>';

results in this xml structure:

Code: Select all

 <actor>
 <name>Name</name>
 <role></role>
 </actor>

Posted: 2008-11-02 22:00:26
by fidoboy
Thanks bad4u, do u have any idea about how can i get the media code from XBMC?

regards,

Posted: 2008-11-02 22:13:59
by bad4u
I'm not even sure what media code from XBMC exactly is, as I don't have a XBox.

Posted: 2008-11-03 01:25:19
by fidoboy
Well, actually you can run XBMC on windows, linux or even OSX platform. In fact, i'm running it on windows vista

Posted: 2008-11-03 22:02:59
by bad4u
Interesting, didn't know about that. But nevertheless I don't know anything about XBMC and its media codes ;)