Is this something that is best done in a plugin? I started out playing with the idea by modifying the core code in my installation, enough to verify that I can kind of make the idea work. However, in the long run that means blocking automatic upgrades and doing work to make sure I propagate my changes forward each time I update manually, and that is going to be a lot of work, and I probably won't update as often because of it so I'll more vulnerable to bugs and hacks too; whereas a plugin largely frees me from that problem I believe; it might have to be upgraded when core changes enough, but then modifications to core code might also.
What I want to do is bring in various metadata fields as specially-formatted keywords. For example, I will bring in the city field (if the value is Minneapolis for example) as the keyword "city:Minneapolis". In addition, I have a convention where the supplemental categories fields can contain information of the form "name=value" (for certain specific names; for example, "FILM=KODAK TRI_X", or "SFCON=MINICON 7"), and I want to import those as keywords also, probably reformatting them to use colon instead of equals.
(If I get the basic thing working, I have some vague ideas of adding a management page that might make it of interest to people beyond me. While I have no problem sharing my work on this, at least the early versions are going to have hard-coded my own particular bizarre requirements.)
I'm also interested possibly in *reversing* the process -- when something like write metadata is triggered (but my own version, possibly built in to the same plugin), it would recognize the keywords in the special format, and know which fields to write things back into in the original file. This would be a separate step in development.
Does anybody know this to be impossible or severely difficult? Is there a better approach?
And, does anybody know off-hand what the event triggers relevant to this are? (See my post today about problems with event tracer; that was my initial idea about how to find them, but it doesn't seem to work with the current version of piwigo.)
Probably not relevant to this question, but since it's easy and formally required, here are the software versions:
Piwigo 2.10.2
Operating system: Linux
PHP: 7.2.30 (Show info) [2020-09-17 13:04:23]
MySQL: 5.7.29-log [2020-09-17 13:04:23]
Graphics Library: ImageMagick 6.9.7-4
(Dreamhost shared-server account, if that matters)
Offline
Looking through tools/triggers_list.php, I can't help noticing that there are no triggers whose names include "sync" or "upload" or "import". Is this a bad sign? There are triggers around metadata, but it appears to be around displaying it directly out of the file, not the initial import.
Is this a bad sign? Am I going to have to be adding triggers? Is that even a thing I can consider?
Offline
*following curiously*
Offline
yes there are sync triggers. Look at existing plugins.
Offline
Hi :-)
have you test
$conf['use_exif_mapping'] = array(
....
);
Offline
Huh; how *does* that config stuff interact with a plugin, anyway?
I think I need to go back and make sure the config is properly bringing in ordinary keywords in the first place; it used to, but some simple tests seem to suggest it isn't right now. We'll see where that leads me!
Offline
dd-b wrote:
Huh; how *does* that config stuff interact with a plugin, anyway?
I think I need to go back and make sure the config is properly bringing in ordinary keywords in the first place; it used to, but some simple tests seem to suggest it isn't right now. We'll see where that leads me!
you probably need to call the global before use it
add_event_handler('some_trigger_event', 'do_something'); function do_something() { //example how to get config data global $conf; if (isset($conf['example'])) { $my_var = $conf['example']; return $my_var; } return false }
just learn to code an extension by studding the code of existing extensions, start with this one
https://piwigo.org/ext/extension_view.php?eid=543
then learn triggers:
https://piwigo.org/demo/tools/triggers_list.php
Last edited by eliz82 (2020-09-18 13:23:27)
Offline