Finding corrupt entry fields for files with trigger

103 views
Skip to first unread message

Horst Liebermann

unread,
Jan 8, 2017, 7:43:24 AM1/8/17
to mementodatabase
Hi, I have a memento database with donated bicycles for collecting, repairing and handing them over to refugees.
(Memento was very helpful in our project.) The database consists of 5 libraries an includes a lot of image files.Some of them are corrupt (may by lost during synchronisation between several devices, I really don't know the reason).
Now I'm trying to write a trigger to find out all corrupt files.
I would be happy to get any help.
Hotti

Bill Crews

unread,
Jan 8, 2017, 8:30:44 AM1/8/17
to mementodatabase
Well, here are some guidelines:

- Triggers are not free-running. You have to initiate it somehow, still be able to use your library though the trigger is there, and then remove or disable it once it has done its thing. You might try using the Events "Adding an entry to Favorites" and maybe "Removing an entry from Favorites" to initiate scripts like this.

- It is easy enough to scan a library. Let's assume you have an Image field in library Images called theImage. This dumps the image field values to the log. Alternatively, you could use message() the same way and keep your eyes glued to the bottom of the screen, as it runs through the entries at about 2 seconds per entry; that might be hard to read, which is why I used log(). This should give you an idea as to how images are stored and referenced in Memento. Set the log file in Settings > Application > Debug > Logging options.
var lib = libByName("Images");
var entries = lib.entries();
for (var x = 0; x < entries.length; x++) {
log("Image #" + x + " = |" + entries[x].field("theImage") + "|");
}

- Once you have access to the image file in JavaScript, I don't know how you are going to determine if or how it is corrupt or what to do about it; that's up to you.

Horst Liebermann

unread,
Jan 8, 2017, 10:33:53 AM1/8/17
to mementodatabase
Many thanks for your helpful guidelines.
Corrupt Image means that it's not more available .
Example for a corrupt Field content

IO_Error
//:mementoserver/appspot.com/blob/get?/uid= an so on...
Hotti

Horst Liebermann

unread,
Dec 4, 2017, 11:06:31 AM12/4/17
to mementodatabase
Hi,again I have lost a lot of Files (Images). For more than 100 Files I get the information
IO_ERROR
h5ttp://mementoserver.appspot.com/blob/get?blob= ....
For Example:
AMIfv96i5rHD4yMnX_7giFLcCoXW1TkFlsOPyhtidd2IT7lF4NU5ZkPJc_DgjnQ8S1-_cED3BZQGhdcyLj0iad7uDt5vQ3KeIsAVyAQACvkwqSU7B5RAm7KuO9vw6CEvWrn9h6F-8fOtFUynql-cRiGxtMP-y3HknNXPkcEZfkQA_7_Cj_wCo_D86iyM2My6mh8ObkeqSRxC,

Is there any help for me?

Hotti

Reply all
Reply to author
Forward
0 new messages