diff --git a/CHANGELOG.md b/CHANGELOG.md index f38b603..19107b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## v0.2.0 [] - Added i18n for multi language support +- Added en, fr, it, ru and uk as language. en is set to default in `config.yml` - Fixed tests - Fixed gitlab CI file - Fixed bug on string splitting at filtering date/time diff --git a/README.md b/README.md index 474461c..2747175 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AutoPicture V3 -Bildersortierprogramm geschrieben in Python3.12. +Picture sorting software written in python3. Example structure: ```bash @@ -41,7 +41,7 @@ app/Bilder/ ``` -# Erste Schritte +# Setup ## Python diff --git a/install.py b/install.py index 4640904..3f51869 100644 --- a/install.py +++ b/install.py @@ -1 +1,50 @@ -# TODO +import distutils.text_file +import platform +import os +import shutil +import pkg_resources + + +WORKDIR = os.getcwd() +OS_SUPPORTED = platform.system() in ['Linux', 'Mac', 'Windows'] +PYTHON_SUPPORTED = platform.python_version() >= '3.10' + + +def install_linux(): + install_path = os.path.join('~', '.local', 'share', 'AutoPicture_v3') + if os.path.exists(install_path): exit('Sorry, this software is already installed') + # shutil.copy() + + +def install_mac(): + pass + + +def install_windows(): + pass + + +def check_pip(): + pkg_resources.require(open(os.path.join(WORKDIR,'requirements.txt' ), mode='r')) + + +def check_supported_host(): + print(f'Detected OS: {platform.system()}') + print(f'Detected Python: {platform.python_version()}') + print() + print('OS Supported: OK') if OS_SUPPORTED else print('OS Supported: NO') + print('Python supported: OK') if PYTHON_SUPPORTED else print('Python supported: NO') + + +check_supported_host() +check_pip() + + +match platform.system(): + case 'Linux': install_linux() + case 'Mac': install_mac() + case 'Windows': install_windows() + case _: print("Your system is not supported.") + + + diff --git a/install/AutoPictureV3.desktop b/install/AutoPictureV3.desktop new file mode 100755 index 0000000..9e0bbc3 --- /dev/null +++ b/install/AutoPictureV3.desktop @@ -0,0 +1,11 @@ +#!/usr/bin/env xdg-open + +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Name=AutoPicture v3 +Comment=Picture sorting software written in python3 +Icon=/path/to/icon.xpm +Exec=sh ~/.local/share/AutoPictureV3/run.sh +Terminal=True +Categories=Picture;Sorting \ No newline at end of file diff --git a/src/config.yml b/src/config.yml index 6cfe118..cc5679b 100644 --- a/src/config.yml +++ b/src/config.yml @@ -4,4 +4,5 @@ src: "../app/Temp" # dst (destination) ist the path, were the images are going to be sorted dst: "../app/Bilder" +# de, en, fr, it, ru, uk language: "en" \ No newline at end of file diff --git a/src/file_handler.py b/src/file_handler.py index 1be3dc0..5bef61b 100644 --- a/src/file_handler.py +++ b/src/file_handler.py @@ -22,10 +22,10 @@ def sort_pictures(images:list, dst:str, logger:logging.Logger): image:ExifData if not image: continue path = os.path.join(dst, str(image.make), str(image.year), str(image.month), str(image.day)) - if not os.path.exists(path): os.makedirs(path) + image_dst = os.path.join(path, image.name) + if not os.path.exists(path): os.makedirs(path, exist_ok=True) stat_info = os.stat(image.path) - image_dst = f"{path}{os.sep}{image.name}" shutil.move(src=image.path, dst=image_dst) # os.chmod(path=f"{path}/{image.name}", mode=stat_info.st_mode) logger.info(f"Moved {image.path} -> {image_dst}") diff --git a/tests/helpers/folder_helper.py b/tests/helpers/folder_helper.py index 536497f..8013a5a 100644 --- a/tests/helpers/folder_helper.py +++ b/tests/helpers/folder_helper.py @@ -4,8 +4,8 @@ from pathlib import Path from src.scan_folder import recursive_scan_folder -TEST_FOLDER = ".test_folder" -TEST_IMAGES = f"tests{os.sep}test_files" +TEST_FOLDER = '.test_folder' +TEST_IMAGES = os.path.join('tests', 'test_files') TEST_TEMP_FOLDER = os.path.join(TEST_FOLDER, 'Temp') TEST_IMAGE_FOLDER = os.path.join(TEST_FOLDER, 'Images')