Rename dozo to ordigi

This commit is contained in:
Cédric Leporcq 2021-08-14 21:28:40 +02:00
parent 817b84152f
commit 11ad41da09
6 changed files with 40 additions and 42 deletions

View File

@ -6,10 +6,10 @@ from pathlib import Path
import shutil
import tempfile
from dozo import config
from dozo.exiftool import _ExifToolProc
from ordigi import config
from ordigi.exiftool import _ExifToolProc
DOZO_PATH = Path(__file__).parent.parent
ORDIGI_PATH = Path(__file__).parent.parent
@pytest.fixture(autouse=True)
def reset_singletons():
@ -18,8 +18,8 @@ def reset_singletons():
def copy_sample_files():
src_path = tempfile.mkdtemp(prefix='dozo-src')
paths = Path(DOZO_PATH, 'samples/test_exif').glob('*')
src_path = tempfile.mkdtemp(prefix='ordigi-src')
paths = Path(ORDIGI_PATH, 'samples/test_exif').glob('*')
file_paths = [x for x in paths if x.is_file()]
for file_path in file_paths:
source_path = Path(src_path, file_path.name)
@ -30,7 +30,7 @@ def copy_sample_files():
@pytest.fixture(scope="module")
def conf_path():
tmp_path = tempfile.mkdtemp(prefix='dozo-')
tmp_path = tempfile.mkdtemp(prefix='ordigi-')
conf = RawConfigParser()
conf['Path'] = {
'day_begins': '4',
@ -40,7 +40,7 @@ def conf_path():
conf['Geolocation'] = {
'geocoder': 'Nominatium'
}
conf_path = Path(tmp_path, "dozo.conf")
conf_path = Path(tmp_path, "ordigi.conf")
config.write(conf_path, conf)
yield conf_path

View File

@ -4,7 +4,7 @@ import shutil
import tempfile
from unittest import mock
from dozo import config
from ordigi import config
# Helpers
import random

View File

@ -2,7 +2,7 @@ import pytest
CONTENT = "content"
class TestDozo:
class TestOrdigi:
@pytest.mark.skip()
def test__sort(self):
assert 0

View File

@ -1,8 +1,8 @@
import json
import pytest
import dozo.exiftool
from dozo.exiftool import get_exiftool_path
import ordigi.exiftool
from ordigi.exiftool import get_exiftool_path
TEST_FILE_ONE_KEYWORD = "samples/images/wedding.jpg"
TEST_FILE_BAD_IMAGE = "samples/images/badimage.jpeg"
@ -103,86 +103,86 @@ if exiftool is None:
def test_get_exiftool_path():
exiftool = dozo.exiftool.get_exiftool_path()
exiftool = ordigi.exiftool.get_exiftool_path()
assert exiftool is not None
def test_version():
exif = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif.version is not None
assert isinstance(exif.version, str)
def test_read():
exif = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif.data["File:MIMEType"] == "image/jpeg"
assert exif.data["EXIF:ISO"] == 160
assert exif.data["IPTC:Keywords"] == "wedding"
def test_singleton():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif2 = dozo.exiftool.ExifTool(TEST_FILE_MULTI_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif2 = ordigi.exiftool.ExifTool(TEST_FILE_MULTI_KEYWORD)
assert exif1._process.pid == exif2._process.pid
def test_pid():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif1.pid == exif1._process.pid
def test_exiftoolproc_process():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif1._exiftoolproc.process is not None
def test_exiftoolproc_exiftool():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif1._exiftoolproc.exiftool == dozo.exiftool.get_exiftool_path()
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif1._exiftoolproc.exiftool == ordigi.exiftool.get_exiftool_path()
def test_as_dict():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exifdata = exif1.asdict()
assert exifdata["XMP:TagsList"] == "wedding"
def test_as_dict_normalized():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exifdata = exif1.asdict(normalized=True)
assert exifdata["xmp:tagslist"] == "wedding"
assert "XMP:TagsList" not in exifdata
def test_as_dict_no_tag_groups():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exifdata = exif1.asdict(tag_groups=False)
assert exifdata["TagsList"] == "wedding"
def test_json():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exifdata = json.loads(exif1.json())
assert exifdata[0]["XMP:TagsList"] == "wedding"
def test_str():
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert "file: " in str(exif1)
assert "exiftool: " in str(exif1)
def test_exiftool_terminate():
""" Test that exiftool process is terminated when exiftool.terminate() is called """
exif1 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif1 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert dozo.exiftool.exiftool_is_running()
assert ordigi.exiftool.exiftool_is_running()
dozo.exiftool.terminate_exiftool()
ordigi.exiftool.terminate_exiftool()
assert not dozo.exiftool.exiftool_is_running()
assert not ordigi.exiftool.exiftool_is_running()
# verify we can create a new instance after termination
exif2 = dozo.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
exif2 = ordigi.exiftool.ExifTool(TEST_FILE_ONE_KEYWORD)
assert exif2.asdict()["IPTC:Keywords"] == "wedding"

View File

@ -8,11 +8,11 @@ from sys import platform
from time import sleep
from .conftest import copy_sample_files
from dozo import constants
from dozo.database import Db
from dozo.filesystem import FileSystem
from dozo.media.media import Media
from dozo.exiftool import ExifToolCaching, exiftool_is_running, terminate_exiftool
from ordigi import constants
from ordigi.database import Db
from ordigi.filesystem import FileSystem
from ordigi.media import Media
from ordigi.exiftool import ExifToolCaching, exiftool_is_running, terminate_exiftool
@pytest.mark.skip()

View File

@ -6,14 +6,12 @@ import shutil
import tempfile
from .conftest import copy_sample_files
from dozo import constants
from dozo.media.media import Media
from dozo.media.audio import Audio
from dozo.media.photo import Photo
from dozo.media.video import Video
from dozo.exiftool import ExifTool, ExifToolCaching
from ordigi import constants
from ordigi.media import Media
from ordigi.images import Images
from ordigi.exiftool import ExifTool, ExifToolCaching
DOZO_PATH = Path(__file__).parent.parent
ORDIGI_PATH = Path(__file__).parent.parent
CACHING = True
class TestMetadata: