Logo Search packages:      
Sourcecode: lazygal version File versions  Download package

def lazygal::generators::Directory::guess_directory_picture (   self,
  subdir = None 
)
Guesses picture for directory by finding first suitable image.

Definition at line 301 of file generators.py.

                                                    :
        '''
        Guesses picture for directory by finding first suitable image.
        '''
        directory = self.source
        relpath = ''

        if subdir is not None:
            directory = os.path.join(directory, subdir)
            relpath = subdir

        for root, dirs, files in os.walk(directory):
            subdirs = root[len(directory):]
            if len(subdirs) > 0 and subdirs[0] == '/':
                subdirs = subdirs[1:]
            for file in files:
                if self.album.is_ext_supported(file):
                    picture = os.path.join(relpath, subdirs, file)
                    return picture

        return None


Generated by  Doxygen 1.6.0   Back to index