* Multimedia - Keywords

Homeless Posts from the old forum system
Locked
avatar
Johnyeates
Famous
Posts: 190
Joined: 19 Sep 2009 18:55
Family Historian: V6

Multimedia - Keywords

Post by Johnyeates » 10 Feb 2011 15:46

I cannot find how to undertake a 'find & Replace' or batch edit the Multimedia Keywords.

It would appear that I have to go through every Multimedia record that requires the Keyword to be changed.
If I edit one, that becomes a New Keyword and the old one will not disappear until there are no Multimedia records with the original Keyword.

Is there a query that could be constructed or is there access to the Keyword file somewhere that I could load into a text Editor.

John

ID:4987

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Multimedia - Keywords

Post by PeterR » 10 Feb 2011 16:31

Multimedia Keywords exist only as one or more words, separated by commas, following the Tag _KEYS in the GEDCOM file.  You could, with care (perhaps initially on a copy) edit the GEDCOM file using a text editor such as PSPad to do a find and replace only on lines that begin 1 _KEYS.

It is possible to use a Multimedia Query in FH to list all the multimedia Objects with their Keywords, but FH has no find and replace for Keywords.

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Multimedia - Keywords

Post by tatewise » 10 Feb 2011 16:34

I don't think there is no feature in FH itself that will make the changes you want, and the Keywords are not in a separate list, they are an integral part of the GEDCOM file.

The best approach is to use a text editor search & replace on the GEDCOM file.

If you only ever have one Keyword per Multimedia Record then any text editor will do such Notepad or Wordpad that come with Windows.
First, make a backup copy of your GEDCOM (.ged) file in case of mistakes.
Then open the GEDCOM .ged file in Notepad and perform Edit > Replace:
Find what:       1 _KEYS Oldkeyword
Replace with: 1 _KEYS Newkeyword
where Oldkeyword and Newkeyword are your old and new Keyword.
Repeat for each Keyword.

If you have multiple Keywords per Record then use a text editor with Regular Expressions such as PSPad which is widely used by FHUG members.
See [ur]http://www.fhug.org.uk/wiki/doku.php?id ... pad_editor[/url] in the FHUG Knowledge Base for download & install details.
First, make a backup copy of your GEDCOM (.ged) file in case of mistakes.
Then open the GEDCOM .ged file in PSPad and perform Search > Replace:
Tick the Regular Expressions option.
Find:        1 _KEYS(.*)Oldkeyword(.*)
Replace: 1 _KEYS$1Newkeyword$2
e.g.
To replace Picture with Photo
Image

Repeat for each Keyword.

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Multimedia - Keywords

Post by Jane » 10 Feb 2011 16:45

Alternately you might want to try out the program I wrote to do mine.

See
http://www.fhug.org.uk/cgi-bin/index.cg ... y&num=3888

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Multimedia - Keywords

Post by tatewise » 10 Feb 2011 18:35

I'm going to show off now.

If you use PSPad + phReplace Multiline Search & Replace and select Use Regular Expression the following scripts will create Keywords from the Media sub-folder names.

Search For:
1 _FILE Media\(.*)\(.*)
1 _DATE (.*)
1 _KEYS (.*)
1 NOTE

Replace With:
1 _FILE Media$1$2
1 _DATE $3
1 _KEYS $1, $4
1 NOTE


Here the $1, $2, et seq refer to the expressions in parentheses, and \ represents a single .

If you want to completely replace the old Keywords, then use:

Search For: as above
Replace With:
1 _FILE Media$1$2
1 _DATE $3
1 _KEYS $1
1 NOTE


If some multimedia may not have Keywords then run it again with:

Search For:
1 _FILE Media\(.*)\(.*)
1 _DATE (.*)
1 NOTE

Replace With: as above

To create Keywords dependent on but not the same as the Media sub-folder name then use:

Search For:
1 _FILE Media\(FolderName)\(.*)
1 _DATE (.*)
1 _KEYS (.*)
1 NOTE

Replace With:
1 _FILE Media$1$2
1 _DATE $3
1 _KEYS KeyWord, $4
1 NOTE


Where FolderName and KeyWord must be replace with explicit text, and the script repeated for each case.

avatar
Johnyeates
Famous
Posts: 190
Joined: 19 Sep 2009 18:55
Family Historian: V6

Multimedia - Keywords

Post by Johnyeates » 10 Feb 2011 19:23

I am always amazed at how many clever people are out there and the answers I get from mundane queries.
Thank you.
Now down to work to try one of the answers
John

Locked