galleryadd.pl incorrect directory structure

wdgolden

Joined: 2007-09-10
Posts: 5
Posted: Wed, 2007-09-12 15:21

I currently have a gallery with one main album called "Main" and then sub gallerys for each letter of the alphabet and one "#s" directory.

Essentially

-Main
--#
--A
--B
--C
--etc ....

I initially used the import from local disk feature to populate the gallery albums. Albums #,A-Z usually have some sub albums.

The problem occurs if I attempt to run galleryadd.pl to add new items. I have a separate directory mirroring the Gallery album structure. When I run galleryadd.pl on the separate directory it created a new album in my main gallery with part of the base folder path. I want it to maintain the existing directory structure.

I have my gallery data here:
"E:\ProgramFiles\GalleryAlbums\hiresgallery\albums\ListingPhotos"

The nightly import photos are here:
"E:\Nightly_Gallery_Import\Photos"

Initially the directory structure is identical for the two locations. I run galleryadd.pl on the import folder and the following album gets added to my main gallery, instead of the sub gallerys being populated.

"E:\ProgramFiles\GalleryAlbums\hiresgallery\albums\ListingPhotos\Nightly_Gallery_Import_Photos_"

Anyone have any ideas?

 
FeriCyde
FeriCyde's picture

Joined: 2010-01-03
Posts: 5
Posted: Mon, 2010-01-04 03:48

Yes, I've got this working with a combination of both galleryadd.pl and g2add.pl.

The relevant items to tie together are the fact that you can find the parent id numbers with galleryadd.pl and you can add sub-albums with g2add.pl (this is for Gallery2 sites).

The g2add.pl parameters I was passing (a directory at a time are):

(example script follows):

-------
#!/bin/bash

for album in $( cat /tmp/albumlist.txt )
do
g2add.pl -l http://straylight/gallery2 -a 7 -c -u admin -p [adminpass] $album
done
-------

Where:
admin - site admin id
URL with "straylight" in it : my gallery install (local network in my case).
7 -- the "parent id" of the top level gallery (where I wanted the "albums" to be children. Your parent may be different (more on this later).
-c -- create album if it does not exist. Note -- multiple runs will land the pics in duplicate named directories -- in which case you can add the pics one at a time to the album id itself (without creating it) -- that's not the way the above is working, however.
-u and -p -- self explanatory.
$album -- the actual "directory" where you want the photos to land which is the same as the "album" in Gallery. In other words, name your sub-directories the name of the album that you want created, and don't specify or programatically attempt to use the -c flag multiple times -- I simply couldn't get this to work and I tried a lot of different things -- the album would land in random places when I did it using galleryadd.pl, and it simply wouldn't be re-used using g2add.pl.

So, there you have it -- a working example in 2010 of this thing -- my guess is that newer versions of Gallery (and older ones as well) won't work for various reasons -- the code is kind of fragile.

.... Finding the number 7 ....

So, in the example above, my "parent id" is 7 -- how do I find this (the unique album id of the parent for which the gallery children will be housed)?

Use the older , galleryadd.pl for simply listing albums on the server. Relevant syntax:

$ ./galleryadd.pl -g http://straylight/gallery2 -G2 -u admin -p [adminpass] -l | less

And example output:
Album: 7 (Gallery)
Album: 36 (2000stang)
Album: 133 (2003aniversary)
Album: 171 (2006_lisa_bday)
Album: 221 (2008)
Album: 98 (2008-flowers)

Note that my top level is "Gallery" -- with an id of 7.

Very much hope this helps,
--Paul

 
ictinhuis

Joined: 2010-01-08
Posts: 21
Posted: Sat, 2010-01-09 00:24

Is this solution also being picked up / implemented by some Gallery2 and/or Gallery3 developers?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2010-01-09 05:06

What's the question? To add stuff via the command line? You can do that in G2 with the galleryadd.pl
http://codex.gallery2.org/Downloads:Galleryadd.pl_NG

Someone also created this:
http://gallery.menalto.com/node/81010#comment-284733

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
FeriCyde
FeriCyde's picture

Joined: 2010-01-03
Posts: 5
Posted: Sun, 2010-01-10 03:11

nivekiam: Yes, to use the perl scripts, to add files via command-line.

Unfortunately, the present incarnations of galleryadd.pl and g2add.pl are very broken with the present (version 2) code base.

I've found a way through the mine-field and documented it (here).

I suspect that with a little TLC (Tender Loving Care) the present 2 perl scripts could be fixed up into one, very much functional and usable program. I'm up to the task, but looking at the code that I have don't easily see how it's all working. I'd be willing to work through this with someone who knows the gallery2 code base if they're willing to donate some time (and patience).

Sincerely,
--Paul

 
ictinhuis

Joined: 2010-01-08
Posts: 21
Posted: Mon, 2010-02-08 21:06

.