예제 #1
0
    def test_rotation(self):

        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load 1 album with same photo under different name
        tu.load_photoset("rotation")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        photos = tu.get_photos(tu.get_album_id('rotation'))
        for p in photos:
            # rotation tag is gone
            pfullpath = os.path.join(lych, "uploads", "big", p['url'])
            img = Image.open(pfullpath)
            assert "exif" in img.info, "Pas d'info exif"
            exif_dict = piexif.load(img.info["exif"])
            assert exif_dict["0th"][
                piexif.ImageIFD.Orientation] == 1, "Exif rotation should be 1"
            img.close()
예제 #2
0
    def test_photoid_equal_timestamp(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load 1 album with same photo under different name
        tu.load_photoset("album3")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']
        # normal mode
        before_launch = datetime.datetime.now()
        time.sleep(1.1)

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        time.sleep(1.1)
        after_launch = datetime.datetime.now()
        photos = tu.get_photos(tu.get_album_id('album3'))
        for p in photos:
            logger.info(p)
            # substract 4 last characters
            ts = str(p['id'])[:-4]

            # timestamp to date
            dt = datetime.datetime.fromtimestamp(int(ts))
            logger.info(dt)
            assert after_launch > dt, "date from id not < date after launch"
            assert dt > before_launch, "date from id not > date before launch"
예제 #3
0
    def test_rotation(self):

        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load 1 album with same photo under different name
        tu.load_photoset("rotation")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        photos = tu.get_photos(tu.get_album_id('rotation'))
        for p in photos:
            # rotation tag is gone
            pfullpath = os.path.join(lych, "uploads", "big", p['url'])
            img = Image.open(pfullpath)
            assert "exif" in img.info, "Pas d'info exif"
            exif_dict = piexif.load(img.info["exif"])
            assert exif_dict["0th"][piexif.ImageIFD.Orientation] == 1, "Exif rotation should be 1"
            img.close()
예제 #4
0
    def test_shutter_speed(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load 1 album with same photo under different name
        tu.load_photoset("rotation")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        photos = tu.get_photos(tu.get_album_id('rotation'))
        for p in photos:
            if p['title'] == 'P1010319.JPG':
                assert p['shutter'] == '1/60 s', "shutter {} not equal 1/60 s".format(p['shutter'])
                assert p['focal'] == '4.9 mm', "focal {} not equal 4.9 mm".format(p['focal'])
                assert p['iso'] == '100', "iso {} not equal 100".format(p['iso'])
                assert p['aperture'] == 'F3.3', "aperture {} not equal F3.3".format(p['aperture'])
            if p['title'] == 'P1010328.JPG':
                assert p['shutter'] == '1/30 s', "shutter {} not equal 1/30 s".format(p['shutter'])
                assert p['focal'] == '4.9 mm', "focal {} not equal 4.9 mm".format(p['focal'])
                assert p['iso'] == '400', "iso {} not equal 400".format(p['iso'])
                assert p['aperture'] == 'F3.3', "aperture {} not equal F3.3".format(p['aperture'])
예제 #5
0
    def test_photoid_equal_timestamp(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load 1 album with same photo under different name
        tu.load_photoset("album3")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']
        # normal mode
        before_launch = datetime.datetime.now()
        time.sleep(1.1)

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        time.sleep(1.1)
        after_launch = datetime.datetime.now()
        photos = tu.get_photos(tu.get_album_id('album3'))
        for p in photos:
            logger.info(p)
            # substract 4 last characters
            ts = str(p['id'])[:-4]

            # timestamp to date
            dt = datetime.datetime.fromtimestamp(int(ts))
            logger.info(dt)
            assert after_launch > dt, "date from id not < date after launch"
            assert dt > before_launch, "date from id not > date before launch"
예제 #6
0
    def test_shutter_speed(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load 1 album with same photo under different name
        tu.load_photoset("rotation")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        photos = tu.get_photos(tu.get_album_id('rotation'))
        for p in photos:
            if p['title'] == 'P1010319.JPG':
                assert p[
                    'shutter'] == '1/60 s', "shutter {} not equal 1/60 s".format(
                        p['shutter'])
                assert p[
                    'focal'] == '4.9 mm', "focal {} not equal 4.9 mm".format(
                        p['focal'])
                assert p['iso'] == '100', "iso {} not equal 100".format(
                    p['iso'])
                assert p[
                    'aperture'] == 'F3.3', "aperture {} not equal F3.3".format(
                        p['aperture'])
            if p['title'] == 'P1010328.JPG':
                assert p[
                    'shutter'] == '1/30 s', "shutter {} not equal 1/30 s".format(
                        p['shutter'])
                assert p[
                    'focal'] == '4.9 mm', "focal {} not equal 4.9 mm".format(
                        p['focal'])
                assert p['iso'] == '400', "iso {} not equal 400".format(
                    p['iso'])
                assert p[
                    'aperture'] == 'F3.3', "aperture {} not equal F3.3".format(
                        p['aperture'])