Page 1 of 1

Data Structure

Posted: 30 Jul 2013 12:37
by dermotdjt
Hi

Can anyone tell me where I can info on the Data Tree Structure, particularly for Objects.

I'm thinking of writing a small plugin to correct some errors but first I need to know thename of the 'fields' that I need to seearch and then correct.

Thanks

D


ID:7022

Data Structure

Posted: 30 Jul 2013 13:14
by tatewise
Checkout the Knowledge Base Glossary for GEDCOM that has online and PDF links.

Also look at the Knowledge Base Family Historian Plugins ~ Developer Guide.

You might even find an existing Plugin that almost does what you want and can be quickly edited.

Data Structure

Posted: 30 Jul 2013 13:31
by Jane
It's also worth remembering that on the Plugin Editor you can select fields using Edit>Insert Data Reference which will give you the tags and structure lists you need. What I often do it put the data reference in a comment line while I am building the access.

Data Structure

Posted: 30 Jul 2013 14:03
by dermotdjt
Thanks Jane

Exactly what I wanted.

What I am trying to do is change OBJE._FILE field from the currnt value (Mediahttp://ancestry.com/xxxxx) to MediaOBJE.TITL..OBJE.FORM).

This should remove the link to media located on Ancestry and repalce is with the media located in the Media folder.

Now need to work out how to overwrite the existing vaule.

Any help welcomed

[grin][grin]

D

Data Structure

Posted: 30 Jul 2013 14:47
by tatewise
This should do it, but beware of invalid filename characters in the Multimedia Title.

Code: Select all

ptrObje = fhNewItemPtr()  -- Declare pointer 
ptrObje:MoveToFirstRecord('OBJE')
while ptrObje:IsNotNull() do -- Loop through OBJE records
      local ptrTitle = fhNewItemPtr()
      ptrTitle:MoveTo(ptrObje,'~.TITL')
      local strTitle = fhGetValueAsText(ptrTitle) -- OBJE.TITL
      local ptrForm = fhNewItemPtr()
      ptrForm:MoveTo(ptrObje,'~.FORM')
      local strForm = fhGetValueAsText(ptrForm) -- OBJE.FORM
      local ptrFile = fhNewItemPtr()
      ptrFile:MoveTo(ptrObje,'~._FILE')
      local strFile = fhGetValueAsText(ptrFile) -- OBJE._FILE
      if strFile:match('http://trees.ancestry.com') then -- Ancestry link found
            fhSetValueAsText(ptrFile,'Media\'..strTitle..'.'..strForm) -- Need \ as  is an escape character
      end
   ptrObje:MoveNext()
end

Data Structure

Posted: 30 Jul 2013 15:16
by dermotdjt
Mike

MANY MANY THANKS

That seems to have worked for 95%+ of the media. So just a little tidying up to do.

This now means that I can succesfuly export a gedcom from Ancestry and then correct the media file path to the locally stored images. On my Test Project that is 1200+ media images corrected almost in one go.

Again. Many thanks

Dermot

Data Structure

Posted: 30 Jul 2013 15:38
by tatewise
Glad that worked OK.

Would it be normal for each Media Filename to match the Media Title in Ancestry, or is it just that you have organised it that way??

If it is commonplace, then that Plugin may be of general use and added to the Plugin Store.

Alternatively, I could add it as a feature of the Check and Repair Media Links Plugin that I am updating at present.

Data Structure

Posted: 30 Jul 2013 17:31
by dermotdjt
Not sure how standard this would be or if it is just the way I do things

My practice is to store all images locally on my PC before uploading them to Ancestry. Before uploading, they are named according to my conventions.

When uploaded to Ancestry they appear in Ancestry with the file names I have given them.

When the gedcom is download from Ancestry and imported to FH, the media records show the correct file name (OBJE.TITL) and format (OBJE.FORM) but the file path is given as a link to the Ancestry tree, i.e. http://trees.ancestry.com/...... etc. This link does not include my file name, just an alphanumeric link, i.e.

Mediahttp://trees.ancestry.com/rd?f=image&guid=54f30558-07dc-4e41-a56f-251fbb4ef9c&tid=41599612&pid267

All I need to do is copy my local image into the FH Media folder and then run the script you have created. This will now overwrites the Ancestry path and replacing it with my filename.

Really need to check with other users to determine if this is normal practice.

The tidying up I am having to do is really only where the online file name is different from my local file name. This has occured because I have either modified one and then not made the same change to the other record. Also I have found a number of records which have an extra space at the end of the file name before the file extension. Some simple editing and all is back in sync.

Again many thanks. Your script will save me having to manually edit several thousand media records.

Dermot
[grin]