* Data Structure

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
dermotdjt
Silver
Posts: 5
Joined: 29 Jul 2013 19:38
Family Historian: None

Data Structure

Post by dermotdjt » 30 Jul 2013 12:37

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

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

Data Structure

Post by tatewise » 30 Jul 2013 13:14

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

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

Data Structure

Post by Jane » 30 Jul 2013 13:31

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.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
dermotdjt
Silver
Posts: 5
Joined: 29 Jul 2013 19:38
Family Historian: None

Data Structure

Post by dermotdjt » 30 Jul 2013 14:03

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

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

Data Structure

Post by tatewise » 30 Jul 2013 14:47

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
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
dermotdjt
Silver
Posts: 5
Joined: 29 Jul 2013 19:38
Family Historian: None

Data Structure

Post by dermotdjt » 30 Jul 2013 15:16

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

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

Data Structure

Post by tatewise » 30 Jul 2013 15:38

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
dermotdjt
Silver
Posts: 5
Joined: 29 Jul 2013 19:38
Family Historian: None

Data Structure

Post by dermotdjt » 30 Jul 2013 17:31

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]

Post Reply