This question is answered.


Permlink Replies: 21 - Pages: 2 [ 1 2 | Next ] - Last Post: 10 Nov 22, 21:45 Last Post By: davidekholm Threads: [ Previous | Next ]
palotasb

Posts: 9
Registered: 8-Aug-2021
How do I load folder titles automatically?
Posted: 8 Nov 22, 21:48
 
  Click to reply to this thread Reply
I manage my images mostly outside jAlbum, using Lightroom and a few small computer scripts. I am generating my input folder with the images using folder and file names that are web safe: umlauts and accents removed, spaces replaced with underscores, etc. Is there any metadata file I can add to each folder so that the folder titles retain their original, human-friendly self. I was thinking of using the .jalbum/meta.properties file where I see that descript=(description) is stored, but adding the title=(title) doesn't work. I see the .info XML files contain this information. Is that what I should edit using a script if I want to automatically add custom titles to each folder?
JeffTucker

Posts: 8,057
Registered: 31-Jan-2006
Re: How do I load folder titles automatically?
Posted: 8 Nov 22, 22:16   in response to: palotasb in response to: palotasb
Helpful
  Click to reply to this thread Reply
The meta.properties file is a bit of a relic, and is currently used only for the folder description/comment. And unlike an image, a folder doesn't really have any place to store metadata. So, I think your idea of editing, for example, the Folder2/.jalbum/.info file may be the only way to do this automatically. You would need to insert another XML node:
  <void method="put">
   <string>title</string>
   <string>Schönster Ordner</string>
  </void>
Perhaps someone else has a clever way to do this that I haven't thought of....
davidekholm

Posts: 3,711
Registered: 18-Oct-2002
Re: How do I load folder titles automatically?
Posted: 8 Nov 22, 22:33   in response to: palotasb in response to: palotasb
Helpful
  Click to reply to this thread Reply
If you want to automate adding such metadata, I'd recommend writing a small script in Groovy that injects the metadata for you. Peek at the small scripts within jAlbum's "tools" folder for inspiration.
davidekholm

Posts: 3,711
Registered: 18-Oct-2002
Re: How do I load folder titles automatically?
Posted: 8 Nov 22, 22:35   in response to: davidekholm in response to: davidekholm
Correct
  Click to reply to this thread Reply
... and have you checked out jAlbums Lightroom plugin ?
palotasb

Posts: 9
Registered: 8-Aug-2021
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 17:33   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
Thanks for both of your replies! I'll check out the Groovy examples – I haven't used that yet, but that's probably the solution I'll go with.

Regarding the jAlbum Lightroom plugin, I'd love to use it, but I have two objections.

First, will it handle my use case of having ASCII-normalized folder names (and hence URLs) so that I don't run into the https://jalbum.net/help/en/Solving_character_encoding_problems#FTP_and_broken_links problem? I'm using Lightroom and jAlbum on a Mac where apparently the filesystem uses a different encoding or Unicode normalization scheme than jAlbum's output and/or the encoding changes after rsync-ing the result to a Linux server, so I had broken links in the end. I'm now trying to solve this by using a small custom script that creates a mirrored directory with all my images but with ASCII file names, using that as the jAlbum input directory, and I'm trying to re-add human-friendly titles at the jAlbum level. If there's a way to do this differently by keeping human-friendly Unicode folder names in the input, but generate web-safe ASCII folders in the jAlbum output, that would be the best! Is this something I can do with the plugin or by changing some settings?

The second smaller objection I have has nothing to do with jAlbum, and everything to do with Lightroom publish/export plugins. I already have a very nice folder structure for my raw images, and most of the albums I want to create should mirror this structure exactly. (An album for myself and subsets for different branches of my family.) Lightroom and all publish plugins make me redundantly recreate that folder structure as a collection structure. Hence I use http://regex.info/blog/lightroom-goodies/folder-publisher to do exports where the folder structure mirrors the original (but select only a subset by using a smart collection and filtering on stars or keywords).
davidekholm

