* Check for Unlinked Media problems
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Check for Unlinked Media problems
The recent posting Unlinked media (12206), prompted an inspection of this Plugin.
Unless I am mistaken, it appears to have a number of coding errors.
1. Absolute Media Paths
Both buildmedialist() and addlocalmedialist(medialist) try to cater for File Links with full absolute paths instead of relative paths.
On lines 97 & 114 local mediafolder = rootfolder..'\\Media\\' is used later in strlc = strlc:gsub(mediafolder,'').
But that removes the Media\\ part of the path that should be retained to match the strlc created in buildfilelist().
I have tested this by creating a full absolute path in a Multimedia File Link, which gets falsely listed as Unlinked Media.
Then after changing both lines 97 & 114 to local mediafolder = rootfolder..'\\' it is handled correctly and not listed.
2. Copy Files Pattern
In copyFiles(filelist,dir) the local mediafolder = rootfolder..'\\media\\' is later used in v:gsub(mediafolder,'').
But this may fail if 'magic pattern symbols' are in the mediafolder path and needs to use strPlainText(mediafolder).
3. Redundant Parameter
In the mainfunction() the call on line 63 to deleteFiles(filelist,dir) has a redundant 2nd parameter dir.
Unless I am mistaken, it appears to have a number of coding errors.
1. Absolute Media Paths
Both buildmedialist() and addlocalmedialist(medialist) try to cater for File Links with full absolute paths instead of relative paths.
On lines 97 & 114 local mediafolder = rootfolder..'\\Media\\' is used later in strlc = strlc:gsub(mediafolder,'').
But that removes the Media\\ part of the path that should be retained to match the strlc created in buildfilelist().
I have tested this by creating a full absolute path in a Multimedia File Link, which gets falsely listed as Unlinked Media.
Then after changing both lines 97 & 114 to local mediafolder = rootfolder..'\\' it is handled correctly and not listed.
2. Copy Files Pattern
In copyFiles(filelist,dir) the local mediafolder = rootfolder..'\\media\\' is later used in v:gsub(mediafolder,'').
But this may fail if 'magic pattern symbols' are in the mediafolder path and needs to use strPlainText(mediafolder).
3. Redundant Parameter
In the mainfunction() the call on line 63 to deleteFiles(filelist,dir) has a redundant 2nd parameter dir.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Check for Unlinked Media problems
In case it helps the attached is an update of Plugin to V1.8 January 2015
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- Jane
- Site Admin
- Posts: 8442
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Check for Unlinked Media problems
Thanks Mike, sorry I have this on my To-Do list, but family problems mean I have not had much time over the last week or so.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Check for Unlinked Media problems
Sorry to hear that. I had noticed you were not as active as usual.
I hope those problems are resolved before too long. Best wishes.
I hope those problems are resolved before too long. Best wishes.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- Jane
- Site Admin
- Posts: 8442
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Check for Unlinked Media problems
I have uploaded this one to the Plugin Store, plus the Ancestor and Descendants by Generation plugin I did the other day.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
Re: Check for Unlinked Media problems
I am gradually tidying up a migration from v3 to v6, and know that I have quite a few unlinked media items in my media folder, and thought this plug-in would help (as did the very helpful 'Find Duplicate Media plugin).
However, when I run it, and click 'List Unlinked Media', it immediately returns 'No Unlinked Files found', which I know is not the case.
Any suggestions as to what I might try?
However, when I run it, and click 'List Unlinked Media', it immediately returns 'No Unlinked Files found', which I know is not the case.
Any suggestions as to what I might try?
Andrew Slater: researching Slater and Lewis.
- Jane
- Site Admin
- Posts: 8442
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Check for Unlinked Media problems
Can you just confirm what you mean by unlinked? In this plugin it reports media in the media folder not media links which are broken.
To repair broken links try the Auto Repair option in Tools>External File links.
To repair broken links try the Auto Repair option in Tools>External File links.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
Re: Check for Unlinked Media problems
Thanks for the reply, Jane.
I have a number of media files in the Media folder (and sub-folders thereof) that are not linked to any media record in my project. I assume this is what the plugin should detect? Is that correct?
I have a number of media files in the Media folder (and sub-folders thereof) that are not linked to any media record in my project. I assume this is what the plugin should detect? Is that correct?
Andrew Slater: researching Slater and Lewis.
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Check for Unlinked Media problems
Andrew, Media files can also be linked to what are known as Local Media Objects instead of Media records.
Try using Edit > Find and Search for a filename you think is unlinked, with only Other Fields ticked.
The results will refer to the innards of a Record Type other than a Media record.
The Type column (if you make it wider) will say Local Multimedia Object File.
Having discovered such Local Media Objects we can decided how to rectify them.
( I have a Plugin that will convert them to Media Records )
One question is how did they get there as it is quite difficult to create them in FH.
Are you perhaps looking at a Project that was imported from some other product?
Or maybe FH V3 was more adept at creating Local Media Objects.
Try using Edit > Find and Search for a filename you think is unlinked, with only Other Fields ticked.
The results will refer to the innards of a Record Type other than a Media record.
The Type column (if you make it wider) will say Local Multimedia Object File.
Having discovered such Local Media Objects we can decided how to rectify them.
( I have a Plugin that will convert them to Media Records )
One question is how did they get there as it is quite difficult to create them in FH.
Are you perhaps looking at a Project that was imported from some other product?
Or maybe FH V3 was more adept at creating Local Media Objects.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Check for Unlinked Media problems
Hi Mike,
I tried searching for one of the unlinked files with Edit > Find and it doesn't show up at all. I guess that means they really are unlinked, but not sure why the plugin is not showing them.
Andrew
I tried searching for one of the unlinked files with Edit > Find and it doesn't show up at all. I guess that means they really are unlinked, but not sure why the plugin is not showing them.
Andrew
Andrew Slater: researching Slater and Lewis.
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Check for Unlinked Media problems
I can assure you that all the files must be linked if the Plugin says they are.
Can you please post exactly what filename you searched for.
Do NOT include the folder path ~ just search for the filename part ~ or even a unique fragment of the filename.
Do NOT tick Match case nor Match whole word.
Are you sure the files in question are within the Media folder of the Project in question, and not the Media folder of some other Project?
Can you please post exactly what filename you searched for.
Do NOT include the folder path ~ just search for the filename part ~ or even a unique fragment of the filename.
Do NOT tick Match case nor Match whole word.
Are you sure the files in question are within the Media folder of the Project in question, and not the Media folder of some other Project?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Check for Unlinked Media problems
Solved it - user error, as you suspected. (I had 2 similarly named projects, and had the other one open in error.)
Plugin does exactly what it says on the tin, and will be very helpful.
Plugin does exactly what it says on the tin, and will be very helpful.
Andrew Slater: researching Slater and Lewis.