adddir becomes galleryadd

jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Wed, 2003-01-22 08:47

How stable is the gallery_remote2.php interface? I've fired the opening shots in the battle to create a more robust recursive command-line uploader.

At the moment it works like I would want, but I'd like to make it conform to the specs as published here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/gallery/gallery_remote/gal_remote_proto-2.html?rev=HEAD&content-type=text/html

How stable is the protocol?

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Wed, 2003-01-22 08:48

OH yeah...

http://jpmullan.com/galleryupdates/other/galleryadd.pl

For anyone who is interested...

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Wed, 2003-01-22 08:53

Insofar as the features that are already present will be supported in future releases, it's stable.

I think the versioning mechanism we're using is effective. You tell the server which minor version of the protocol you're using, and it sends you its minor version, so your app/script can enable/disable features based on whether the server supports them.

Feel free to suggest changes/new features.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Thu, 2003-01-23 07:32

Now to work in all the modifications given to me by a few people. I'm also interested in feature requests (and I'm going to make a real release again).

 
elliotshepherd

Joined: 2003-01-22
Posts: 25
Posted: Mon, 2003-01-27 23:35

Id really like to see this integrated with the existing file upload feature in gallery itself, i would love to recursivly add albums from directories on my server (or another?).

You could do it by adding another checkbox for recursive. it would then add any photos in that directory, then any directories in that, and photos in those and so on.

That could make life a lot easier! (ps make it also rename the folders to a form it can use, and not album01, album02 etc.)

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2003-02-24 21:06

I've released a new version which now requires galleryremote2.php v2.1

http://jpmullan.com/galleryupdates/other/galleryadd.pl

What happens if a user tries to use the remote to create an album with the same name as an existing album?

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Mon, 2003-02-24 21:20

Good one Jesse... I've fixed this hole in 1.3.4b14.

Wow, two minor GR updates in one day :wink:

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2003-02-24 21:36

Does the addition of a duplicate directory simply fail? Does it create a directory with an incremented name? Could that behavior be implemented?

My current script avoids the issue by finding the next available name in the series album001, album002, album003, and then sets the title to the name of the source directory.

That might not be the most useful behavior when adding directories recursively. It's hard to say. I'm still thinking about it...

Here's what I was thinking about when it was being discussion on gallery-devel (I miss that list)...

> On Mon, 17 Jun 2002, Jesse Mullan wrote:
> > I have had the "creating albums" problem rolling through the back of my
> > head for a while.
> > Do created albums override existing albums with the same name, fail
> > out completely, rename the exisitng album, or rename the new album to
> > something else?

From: Eduo
> I'd make it a confiogurable setting. Automatic rename, automatic replace
> or automatic addition..:smile:

From: Bharat
This sounds good. Have a reasonable default value that covers the
80% case. This is definitely a task for the Perl/Java companion
programs, and it's something that should be relatively easily
doable.

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Mon, 2003-02-24 21:42

Hum... I guess I missed that one. My fix was just to check if the album already existed; if it did, default to auto-generated names (album01-album99, albun01, etc.).

Nothing as sophisticated as what was proposed, I'm afraid. But I'm woking with John Kirkland to move the album creation code out of gallery_remote2.php where it doesn't belong.

 
arune
arune's picture

Joined: 2002-12-22
Posts: 13
Posted: Thu, 2003-02-27 11:16

So far I have not found a commandline util for my purposes, maybe a small change in this one and I'll be happy as can be.

My digital camera automaticly uploads the images to "drive:dirImageDatedate000.jpg" and then it can execute a program. I'd like to have it upload the images to the my gallery. (Note, its more than one Date-folder)

-Either it should create new album(s) in the "root" and use Date as name of new album.
-Or it should create new album(s) in an album I call upload.
Problem as it is now is that I call galleryadd.pl with drive:dirImage and -a upload as parameters, it creates a subalbum in Upload called Image and in that it creates the correct subalbum(s) Date.

-So I don't want it to create the Image subalbum.

/Anders Runeson
(This is hard for me to explain in english, hope you understood some of it)

 
headhunter

Joined: 2003-01-13
Posts: 75
Posted: Fri, 2003-02-28 03:03

This message is for paour. What would I have to do to to have the folder inside gallery named the same name as the original? Like right now its naming them all the default, and with 2k+ folders, its kinda a pain in da a$$ to login and change them all by hand.

 
levak
levak's picture

Joined: 2003-03-02
Posts: 16
Posted: Sun, 2003-03-02 11:19
Quote:
So far I have not found a commandline util for my purposes, maybe a small change in this one and I'll be happy as can be.

My digital camera automaticly uploads the images to "drive:dirImageDatedate000.jpg" and then it can execute a program. I'd like to have it upload the images to the my gallery. (Note, its more than one Date-folder)

-Either it should create new album(s) in the "root" and use Date as name of new album.
-Or it should create new album(s) in an album I call upload.
Problem as it is now is that I call galleryadd.pl with drive:dirImage and -a upload as parameters, it creates a subalbum in Upload called Image and in that it creates the correct subalbum(s) Date.

-So I don't want it to create the Image subalbum.

You read my mind:) I need the same thing....

and I`m having problems with galleryadd.pl... It just doesn`t work:
levak@etela:/mnt/staff/pictures/test$ /mnt/element/levak/gal/galleryadd/galleryadd.pl -l http://xxxx.org -a "Minolta Dimage 7i pictures" -u lxxx -p xxxx *.jpg
Logging In
Logged In successfully
Uploading image 'pict0203.jpg'
Could not upload image 'pict0203.jpg': Unknown error 200 #__GR2PROTO__
status=301
status_text=Command 'add-item' unknown.

gallery version 1.3.3

LevaK

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Wed, 2003-03-05 23:39

