def createJobFromImageFiles(self, filenames=None):
     """
     Create a job containing all images to convert
     @param: filenames List of images files
     @return: a Job instance containing all images to convert
     """
     masterJob = Job()
     for filename in filenames:
         job = self.createJobFromImageFile(filename)
         masterJob.addJob(job)
     return masterJob
    def createJobFromMediaDirectory(self,
                                    mediaDirectoryPath,
                                    videoFileExtensions,
                                    imageFileExtensions):
        """
        Creates a job to convert all supported media files. 
        @param: mediaDirectoryPath Path to media directory
        @param: videoFileExtensions List of video file extensions
        @param: imageFileExtensions List of audio file extensions
        @return: a Job instance containing all jobs to execute.
        """
        filenames = list()
        selectedVideoFilenames = list()
        selectedImageFilenames = list()
        # Retrieve list of all files in directory
        for root, dirs, files in os.walk(os.path.abspath(mediaDirectoryPath),
                                         topdown=False):
            for name in files:
                filename = os.path.join(root, name)
                filenames.append(filename)

        # Filter based on several criteriae
        for filename in filenames:
            fileExtension = os.path.splitext(filename)[1][1:].strip()
            fileNameWithoutExtension = os.path.splitext(filename)[0].strip()
            fileBasenameWithoutExtension = basename(fileNameWithoutExtension)
            fileExtensionLowerCase = fileExtension.lower()
            # Accept only non hidden files with specific file extension
            if (len(fileBasenameWithoutExtension) > 0 and
                    len(fileExtensionLowerCase) > 0):
                if fileExtensionLowerCase in videoFileExtensions:
                    selectedVideoFilenames.append(filename)
                elif fileExtensionLowerCase in imageFileExtensions:
                    selectedImageFilenames.append(filename)

        masterJob = Job()
        videoJob = self.createJobFromVideoFiles(selectedVideoFilenames)
        masterJob.addJob(videoJob)
        imageJob = self.createJobFromImageFiles(selectedImageFilenames)
        masterJob.addJob(imageJob)
        return masterJob