All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.swamim.media.organizer.OrganizerConfiguration Maven / Gradle / Ivy

There is a newer version: 1.1
Show newest version
package com.github.swamim.media.organizer;

import com.github.swamim.media.organizer.files.CopyMode;
import com.github.swamim.media.organizer.files.OverwriteMode;

import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

class OrganizerConfiguration {

    static final String FOLDER_NAME_FOR_MEDIA_WITH_NO_EXIF_DATA = "NOEXIF";

    private final String exifToolPath;
    private final Set imageFileExtensions;
    private final Set videoFileExtensions;
    private final Set sourceDirectories;
    private final Set targetImageDirectories;
    private final Set targetVideoDirectories;
    private final CopyMode copyMode;
    private final OverwriteMode overwriteMode;

    OrganizerConfiguration(String exifToolPath, Set imageFileExtensions, Set videoFileExtensions,
                           Set sourceDirectories, Set targetImageDirectories, Set targetVideoDirectories,
                           CopyMode copyMode, OverwriteMode overwriteMode) {
        this.exifToolPath = exifToolPath;
        this.imageFileExtensions = Collections.unmodifiableSet(new HashSet<>(imageFileExtensions));
        this.videoFileExtensions = Collections.unmodifiableSet(new HashSet<>(videoFileExtensions));
        this.sourceDirectories = Collections.unmodifiableSet(new HashSet<>(sourceDirectories));
        this.targetImageDirectories = Collections.unmodifiableSet(new HashSet<>(targetImageDirectories));
        this.targetVideoDirectories = Collections.unmodifiableSet(new HashSet<>(targetVideoDirectories));
        this.copyMode = copyMode;
        this.overwriteMode = overwriteMode;
    }

    String getExifToolPath() {
        return exifToolPath;
    }

    Set getImageFileExtensions() {
        return imageFileExtensions;
    }

    Set getVideoFileExtensions() {
        return videoFileExtensions;
    }

    Set getSourceDirectories() {
        return sourceDirectories;
    }

    Set getTargetImageDirectories() {
        return targetImageDirectories;
    }

    Set getTargetVideoDirectories() {
        return targetVideoDirectories;
    }

    CopyMode getCopyMode() {
        return copyMode;
    }

    OverwriteMode getOverwriteMode() {
        return overwriteMode;
    }

    @Override
    public String toString() {
        return "\r\n***************************************************************   CONFIGURATION   ***************************************************************\r\n" +
                "* EXIF Tool Path                           : " + exifToolPath + "\r\n" +
                "* Image File Extensions                    : " + imageFileExtensions + "\r\n" +
                "* Video File Extensions                    : " + videoFileExtensions + "\r\n" +
                "* Media Source Directories                 : " + sourceDirectories + "\r\n" +
                "* Save Images to Directories               : " + targetImageDirectories + "\r\n" +
                "* Save Videos to Directories               : " + targetVideoDirectories + "\r\n" +
                "* Save Non Exif Images to Directories      : " + targetImageDirectories.stream().map(d -> d + File.separator + FOLDER_NAME_FOR_MEDIA_WITH_NO_EXIF_DATA).collect(Collectors.toSet()) + "\r\n" +
                "* Save Non Exif Videos to Directories      : " + targetVideoDirectories.stream().map(d -> d + File.separator + FOLDER_NAME_FOR_MEDIA_WITH_NO_EXIF_DATA).collect(Collectors.toSet()) + "\r\n" +
                "* COPY/ MOVE Media from source to target   : " + copyMode + "\r\n" +
                "* Overwrite Mode                           : " + overwriteMode + "\r\n" +
                "*************************************************************************************************************************************************\r\n";
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy