Search in sources :

Example 1 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class BuildMapping method versionDateMap.

// *************************************************
/**
 * @return
 */
private static NavigableMap<Version, LocalDate> versionDateMap() {
    NavigableMap<Version, LocalDate> map = new TreeMap<>();
    map.put(new Version(3, 2, 2), LocalDate.of(2016, 12, 16));
    map.put(new Version(3, 2), LocalDate.of(2016, 11, 6));
    map.put(new Version(3, 1, 5), LocalDate.of(2016, 10, 24));
    map.put(new Version(3, 1, 4), LocalDate.of(2016, 10, 19));
    map.put(new Version(3, 0, 1), LocalDate.of(2016, 10, 19));
    map.put(new Version(3), LocalDate.of(2016, 2, 17));
    map.put(new Version(2, 8, 6), LocalDate.of(2016, 2, 3));
    map.put(new Version(2, 8, 5), LocalDate.of(2016, 1, 15));
    map.put(new Version(2, 8, 4), LocalDate.of(2015, 12, 23));
    map.put(new Version(2, 8, 3), LocalDate.of(2015, 12, 3));
    map.put(new Version(2, 8, 2), LocalDate.of(2015, 12, 3));
    map.put(new Version(2, 8, 1), LocalDate.of(2015, 10, 15));
    map.put(new Version(2, 8), LocalDate.of(2015, 10, 06));
    map.put(new Version(2, 7), LocalDate.of(2015, 6, 12));
    map.put(new Version(2, 5, 2), LocalDate.of(2014, 12, 30));
    map.put(new Version(2, 4, 5), LocalDate.of(2014, 12, 30));
    map.put(new Version(2, 2, 11), LocalDate.of(2014, 12, 30));
    map.put(new Version(1, 2, 11), LocalDate.of(2014, 12, 30));
    map.put(new Version(2, 2, 3), LocalDate.of(2014, 6, 19));
    map.put(new Version(2, 2, 2), LocalDate.of(2014, 5, 22));
    map.put(new Version(2, 2, 1), LocalDate.of(2014, 4, 10));
    map.put(new Version(2, 1, 4), LocalDate.of(2014, 2, 26));
    map.put(new Version(2, 1, 3), LocalDate.of(2014, 1, 21));
    map.put(new Version(2, 1, 1), LocalDate.of(2013, 11, 20));
    map.put(new Version(2, 1), LocalDate.of(2013, 10, 30));
    map.put(new Version(2, 0, 2), LocalDate.of(2013, 10, 26));
    map.put(new Version(2, 0, 1), LocalDate.of(2013, 9, 26));
    map.put(new Version(1, 2), LocalDate.of(2013, 3, 27));
    map.put(new Version(1, 1, 3), LocalDate.of(2013, 3, 03));
    map.put(new Version(1, 1, 1), LocalDate.of(2013, 1, 20));
    map.put(new Version(1, 1), LocalDate.of(2013, 1, 8));
    map.put(new Version(1, 0, 1), LocalDate.of(2013, 1, 2));
    map.put(new Version(0, 8), LocalDate.of(2011, 6, 23));
    map.put(new Version(0, 7, 1), LocalDate.of(2011, 6, 23));
    return map;
}
Also used : Version(org.fagu.version.Version) TreeMap(java.util.TreeMap) LocalDate(java.time.LocalDate)

Example 2 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class FFSoftPolicy method toSoftFound.

/**
 * @param ffInfo
 * @return
 */
public static SoftFound toSoftFound(FFInfo ffInfo) {
    Objects.requireNonNull(ffInfo);
    Version version = ffInfo.getVersion();
    if (version != null) {
        return check(version.isUpperOrEqualsThan(MIN_VERSION), ffInfo);
    }
    Integer builtVersion = ffInfo.getBuiltVersion();
    if (builtVersion != null) {
        return check(builtVersion > MIN_BUILD_VERSION, ffInfo);
    }
    Date builtDate = ffInfo.getBuiltDate();
    if (builtDate != null) {
        return check(builtDate.getTime() > MIN_TIME, ffInfo);
    }
    return SoftFound.foundError(ffInfo.getFile(), "Unable to verify the soft: " + ffInfo);
}
Also used : Version(org.fagu.version.Version) Date(java.util.Date)

Example 3 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class FFSoftProvider method createParser.

// ***********************************************************************
/**
 * @param file
 * @return
 */