Does gallery remote work for you?

 
arune
arune's picture

Joined: 2002-12-22
Posts: 13
Posted: Thu, 2003-03-06 09:33

Who did you ask?
It works for me, but not the way I want it to.
/Anders

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Thu, 2003-03-06 11:13

headhunter: you answered your own question here:
http://gallery.menalto.com/modules.php?op=modload&name=phpBB_14&file=index&topic=701&action=viewtopic&topic=4261

Levak: Does gallery remote work for you? What is your version of galleryadd.pl and gallery_remote2.php? How about your gallery installation in general?

arune: Does this work for you?
galleryadd.pl -l http://example.com -u username -p password -a Upload drive:dirImage*

Otherwise, you could trys
cd drive:dirImage
and then
galleryadd.pl -l http://example.com -u username -p password -a Upload *

 
arune
arune's picture

Joined: 2002-12-22
Posts: 13
Posted: Fri, 2003-03-07 10:48

jmullan:
galleryadd.pl -l http://example.com -u username -p password -a Upload drive:dirImage*
does not work, it outputs: Ignoring drive:dirImage*
(May this be because of me using windows?)

There are more than one sub-folders to Image called Date, like:
drive:dirImage2003-02-21
drive:dirImage2003-02-25
drive:dirImage2003-03-01

When doing
galleryadd.pl -l http://example.com -u username -p password -a Upload drive:dirImage
it almost works, this is my gallery after:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
Upload
|-drive:dirImage
|-2003-02-21
|-2003-02-25
|-2003-03-01
</TD></TR></TABLE><!-- BBCode End -->

This is where I want to get rid of the subalbum called drive:dirImage

Most of all, I'd like galleryadd to create 2003-02-21, 2003-02-25, 2003-03-01 as albums at top-level in gallery.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Sun, 2003-03-09 06:41

make yourself a batch file and this might work

add.bat
------
drive:
cd dirImage
galleryadd.pl -l http://example.com -u username -p password -a Upload *

------

I need to add an option for adding directly to the root level. At the moment it will provide an error condition...

 
arune
arune's picture

Joined: 2002-12-22
Posts: 13
Posted: Sun, 2003-03-09 19:43

It stills says "Ignoring *", maybe it doesn't work on winXP.

Adding dirs to root level seems to work when using the -noverify switch, or almost works or something :smile:

 
levak
levak's picture

Joined: 2003-03-02
Posts: 16
Posted: Mon, 2003-03-10 11:43
Quote:
headhunter: you answered your own question here:
Levak: Does gallery remote work for you? What is your version of galleryadd.pl and gallery_remote2.php? How about your gallery installation in general?

gallery remote works OK. galleryadd.pl is version .05alpha
gallery version is 1.3.3 and gallery remote2 is 2.1(version of protocol - the one that comes with gallery 1.3.3)

LeVaK

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Tue, 2003-03-11 00:11

Levak:
Your error doesn't make any sense to me. Would it be possible for me to test out your gallery directly? Contact me via email at

 
levak
levak's picture

Joined: 2003-03-02
Posts: 16
Posted: Tue, 2003-03-11 10:08
Quote:
Levak:
Your error doesn't make any sense to me. Would it be possible for me to test out your gallery directly? Contact me via email at

Hey, it started to work without any reason:)
Will galleryadd be able to make gallery not just upload someday?

LeVaK

 
arune
arune's picture

Joined: 2002-12-22
Posts: 13
Posted: Sat, 2003-03-29 08:41

Finally I solved the problem with some dos-batch.
This code lists the subfolders to Image to a file (with each subfolder on a new row in the file).
Then the loop runs the script with each row in the file as argument.

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
@echo off
drive:
cd drive:/dirImage
dir /a:d /b > %temp%/dirlist.txt

REM ----- for each subfolder to Image -----
for /F "tokens=*" %%A in (%temp%/dirlist.txt) do (
REM ----- %%A is subfolder to Image, so upload it -----
perl galleryadd.pl -l http://server/gallery -a upload -u user -p password drive:/dirImage/%%A
)

del %temp%/dirlist.txt
</TD></TR></TABLE><!-- BBCode End -->

/Anders

 
ppmnt
ppmnt's picture

Joined: 2003-01-12
Posts: 238
Posted: Sun, 2003-05-18 00:57

jmullan,

After using galleryadd.pl to upload to a staging album that is not open to the public, I then moved the created album and it's sub-albums into the album it belongs. Unfortunately, all the albums it created picked up the permissions of the staging area, meaning NOBODY can see the albums.

Any easy way to change the permissions recursively that you know of?

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2003-05-19 15:36

My solution to that would be to create a staging album that is not visible to the public, and then within that album create a new album that is visible to the public with all of the properties and permissions that you want for your new albums. Then, move the new albums to the new location.

The other option is for me (or someone else) to figure out the right way to remotely add albums to the root level of a gallery. I'm still thinking about it, but somewhat busy.

TODO:
Option to add albums to root album
Option to not create albums for n levels of directory structure (for doing things like adding all subdirectories of a directory to the root level)

 
ppmnt
ppmnt's picture

Joined: 2003-01-12
Posts: 238
Posted: Tue, 2003-05-20 02:57
jmullan wrote:
My solution to that would be to create a staging album that is not visible to the public, and then within that album create a new album that is visible to the public with all of the properties and permissions that you want for your new albums. Then, move the new albums to the new location.

Duh. Thanks, that's a simple enough solution and much easier then the sed / vi substitution I ended up doing on the album.dat files. :)

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Thu, 2003-05-22 15:27
levak wrote:
Will galleryadd be able to make gallery not just upload someday?

galleryadd will always use the web interface and will never add directly to albums. It is possible that I or another person will make a new program that adds directly to albums, but that outcome is not very likely.