Wildcard filters to add files from Local Server?

meburdick

Joined: 2010-01-12
Posts: 3
Posted: Tue, 2010-01-12 02:43

I've only just started using Gallery, but I'm liking it a whole lot.

My setup is one where I have a Linux server in my house running SAMBA. I connect a drive to it from my Windows machine, and copy large quantities of pictures to it at a time. When I dump the files from my camera, I have two files for every picture because I shoot in JPEG+RAW mode. I'd like to be able to filter the files while I'm adding them so that I don't add two copies of every picture into Gallery.

BTW: When I add, I use the symlink mode and leave all of the original files in place - there's no sense in having two copies of every picture file on my server. And moving them from an upload directory to somewhere else for client access makes no sense to me... Especially considering that I have multiple people copying picture files to the server.

Can I add files of only one type? For example, add the JPG files, but not the RAW (NEF) files?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2010-01-12 03:01

I think, (I'm not sure), if you uninstall the Dcraw plugin so that Gallery can't process the RAW files, then it may not know about them and you can select just the "known" formats option.

Scratch that, it doesn't work :)

This may work (it appears to work in my testing) If you install MIME Maintenance plugin, you can add a new mime type and block it from being uploaded.

1) Install the MIME Maintenance plugin under Site Admin > Plugins (if you don't see it there, try downloading and installing from the Get More Plugins tab)

2) Then go to Site Admin > MIME Maintenance and click Add New MIME Type

3) Enter image/x-nikon-nef (probably not exactly important) for the MIME type

4) Enter nef for the extension

5) Save

6) Now on the main MIME Maintenance page select the radio button for "Block upload of types selected below" and scroll down and check the checkbox for blocking the upload for the MIME type you just created.

7) Scroll back up and click Save

Now you can select them all and it appears (I'm not 100% as I took a dummy file and named it test.nef) to ignore those files on uploading into Gallery.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
meburdick

Joined: 2010-01-12
Posts: 3
Posted: Tue, 2010-01-12 23:14

So... I tried what you suggested, and it really didn't work.

I have about 950 items in one folder. Just less than half of them are JPG, just less than half are NEF, and a very few of them are MOV. I didn't have to create the MIME type because there was already one there. I modified the MIME settings to allow upload of only specific types, and NEF was NOT one of them.

When I attempted to add the items in the folder, it appeared at first that the filter was working because the page showed that the NEF files were blocked. I didn't scroll all the way down the page to see if it was a consistent list. What I noticed is that just fewer than 900 items were added to the library.

Upon further investigation, I found that about 25-30 of the NEF files were blocked, but THAT WAS IT. Every other NEF file was actually added to the library.

Other thoughts?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2010-01-12 23:20

Sounds like there might be a bug there. Try reversing the logic so you are specifically blocking NEF filetypes, otherwise I don't know.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
meburdick

Joined: 2010-01-12
Posts: 3
Posted: Tue, 2010-02-02 00:51

Ok...

I've gone through this a few more times. I swapped the logic to allow everything except types specifically blocked. I edited the DCRAW type and removed the "NEF" extension from it. I created a new MIME type and assigned the "NEF" extension to that type. I specified the new type as one to explicitly block.

I've run a number of so-called tests (basically imported a number of different libraries of different sizes). I haven't yet put my finger on the number that it takes to break it, but I've definitely witnessed the explicit block (or allow, for that matter) only working up to a certain number of files. Once that "magic number" is passed, it imports all files regardless of the rules.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2010-02-02 01:05

This programming is above my head and it would take me hours of trial and error which I'm not going to do to get into it. You might be able to get some help on #gallery in IRC, or hope someone who knows more than I stumbles across this thread.

This is a total guess, but just based on that it appears the files are processed in chunks, I'd start digging around in:
/modules/itemadd/ItemAddFromServer.inc

Maybe around line 112 and below or possibly line 166 where it appears the items start getting added. But the item list to be added is already created so it might be in the bit above that (around line 112 and below) where it creates that list.

I see numbers of 200, 500, 50 and 100 so it might be breaking at one of those intervals. Or it could be around line 495 under the _getFileCountForDirectory function. I've only looked at this file for about 30 seconds so I haven't studied it at any length yet.

Or it could be in the mime module....
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here