Page 2 of 2
Check for Unlinked Media
Posted: 15 Oct 2012 12:27
by gerrynuk
Jane said:
Strange, that's just returning from the file list of the item is a file or a directory. Do you have any symbolic links in your media folder?
Any chance you can add a print at line 55 so you get and try running the plugin from the editor
print(filename)
if attr.mode == 'file' then
and see if there is any thing different about the file it stops on.
Jane,
Sorry but I have only just found time to re-test the plugin. I downloaded the latest version (1.5) but still get an error message when I click on List Unlinked media:
As you have updated the plugin since my first post is it still possible to run the test you describe?
Check for Unlinked Media
Posted: 15 Oct 2012 13:07
by tatewise
Yes, but the line number is now 84.
Alternatively, use Edit > Find > if attr.mode == 'file' then.
Check for Unlinked Media
Posted: 18 Oct 2012 11:59
by gerrynuk
Hi Mike & Jane,
I added the extra statement at line 84 and ran the plugin from the editor. I got this result:
It seems to be indexing the media but then fails.
Gerry
Check for Unlinked Media
Posted: 18 Oct 2012 12:54
by tatewise
Continuing the sequence of files being indexed, what would be the next folder/file likely to follow ...mediaBMBmarriages.picasaoriginalsxx George Robinson...?
Check for Unlinked Media
Posted: 18 Oct 2012 16:56
by gerrynuk
tatewise said:
Continuing the sequence of files being indexed, what would be the next folder/file likely to follow ...mediaBMBmarriages.picasaoriginalsxx George Robinson...?
Mike,
With your help I have tracked down the problem which is that some of the media have characters that Windows machines don't like - such as '/' and quotes. Having eliminated these the plugin now works perfectly. My media is stored on an iMac which is much more tolerant of these characters.
Many thanks,
Gerry
Check for Unlinked Media
Posted: 18 Oct 2012 17:44
by tatewise
Note to Jane!
I wonder is it possible to trap the nil value for attr, perhaps inside dirtree(), so that the problem can be reported more elegantly?
Check for Unlinked Media
Posted: 18 Oct 2012 19:10
by Jane
V1.5 which is in the plugin store now uses
Code: Select all
if type(attr) == 'table' then
if attr.mode == 'file' then
local strlc = string.lower(filename:gsub(rootpattern..'\',''))
filelist[strlc] = filename
end
end
Check for Unlinked Media
Posted: 18 Oct 2012 20:30
by tatewise
That is the version we are using Jane.
The problem is that it fails on line 82
for filename,attr in dirtree(mediafolder) do before it gets to the 'table' test.
May I suggest in
dirtree Code: Select all
local function yieldtree(dir)
for entry in lfs.dir(dir) do
if entry ~= '.' and entry ~= '..' then
entry=dir..'\'..entry
local attr,error=lfs.attributes(entry)
if attr == nil then print(error) end
coroutine.yield(entry,attr)
if attr.mode == 'directory' then
yieldtree(entry)
end
end
end
end
Although the
if attr == nil then... could be more sophisticated and added to the
Directory Tree (code snippet).
Gerry ~ could you try that change by replacing:
local attr=lfs.attributes(entry)
with
local attr,error=lfs.attributes(entry)
if attr == nil then print(error) end
Check for Unlinked Media
Posted: 19 Oct 2012 09:09
by Jane
Mike I wonder if this might be better
Code: Select all
local function yieldtree(dir)
for entry in lfs.dir(dir) do
if entry ~= '.' and entry ~= '..' then
entry=dir..'\'..entry
local attr,error=lfs.attributes(entry)
if attr == nil then attr = {mode='attrfail',error=error} end
coroutine.yield(entry,attr)
if attr.mode == 'directory' then
yieldtree(entry)
end
end
end
end
That way mode could be checked in the returned data and trapped if needed, rather than the whole traverse failing.
Check for Unlinked Media
Posted: 19 Oct 2012 09:22
by tatewise
Yes, that looks a neat solution.