Replies: 15 comments 47 replies
-
Hey, glad you like it.
|
Beta Was this translation helpful? Give feedback.
-
Cool okay - I'm working on something atm (namely rewriting half of the underlying logic of the code and do away with datatables as much as possible) but once that's done I'll get on with this. (might be a bit of time though) |
Beta Was this translation helpful? Give feedback.
-
Okay, initial thoughts, now that I've started working on this. Guess what's coming then.... I pointed it out somewhere else a while ago but contrary to what may seem obvious I'm not a C# developer and so this is my very first attempt at coding anything...ever. I'm a SQL/database dev. This isn't entirely a problem per se but GTN isn't really geared up to be a split "UI and CMD" thing. I could introduce parameters to the original exe file but I feel that would be a little odd, especially in the context you'd like. The source of the issue is that the code is monolithic because I'm a n00b and unaware of what's deemed good coding habits. Admittedly I'd still need to rewrite a lot of the methods regardless because they are dependent on the "main Form" being available. So I'm making a GTNCMD version. A bit of the challenge is that - especially over the past two months - the code has evolved a lot to account for Custom Rules and City allocation logic, without which I think the product is just crap. The API is what it is (free, and it's a bit of a case of getting what one pays for) and I think power users would want that functionality as part of their workflows. On top of that @Urmel has kindly provided the basis for moving from a certain coding logic to a more reliable/sensible one, which also happens to be a lot more verbose (in terms of code) than the old one. Now hypothetically the way this should be done from what I understand is that there should be basically 3 projects, a common class library set and then the UI and the CMD relying on the class libraries to avoid duplication and redundancy. This won't be the case here, certainly not initially. Admittedly I am not proficient in writing abstract classes or interfaces and so a lot of the code will redundantly reused (and to make things worse, with small modifications) in GTNCMD - this introduces the problem of having to maintain 2 repos and that since one is dependent on UI and the other is not there is likely to be some divergence in the code as time moves on. Also CMD won't need stuff that relates to (for example) time-shifting, amongst other things. I'm therefore thinking, and admittedly looking at either of you (@softnorbi or @Urmel ) on the assumption that at least one of you know/s more about C# than I do, that once the initial version of CMD is out, someone could help create the common libraries/dll files and then the two projects could be redirected to read from those? |
Beta Was this translation helpful? Give feedback.
-
Good evening @softnorbi, @nemethviktor, let's recap on what actually is the use case you want to have supported @softnorbi.
GeoSetter supports this by allowing to be started with command line params (description of some these can be found in GeoSetter -> Help -> White Papers --> Command Line). Using /Collection and giving it a list of files, you get to edit these passed files even if they are in different folders. Now regarding how GTN could do this - some thoughts:
|
Beta Was this translation helpful? Give feedback.
-
@Urmel thanks for the quick reply! I think we don't need to replicate too much functionality. My understanding is that a file list (most likely sitting in a txt file that contains a one-file-per-line-list) needs to be passed into GTN. For each of those files, if they have coordinates then they get tagged and saved
Things we don't need
Settings would be read as per normal from the sqlite database/file so any settings would need to be edited in the UI as normal. |
Beta Was this translation helpful? Give feedback.
-
here we go... you can extract the windows bat script and let it run from the plugin wiht the same params you would use for the GTN invokation. Could you please perform the following test case (with the bat file configured like you would configure GTN in LR) and document your results here? This should give us more insight and an idea if / how things could be accomplished.
Thanks. |
Beta Was this translation helpful? Give feedback.
-
Seems like the two of you are from the same part of the world. Wunderschön :)
It's on various torrent sites too, LR Classic. I'll have a look one of these days. I keep a bunch of VMs for testing and whatever other purposes, I don't mind getting one set up for experimenting further. |
Beta Was this translation helpful? Give feedback.
-
Test please: https://drive.google.com/file/d/18iI77SIdrIv-joOtyT0-MzqOVtB5OgM0/view?usp=share_link I haven't uploaded a diff yet to the codebase because I am hoping that it'd get tested a little before it's posted but I've played around with CollectionMode and seems to do what it's supposed to. |
Beta Was this translation helpful? Give feedback.
-
@Urmel 4b96db4 last check-in just now.
|
Beta Was this translation helpful? Give feedback.
-
Hi all, @softnorbi, can you confirm that the current approach works for calling GTN once and then receiving back the udpated data in LR without closing GTN? And another experiment would be great: could you please
.... this should tell us, if LR behaves differently if the process it started (GTN) finishes before starting it again. @nemethviktor, if this all works, we could go for the approach...
We should have a concept for two situations:
What do you think? Currently, I'm having trouble carving some time out to get into the code (various other have to do duties). Sorry. I'll do again as soon as I get the chance to. |
Beta Was this translation helpful? Give feedback.
-
Hi @softnorbi, @nemethviktor, I created a first version of the signalling mechanism in #80. The code in the PR uses named pipes and Mutex:
Currently, only play code: passed on test text from newly started instance to running instance, msg box to show. Test it yourself (command prompt): The most challenging next step is to decide how we do the reaction when this change of collection file is requested. Because: this (as in any other potenial method) request comes in asynchronously. So you could be right at saving some data or doing a gpx track sync when it comes in... |
Beta Was this translation helpful? Give feedback.
-
We might have 2 situations to deal with:
My gut feeling is that we will have locks for case 1 and we should put case 2 things also in our queue. Why? Because tasks of type 2 may not be started concurrently. Also conditions of case 1 may not be entered while a task that needs locking is currently running (try to open an edit window while the application is switching to collection mode...). But maybe I'm thinking too complex... :) I did a cross check in the main file and my proposal is to consider these:
|
Beta Was this translation helpful? Give feedback.
-
Hey @nemethviktor , I agree that if for example there are already modified files / DE3 is filled, the state does not change. Question is, whether starting lets say lvw_FileList_UpdateTagsFromWeb and an update of the directory elements should be allowed concurrently. That's why I thought we must also consider all methods that also change the state of the application to "blocked". So regarding the queueing of a form start it could go like this:
|
Beta Was this translation helpful? Give feedback.
-
Hi @nemethviktor , after some more reading, I found out that we could serialize most of the stuff using existing .Net techniques. There are SynchronizationContexts available to various scopes (cf. https://learn.microsoft.com/en-us/archive/msdn-magazine/2011/february/msdn-magazine-parallel-computing-it-s-all-about-the-synchronizationcontext). Therefore, I would now opt for
By doing this, we i) get a nice one-after-the-other execution of what comes in via Named Pipe and what the user clicks. And we ii) do not need to fumble around too deep with additional locking. In other words, we build a virtual button that is being clicked by the Named Pipe input. So in the end, we would need to consider for this "change collection button":
My open question now is: did you use some of the async stuff to improve performance or is it OK to make everything serial...? |
Beta Was this translation helpful? Give feedback.
-
Ok - so after some implementation work and testing, it turns out that we won't get around locking if we want UI updates during the processing. The cause being that updates to the UI need the UI thread to be not blocked / occupied: to update the UI, the system sends WM_PAINT and alike messages to the UI thread. If the thread is bound in a long-running operation, these messages do not get processed. Application.DoEvents() is a scary workaround for what we want: it basically pauses the current context (i.e. the long running / background operation) and processes the UI Thread queue. BUT: thereby, new user interactions are also processed, potentially leading to two concurrently running operations. Example. When loading the folder, we provide an information how much percent already is loaded. Two options:
So.... I guess back to the previous approach - a bit modified:
Concrete with the list from above:
So much for now |
Beta Was this translation helpful? Give feedback.
-
Hello Viktor,
I've just found your wonderful tool and I'm glad you've started developing a lightweight replacement for Geotagger but open source which I prefer as it's more future proof. My use of GTN would be in conjunction with a plugin for Lightroom 6.14, where Adobe's map module is no longer working/supported. However, this use case would require GTN to be able to accept command line parameters (similar to Geotagger). The Lightroom plugin would give GTN the filenames to open and GTN should write the geocoordinates into them. Would that be possible or can GTN already do that? Here is a link that describes what I mean in more detail:
https://geosetter.de/en/2018/05/10/lr-plugin-run-any-command-en/
Thanks again for your development of GTN. I hope you continue to work on it and I'm looking forward to the final version!
Regards,
Norbert
Beta Was this translation helpful? Give feedback.
All reactions