Here's a little script that reads all filenames from a folder and saves them as a list to description or comments field.
There are few options available (delete fields, number media files).
You can run it on a couple of movies at once, so no need to add this to other scripts, I think (though it would be possible).
Restrictions are
1. it will read ALL filenames from the folder, not just a selection (episodes that belong together must be in their own subfolder)
2. it reads the path to the folder from the URL field, so it will not work if you overwrite the URL field with a site URL from another script
Maybe Antoine wants to upload it to the server if it should be useful enough, so that other users have a chance to find it, too.
Code: Select all
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=bad4u
Title=ImportFilenames
Description=Import a list of filenames from a local folder to description or comments field
Site=
Language=EN
Version=1.0
Requires=3.5.0
Comments=
License=
GetInfo=1
[Options]
FieldSelection=0|0|0=Save to Description Field|1=Save to Comments Field
DeleteField=0|0|0=Do not delete field, append to existing data|1=Delete field, overwrite existing data
AddFileNumbers=0|0|0=Do not add numbers for files|1=Add numbers for files
***************************************************)
// Import Filenames 1.0 (bad4u)
// Import list of filesnames from a local folder (path taken from movie file given in URL field) to description or comments field
//
// Restrictions are
// 1. it will read ALL filenames from the folder, not just a selection
// 2. it reads the path to the folder from the URL field, so it will not work if you overwrite the URL field with a site URL from another script
program ImportFilenames;
uses
StringUtils1;
var
FilePath, Value: string;
FileList: TStringList;
i, p: integer;
//
begin
if CheckVersion(3,5,0) then
begin
FileList := TStringList.Create;
FileList.Text := '';
FilePath := getField(fieldURL);
p := LastPos('\', FilePath);
FilePath := Copy(FilePath, 0, p);
if DirectoryExists(FilePath) = False then
begin
ShowMessage('Directory does not exist or wrong syntax. Exiting script.');
Exit;
end
else
FileList.Text := ListDirectory(FilePath, '*.*');
for i := 0 to FileList.Count do
begin
Value := FileList.GetString(i);
if Pos('D', Value) = Length(Value) then
Value := '_DEL_';
if Pos(#9, Value) > 0 then
Value := copy(Value, 0, Pos(#9, Value)-1);
FileList.SetString(i, Value);
end;
FileList.Text := StringReplace(FileList.Text, '_DEL_' + #13#10, '');
if GetOption('AddFileNumbers') = 1 then
for i := 0 to FileList.Count-1 do
FileList.SetString(i, IntToStr(i+1) + '. ' + FileList.GetString(i));
Value := '';
if GetOption('FieldSelection') = 0 then
Value := getField(fieldDescription)
else
Value := getField(fieldComments);
if Value <> '' then
Value := Value + #13#10 + #13#10;
if GetOption('DeleteField') = 1 then
Value := FileList.Text
else
Value := Value + FileList.Text;
if GetOption('FieldSelection') = 0 then
setField(fieldDescription, Value)
else
setField(fieldComments, Value);
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.