Store filenames in a field

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
spd
Posts: 1
Joined: 2010-12-25 17:29:54

Store filenames in a field

Post by spd »

Hello,

I'm on looking for a new catalogizer for films, and the AMC seems the best. But I still can't found out how can I store the scanned filenames in a field... Okay, this is a movie-based and not a file-based catalogizer, but I hope there's a solution :)

Here is an example what I would need:
Image

...so I don't need an individual entry for all the episodes, just have the program put a list of the selected (and scanned) filenames *automatically* to the end of a big field (if there was any information, that would be preferable to leave the text in the field and the file list would follow it).

I would use only some of the internet scripts (Hungarians and one or two international), so if the solution requires, I could insert some line into all the affected scripts (but I still need your help, because I don't know the global variable names that holds the filenames for those pascal routines, if there's any...).

Thanks forward,
Peter
antp
Site Admin
Posts: 9665
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Hi,
There is an option to put the file name into title field, but if you have multiple files this won't help you :/
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

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.
Post Reply