Search in sources :

Example 11 with SoftLocator

use of org.fagu.fmv.soft.find.SoftLocator in project fmv by f-agu.

the class FFSoftProvider method getSoftLocator.

/**
 * @see org.fagu.fmv.soft.find.SoftProvider#getSoftLocator()
 */
@Override
public SoftLocator getSoftLocator() {
    SoftLocator softLocator = super.getSoftLocator();
    softLocator.enableCacheInSameFolderOfGroup(getGroupName());
    if (SystemUtils.IS_OS_WINDOWS) {
        softLocator.addDefaultLocator();
        ProgramFilesLocatorSupplier.with(softLocator).find(programFile -> {
            List<File> files = new ArrayList<>();
            File[] folders = programFile.listFiles(f -> f.getName().toLowerCase().startsWith("ffmpeg"));
            if (folders != null) {
                for (File folder : folders) {
                    files.add(folder);
                    files.add(new File(folder, "bin"));
                }
            }
            return files;
        }).supplyIn();
    }
    return softLocator;
}
Also used : VersionParseException(org.fagu.version.VersionParseException) VersionParserManager(org.fagu.version.VersionParserManager) Date(java.util.Date) SimpleDateFormat(java.text.SimpleDateFormat) SoftFound(org.fagu.fmv.soft.find.SoftFound) HashMap(java.util.HashMap) ProgramFilesLocatorSupplier(org.fagu.fmv.soft.win32.ProgramFilesLocatorSupplier) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) SoftProvider(org.fagu.fmv.soft.find.SoftProvider) Matcher(java.util.regex.Matcher) Locale(java.util.Locale) Map(java.util.Map) ParseException(java.text.ParseException) ExceptionKnownAnalyzer(org.fagu.fmv.soft.exec.exception.ExceptionKnownAnalyzer) LinkedHashSet(java.util.LinkedHashSet) SoftFoundFactory(org.fagu.fmv.soft.find.SoftFoundFactory) SoftLocator(org.fagu.fmv.soft.find.SoftLocator) VersionUnit(org.fagu.version.VersionUnit) SystemUtils(org.apache.commons.lang3.SystemUtils) Set(java.util.Set) IOException(java.io.IOException) FFExceptionKnownAnalyzer(org.fagu.fmv.ffmpeg.exception.FFExceptionKnownAnalyzer) File(java.io.File) List(java.util.List) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Pattern(java.util.regex.Pattern) Version(org.fagu.version.Version) SoftLocator(org.fagu.fmv.soft.find.SoftLocator) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File)

Example 12 with SoftLocator

use of org.fagu.fmv.soft.find.SoftLocator in project fmv by f-agu.

the class IMSoftProvider method getSoftLocator.

/**
 * @see org.fagu.fmv.soft.find.SoftProvider#getSoftLocator()
 */
@Override
public SoftLocator getSoftLocator() {
    SoftLocator softLocator = super.getSoftLocator();
    softLocator.enableCacheInSameFolderOfGroup(getGroupName());
    if (SystemUtils.IS_OS_WINDOWS) {
        softLocator.addDefaultLocator();
        ProgramFilesLocatorSupplier.with(softLocator).findFolder(folder -> folder.getName().toLowerCase().startsWith("imagemagick")).supplyIn();
    }
    return softLocator;
}
Also used : VersionParserManager(org.fagu.version.VersionParserManager) IMExceptionKnownAnalyzer(org.fagu.fmv.im.exception.IMExceptionKnownAnalyzer) Date(java.util.Date) VersionSoftInfo(org.fagu.fmv.soft.find.info.VersionSoftInfo) SimpleDateFormat(java.text.SimpleDateFormat) ProgramFilesLocatorSupplier(org.fagu.fmv.soft.win32.ProgramFilesLocatorSupplier) ArrayList(java.util.ArrayList) SoftProvider(org.fagu.fmv.soft.find.SoftProvider) Matcher(java.util.regex.Matcher) VersionSoftPolicy(org.fagu.fmv.soft.find.policy.VersionSoftPolicy) ObjectUtils(org.apache.commons.lang3.ObjectUtils) ExceptionKnownAnalyzer(org.fagu.fmv.soft.exec.exception.ExceptionKnownAnalyzer) Soft(org.fagu.fmv.soft.Soft) SoftFoundFactory(org.fagu.fmv.soft.find.SoftFoundFactory) SoftLocator(org.fagu.fmv.soft.find.SoftLocator) SoftPolicy(org.fagu.fmv.soft.find.SoftPolicy) SystemUtils(org.apache.commons.lang3.SystemUtils) SoftInfo(org.fagu.fmv.soft.find.SoftInfo) File(java.io.File) VersionDate(org.fagu.fmv.soft.find.ExecSoftFoundFactory.VersionDate) VersionSoftPolicy.minVersion(org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion) List(java.util.List) FileFilter(java.io.FileFilter) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) Version(org.fagu.version.Version) SoftExecutor(org.fagu.fmv.soft.SoftExecutor) FilenameUtils(org.apache.commons.io.FilenameUtils) SoftLocator(org.fagu.fmv.soft.find.SoftLocator)

Aggregations

SoftLocator (org.fagu.fmv.soft.find.SoftLocator)12 File (java.io.File)6 Matcher (java.util.regex.Matcher)6 Pattern (java.util.regex.Pattern)6 SystemUtils (org.apache.commons.lang3.SystemUtils)6 SoftFoundFactory (org.fagu.fmv.soft.find.SoftFoundFactory)6 SoftProvider (org.fagu.fmv.soft.find.SoftProvider)6 ProgramFilesLocatorSupplier (org.fagu.fmv.soft.win32.ProgramFilesLocatorSupplier)6 VersionParserManager (org.fagu.version.VersionParserManager)6 SoftPolicy (org.fagu.fmv.soft.find.SoftPolicy)5 VersionSoftPolicy (org.fagu.fmv.soft.find.policy.VersionSoftPolicy)5 VersionSoftPolicy.minVersion (org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ObjectUtils (org.apache.commons.lang3.ObjectUtils)4 ExceptionKnownAnalyzer (org.fagu.fmv.soft.exec.exception.ExceptionKnownAnalyzer)4 Version (org.fagu.version.Version)4 IOException (java.io.IOException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Arrays (java.util.Arrays)3