folders2flickr icon indicating copy to clipboard operation
folders2flickr copied to clipboard

Many path to upload images from

Open replay111 opened this issue 10 years ago • 4 comments

Hi,

is it possible to type more than one path in init file i.e.:

imagedir = /home/my_images/cars,/home/my_images/planes,/home/my_images/kids

or like:

imagedir[] = /home/my_images/cars imagedir[] = /home/my_images/planes imagedir[] = /home/my_images/kids

so app could proces a couple path, not only pic from one path?

replay111 avatar Nov 11 '14 08:11 replay111

bearing in mind that I've never done any python before, would this not work? I think this would split on semicolon

def grabNewImages(manydirname):                                                                                                             
    """                                                                                                                                     
    get all images in folders and subfolders which match extensions below                                                                   
    """                                                                                                                                     
    images = []                                                                                                                             
    manydirname = manydirname.split(";")                                                                                                    
    for dirname in manydirname:                                                                                                             
        for dirpath, dirnames, filenames in os.walk(dirname, topdown=True, followlinks=True):                                               
                ignore = '.f2fignore' in filenames                                                                                          
                # use os.stat here                                                                                                          
                ignoreglobs = []                                                                                                            
                if ignore:                                                                                                                  
                        fp = open(os.path.normpath(os.path.join(dirpath, '.f2fignore')))                                                    
                        ignoreglobs = parseIgnore(fp.readlines())                                                                           
                        fp.close()                                                                                                          
                dirnames[:] = [d for d in dirnames if not d[0] == '.'                                                                       
                                           and not ignoreMatch(d, ignoreglobs)]                                                             
                for f in filenames:                                                                                                         
                        if f.startswith('.'):                                                                                               
                                continue                                                                                                    
                        ext = f.lower().split(".")[-1]                                                                                      
                        if ext in ALLOWED_EXT and not ignoreMatch(f, ignoreglobs):                                                          
                                images.append(os.path.normpath(os.path.join(dirpath, f)))                                                   
    images.sort()                                                                                                                           
    return images                                                                                             

lozbrown avatar Dec 02 '14 10:12 lozbrown

The above will make it find photos in each of the locations but seems to have broken something with the creation of sets. @richq any ideas?

2014-12-07 06:45:18,881 tags2set: Cannot create set "" 2014-12-07 06:45:18,881 list index out of range 2014-12-07 06:45:18,881 <type 'exceptions.IndexError'> 2014-12-07 06:45:18,881 tags2set: Cannot edit set 2014-12-07 06:45:18,881 'NoneType' object has no attribute 'editPhotos' 2014-12-07 06:45:18,881 <type 'exceptions.AttributeError'>

lozbrown avatar Dec 07 '14 07:12 lozbrown

I've had a quick look and it's nothing wrong with this code. It just adds an outer loop over the semicolon separated strings. I wrote a couple of tests to check that the code works as expected, and the existing (low number of) tests pass OK so there's no big regressions there.

The problem looks to be where IMAGE_DIR is used to get the folderTag. That'd need some fiddling too to get it to work.

richq avatar Dec 10 '14 20:12 richq

Thanks for taking a look @richq

I'm not much of a python programer: Could images (the list that is returned by grabNewImages) be turned into an array with the original folder and the image itself being added to the aray.... or Somehow trim back the image path to the one we originally had ..?

lozbrown avatar Dec 11 '14 13:12 lozbrown