installer

This commit is contained in:
2024-05-26 23:25:59 +02:00
parent 0dea53d8f5
commit f4ace7efa3
7 changed files with 69 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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.")

11
install/AutoPictureV3.desktop Executable file
View File

@@ -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

View File

@@ -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"

View File

@@ -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}")

View File

@@ -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')