Parser createParser(File file) {
    return new Parser() {

        private static final String CONFIGURATION_START_PATTERN = "configuration:";

        private Version version = null;

        private Date builtDate = null;

        // configuration
        private Set<String> configuration = null;

        // lib versions
        private Map<String, Version> libVersions = new HashMap<>();

        private SoftFound softFound;

        @Override
        public void readLine(final String lineIn) {
            if (StringUtils.isBlank(lineIn) || softFound != null) {
                return;
            }
            String line = lineIn.trim();
            // version
            Matcher matcher = FF_FIRSTLINE_PATTERN.matcher(line);
            if (matcher.matches()) {
                String parsedTool = matcher.group(1).trim();
                if (parsedTool.equalsIgnoreCase(getName())) {
                    version = getVersion(matcher.group(2).trim());
                    return;
                }
                softFound = SoftFound.foundError(file, "Wrong tool, need " + getName() + " and found " + parsedTool + ": " + line);
            }
            // configuration
            if (line.startsWith(CONFIGURATION_START_PATTERN)) {
                configuration = getConfiguration(StringUtils.substringAfter(line, CONFIGURATION_START_PATTERN).trim());
                return;
            }
            // built
            matcher = BUILD_PATTERN.matcher(line);
            if (matcher.matches()) {
                builtDate = getBuiltDate(matcher);
                return;
            }
            // lib versions
            matcher = LIBVERSION_PATTERN.matcher(line);
            if (matcher.matches()) {
                addLibVersions(libVersions, matcher);
            }
        }

        @Override
        public SoftFound closeAndParse(String cmdLineStr, int exitValue) throws IOException {
            if (softFound != null) {
                return softFound;
            }
            Integer builtVersion = null;
            if (version != null && version.size() == 1) {
                final int minBuildVersion = 100;
                int major = version.getFieldValue(VersionUnit.VF_0_MAJOR, 0);
                // N-70767-gd24af70
                if (major > minBuildVersion) {
                    builtVersion = major;
                    version = null;
                }
            }
            FFInfo ffInfo = new FFInfo(file, version, getName(), builtDate, builtVersion, configuration, libVersions);
            return FFSoftPolicy.toSoftFound(ffInfo);
        }
    };
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) Version(org.fagu.version.Version) Matcher(java.util.regex.Matcher) SoftFound(org.fagu.fmv.soft.find.SoftFound) HashMap(java.util.HashMap) Map(java.util.Map) Date(java.util.Date) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser)

Example 4 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class FFInfoTestCase method testFFMPEGFull_v2_6_1.

/**
 * @throws Exception
 */
@Test
public void testFFMPEGFull_v2_6_1() throws Exception {
    Parser parser = newParserFFMpeg();
    parser.readLine("ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers");
    parser.readLine("built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)");
    parser.readLine("configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab");
    parser.readLine("libavutil      54. 20.100 / 54. 20.100");
    parser.readLine("libavcodec     56. 26.100 / 56. 26.100");
    parser.readLine("libavformat    56. 25.101 / 56. 25.101");
    parser.readLine("libavdevice    56.  4.100 / 56.  4.100");
    parser.readLine("libavfilter     5. 11.102 /  5. 11.102");
    parser.readLine("libavresample   2.  1.  0 /  2.  1.  0");
    parser.readLine("libswscale      3.  1.101 /  3.  1.101");
    parser.readLine("libswresample   1.  1.100 /  1.  1.100");
    assertFull(parser, new Version(2, 6, 1), date(2014, 12, 30), null);
}
Also used : Version(org.fagu.version.Version) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Test(org.junit.Test)

Example 5 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class FFInfoTestCase method testFFProbeFull_v2_6_1.

/**
 * @throws Exception
 */
@Test
public void testFFProbeFull_v2_6_1() throws Exception {
    Parser parser = newParserProbe();
    parser.readLine("ffprobe version 2.6.1 Copyright (c) 2007-2015 the FFmpeg developers");
    parser.readLine("built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)");
    parser.readLine("configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab");
    parser.readLine("libavutil      54. 20.100 / 54. 20.100");
    parser.readLine("libavcodec     56. 26.100 / 56. 26.100");
    parser.readLine("libavformat    56. 25.101 / 56. 25.101");
    parser.readLine("libavdevice    56.  4.100 / 56.  4.100");
    parser.readLine("libavfilter     5. 11.102 /  5. 11.102");
    parser.readLine("libavresample   2.  1.  0 /  2.  1.  0");
    parser.readLine("libswscale      3.  1.101 /  3.  1.101");
    parser.readLine("libswresample   1.  1.100 /  1.  1.100");
    parser.readLine("libpostproc    53.  3.100 / 53.  3.100");
    assertFull(parser, new Version(2, 6, 1), date(2014, 12, 30), null);
}
Also used : Version(org.fagu.version.Version) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Test(org.junit.Test)

Aggregations

Version (org.fagu.version.Version)24 Test (org.junit.Test)16 Parser (org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser)15 Date (java.util.Date)3 SoftFound (org.fagu.fmv.soft.find.SoftFound)3 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 SoftExecutor (org.fagu.fmv.soft.SoftExecutor)2 SoftInfo (org.fagu.fmv.soft.find.SoftInfo)2 SoftPolicy (org.fagu.fmv.soft.find.SoftPolicy)2 VersionSoftPolicy (org.fagu.fmv.soft.find.policy.VersionSoftPolicy)2 VersionSoftPolicy.minVersion (org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion)2 File (java.io.File)1 IOException (java.io.IOException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 LocalDate (java.time.LocalDate)1 Arrays (java.util.Arrays)1 Calendar (java.util.Calendar)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1