Posts: 3,711
Registered: 18-Oct-2002
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 18:09   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
Under Preferences->Album->Illegal characters, there you can enter characters you don't want jAlbum to generate. jAlbum will then put the original file name in the title field. However, this doesn't seem to work for folder. You need this remapping for folders, right?
MarkusD

Posts: 720
Registered: 13-Apr-2006
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 18:46   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
palotasb wrote:
I manage my images mostly outside jAlbum, using Lightroom and a few small computer scripts. I am generating my input folder with the images using folder and file names that are web safe: umlauts and accents removed, spaces replaced with underscores, etc.
My own language (German) also has some umlauts, as Hungarian does.

But I have resisted "freeing" folder names from umlauts etc. for decades. Software that can't handle this obviously has a problem. Yes, I read here again and again one should proceed defensively and "avoid" the umlauts to avoid potential problems. I cannot and will not agree with this approach.

My folder names contain exactly the letters that belong there:
...Pictures\2022 03 01 Norge\2022 03 01 Hahnstätten - Malmö
...Pictures\2022 03 01 Norge\2022 03 02 Malmö - Sunne
...Pictures\2022 03 01 Norge\2022 03 03 Sunne - Östersund
...Pictures\2022 03 01 Norge\2022 03 04 Östersund - Vuollerim
...Pictures\2022 03 01 Norge\2022 03 05 Vuollerim - Tromsø
...Pictures\2022 03 01 Norge\2022 03 06 Tromsø - Longyearbyen
...Pictures\2022 03 01 Norge\2022 03 07 Longyearbyen
...Pictures\2022 03 01 Norge\2022 03 08 Longyearbyen
...Pictures\2022 03 01 Norge\2022 03 09 Longyearbyen - Tromsø
...Pictures\2022 03 01 Norge\2022 03 10 Tromsø - Innhavet
...Pictures\2022 03 01 Norge\2022 03 11 Innhavet - Mosjøen
...Pictures\2022 03 01 Norge\2022 03 12 Mosjøen - Trondheim
...Pictures\2022 03 01 Norge\2022 03 13 Trondheim - Hamar
...Pictures\2022 03 01 Norge\2022 03 14 Hamar - Malmö
...Pictures\2022 03 01 Norge\2022 03 15 Malmö - Hahnstätten

I wouldn't dream of renaming them:
...Pictures\2022 03 01 Norge\2022 03 01 Hahnstatten - Malmo
..
...Pictures\2022 03 01 Norge\2022 03 10 Tromso - Innhavet

N-e-v-e-r!

I remember that many years ago I once had problems with umlauts in file names in connection with jAlbum. But David solved them. After all, umlauts do occur in his language (Swedish) ;-)

As I said, you can go the defensive way and reduce the filenames to ASCII, but it should not be necessary.

Just my 2 cents.
palotasb

Posts: 9
Registered: 8-Aug-2021
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 18:46   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Yep. My folder structure is like this (after export from Lightroom):

  • (YEAR)/
    • (MM).(DD). (Place or event name)/
      • IMG(NNN)_(YYYY-MM-DD)_(OOOO).JPG (before export, in Lightroom, it is just DSCF(OOOO).DNG. The (NNN) is the order I create in Lightroom, so in jAlbum I can safely sort by filename.)

The place or event name is a human-friendly, unicode name, usually in Hungarian. It doesn't contain filesystem-illegal characters though because it's a folder on disk.

I want to replicate the same structure in jAlbum. It works really nice with the Tiger skin because I see all the years at the top of the main index page and I get a dropdown for each place/event that year.

My script does path = unicodedata.normalize("NFKD", path).encode("ascii", "ignore").decode("ascii") and then path = re.sub(r"(?:^\w./-)+", "_", path, flags=re.ASCII) in Python. This nicely converts e.g., "2022/11.09 Göteborg/..." to "2022/11.09_Goteborg/..." (and not Gteborg!) and replaces other characters and spaces with underscores. If we're talking feature requests, this would be a really useful checkbox in jAlbum itself!
JeffTucker

Posts: 8,057
Registered: 31-Jan-2006
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 18:53   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
palotasb wrote:
I'm using Lightroom and jAlbum on a Mac where apparently the filesystem uses a different encoding or Unicode normalization scheme than jAlbum's output and/or the encoding changes after rsync-ing the result to a Linux server, so I had broken links in the end.

That surprises me. I grabbed my old Macbook Air, running Big Sur (it's too old for Monterey), and created a project with one folder name that violates my "stick to ASCII" rule for naming. The album built properly, and previewed properly in the Brave browser (Chrome engine). I then uploaded it to my plain-vanilla Linux-based web host. Again, no problems.

I've tried it with three different jAlbum skins: one of Laza's, which is JSON-driven, one of mine, which isn't, and another of mine, which produces separate slide pages, and didn't see any problems with any of them.

(demo albums removed)

I'm not using Lightroom, so I have no idea whether that's the source of the problem. But it seems pretty clear that macOS, jAlbum, and Linux are not the issue.
JeffTucker

Posts: 8,057
Registered: 31-Jan-2006
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 19:05   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Attachment ss010452.png (19.3 KB)
Make sure you are using sensible encoding choices - see screenshot.
palotasb

Posts: 9
Registered: 8-Aug-2021
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 19:53   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
I re-did my very first attempt from a few months ago that just used non-ascii human readable folder names. It's still broken, but I'm now encouraged by you, Markus and Jeff to fix this a different way if you say it works for you.


As you can see the images from folders that have accents or umlauts in their name are broken, and the links from the top bar to these folders are broken too.

Now I'm not blaming jAlbum of course, I'm just using it to solve a problem. I suspect the problem happens either at rsync level or maybe on the Linux box's filesystem or maybe in the Apache configuration.

I'll keep thinking and searching if I can maybe solve this anyway without doing the ASCII conversion myself, but I'm posting this in case anyone has a helpful hint for me.
palotasb

Posts: 9
Registered: 8-Aug-2021
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 19:56   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Can you explain "Encoding = ISO-8859-1" and "Write UTF-8" to me? Which things are encoded (or decoded?) with one and which with the other?
palotasb

Posts: 9
Registered: 8-Aug-2021
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 20:07   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
Oh wow, I solved it:

https://album.palotasb.com/portfolio-test-iconv-utf8-mac-to-utf8/

There's some credit due for encouraging me to try harder ;) -- Then I really started to suspect that the issue must be after the album is copied to the server because locally everything just works. Then I Googled and found this: https://unix.stackexchange.com/q/450323/548592

Anyway, the thing that made this work was using the --iconv=utf8-mac,utf8 option in rsync:

rsync --progress --verbose --iconv=utf-8-mac,utf8 -a Portfolio/ palotasb.com:/mnt/var-www/album.palotasb.com/portfolio-test-iconv-utf8-mac-to-utf8

Thanks for all the help everyone and have a nice evening! :)
JeffTucker

Posts: 8,057
Registered: 31-Jan-2006
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 20:16   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
BTW, the jAlbum default is now to use UTF-8 as the encoding choice, rather than ISO-8859-1, so stick with that unless it causes some strange problems. My default settings are left over from the Pleistocene Era. ;)
palotasb

Posts: 9
Registered: 8-Aug-2021
Re: How do I load folder titles automatically?
Posted: 9 Nov 22, 20:17   in response to: palotasb in response to: palotasb
 
  Click to reply to this thread Reply
I'd like to add this to the wiki to the https://jalbum.net/help/en/Solving_character_encoding_problems#FTP_and_broken_links page/section. I registered but it seems like I can't edit the page. This rsync parameter might be worth mentioning for all the other poor souls who don't only take pictures of ASCII-named places and upload using rsync.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums